• Tidak ada hasil yang ditemukan

datatool: Databases and data manipulation - BaKoMa TeX

N/A
N/A
Nguyễn Gia Hào

Academic year: 2023

Membagikan "datatool: Databases and data manipulation - BaKoMa TeX"

Copied!
387
0
0

Teks penuh

If ⟨string1⟩and⟨string2⟩ are the same, then do ⟨true part⟩, else do ⟨false part⟩. If⟨string1⟩ is alphabetically greater than⟨string2⟩, then do⟨part true⟩, else do⟨false part⟩.

This checks if ⟨arg1⟩ is greater than ⟨arg2⟩. arg2⟩ are numeric, a numeric comparison is used, otherwise a case-sensitive alphabetic comparison is used. This checks if ⟨arg1⟩ is greater than ⟨arg2⟩. arg2⟩ are numeric, numeric comparison is used, otherwise case-insensitive alphabetic comparison is used.

Creating a New Database

This creates a new entry with identifier⟨key⟩ whose value is⟨value⟩ and adds it to the last row of the database named⟨db name⟩. This adds the entry with the key given by⟨key⟩ and the value given by⟨value⟩ to the first row in the database⟨db⟩ that satisfies the condition given by ⟨condition⟩.

Loading a Database from an External ASCII File

When using \DTLloaddb, all the special characters that appear in the command retain their LATEX meaning when the file is loaded. Note that the warning in the previous section about no paragraph breaks in a record also applies to records loaded from a database.

Table 1: Special character mappings used by \DTLloadrawdb (note that the back- back-slash retains its active state)
Table 1: Special character mappings used by \DTLloadrawdb (note that the back- back-slash retains its active state)

Displaying the Contents of a Database

If a column contains at least one string, the data type of the column is string. If the column contains only real and integer numbers, the data type of the column is real.

Table 2: Time to Growth Data Incubation
Table 2: Time to Growth Data Incubation

Iterating Through a Database

Note that \dtltype matches the column type, but if the items in the column have mixed types, it may not match the type of the current item. At the end of the table, \DTLsavelastrowcount is used to store the number of rows in the table.

Table 4: Student scores
Table 4: Student scores

Null Values

First Name Last Name Email 1 Email 2 Reg Num Mary Jones [email protected] [email protected] Missing. Surname, FirstName, RegNum, Email1, Email2 Jones, Mary,[email protected],[email protected] Smith,Adam,12345,[email protected],.

Editing Database Rows

Suppose I now want to calculate the average grade for each student and add it to the database. Note that if I just wanted to get the averages for the table and nothing else, I could have simply calculated and displayed the average in each row of the table without adding the information to the database, but I'm going to reuse this information in a example 32, so if I add it to the database, I don't have to recalculate the average.

Arithmetical Computations on Database Entries

This command calculates the variance of all entries over all databases listed in list ⟨db⟩ for all keys in ⟨keylist⟩ where the condition given by ⟨condition⟩ is true. This command calculates the standard deviation of all entries over all databases listed in ⟨db⟩ list for all keys in ⟨keylist⟩ where the condition is given.

Table 19: Student scores First Name Surname Score (%)
Table 19: Student scores First Name Surname Score (%)

Sorting a Database

This sorts the database named ⟨db name⟩ according to the criteria given by . sort criteria⟩, which must be a comma-separated list of keys and optional. order⟩, where ⟨order⟩ is ascending or descending. First, I'm going to sort the database based on student scores in descending order (highest to lowest) and list the database in a table.

Table 20: Student scores (sorted by score) First Name Surname Score (%)
Table 20: Student scores (sorted by score) First Name Surname Score (%)

Saving a Database to an External File

Deleting or Clearing a Database

Advanced Database Commands

Maps ⟨row cs⟩ and ⟨column cs⟩ to the indexes of the first entry in ⟨database⟩. If true, the inner labels are rotated along the spokes of the pie chart, otherwise the inner labels are not rotated. If true, the outer labels are rotated along the spokes of the pie chart, otherwise the outer labels are not rotated.

Figure 2: A pie chart (outer labels set)
Figure 2: A pie chart (outer labels set)

Pie Chart Variables

Pie Chart Label Formatting

Pie Chart Colours

The outer label format has been changed to use .. shortstack to prevent the outer labels from taking up so much horizontal space. The outer label option has also been changed to use \\ after the name to move the percentage value to the next row.).

Adding Extra Commands Before and After the Pie ChartChart

You can use \relaxals an element of the list to suppress markers for the corresponding plot. If omitted, the labels are the value of the 𝑥tick position, rounded to ⟨n⟩ decimal places, where ⟨n⟩ is given by the value of the counter DTLplotroundXvar. If omitted, the labels are the value of the 𝑦 tick position, rounded to ⟨n⟩ decimal places, where ⟨n⟩ is given by the value of the counter DTLplotroundYvar.

Figure 10: An annotated pie chart
Figure 10: An annotated pie chart

Adding Information to the Plot

I'm also going to set the 𝑥-axis label to Height (m) and the 𝑦-axis label to Weight (kg) and place a box around the plot. They are both defined to do nothing by default, but can be redefined to add commands to the image. This adds a new row to the plot legend where ⟨marker⟩ is code to produce the marker, ⟨linestyle⟩ is code to set the line style, and ⟨text⟩ is a textual label.

Figure 13: A scatter plot
Figure 13: A scatter plot

Global Plot Settings

This is the horizontal distance from the border of the plot to the outer border of the legend. This is the vertical distance from the border of the plot to the outer border of the legend. This should be a comma separated list of pgf code to set the drawing line style.

Adding to a Plot Stream

The control sequence must be one of the control sequences to appear in the command list ⟨values⟩. Each control range must be one of the control ranges to appear in the command list ⟨values⟩. This setting is required for \DTLmultibarchart, and is not available for \DTLbarchart. max This specifies the maximum value on the 𝑦axis.

Figure 17: Time to growth data
Figure 17: Time to growth data

Changing the Appearance of a Bar Chart

⟨n⟩ labels are rounded to ⟨n⟩ digits after the decimal point, where ⟨n⟩ is given by the value of the DTLbarroundvar counter. This places the name followed by the quantity in parentheses in the middle of the bar. The bottom tag uses the name key value, and the top tag uses the quantity.

Figure 18: A basic bar chart
Figure 18: A basic bar chart

B ib TEX: An Overview

In the above, the first names are Henry James, the "von part" is de and the last name is Vere. In the above, the first name is Maria Eliza, the von part is De La, and the last name is Cruz. Again, the ⟨von-delen⟩ is optional and is determined by the case of the first letter.

Loading a databib database

Displaying a databib database

This tests whether the field value given by ⟨field label⟩ is less than ⟨value⟩. This tests whether the value of the field given by ⟨field tag⟩ is greater than . This tests whether the field value given by ⟨field tag⟩ is greater than or equal to ⟨value⟩.

Changing the bibliography style

This uses abbrvstyle to display the author's initials (which are determined from ⟨names⟩). The DTLmaxauthors counter is used to determine the maximum number of authors to display for a given entry. For example, if you've used a summary field in any of your entries, you can display the summary like this:

Iterating through a databib database

If the field specified by ⟨field tag⟩ exists for the current bibliographic entry, it exists. If the current bibliographic item has one or more fields specified in the ⟨field tag list⟩, it is considered a ⟨true part⟩, otherwise a ⟨false part⟩. Checks for the existence of the command \DTLformat⟨input type⟩ where ⟨input type⟩ is specified by .

Multiple Bibliographies

Note that there will be some duplication as the references in the mini-bibliographies will also appear in the main bibliography at the end of the document, but the use of \DTLcite and \DTLmbibliography ensures that all the cross-reference tags (and hyperlinks they are activated) is unique. In this section I will describe some research work on kernel methods, and in the process I will cite some related papers \DTLcite{kernel}{Cawley2007a,Cawley2006a}. In this section I will describe some research work in the field of food safety, and in the process I will cite some related papers \DTLcite{food}{Peck1999,Barker1999a}.

Defining and Undefining People

Likewise, don't just copy the contents of the .bbl file into your document without first defining the database using \DTLnewdb and setting \DTLBIBdbname to the name of the database. The person pack allows you to define a person by their full name, known name and gender. However, this can lead to errors (especially if the previous person's name was Mary!) With the person package, you only need to change the definition of the person by changing the arguments for.

Displaying Information

If more than one person has been defined, these commands will display They/Them/Their/Their or They/Them/Their/Their as appropriate. I could give each person a unique label based on the number of rows (\DTLcurrentindex), but since I don't need to reuse the information, I can use the default label and un-define the person when it's no longer needed. For some students, the gender is indicated by a single letter ("m" or "f"), while for others the gender is indicated by an entire word ("male" or "female").

Advanced Commands

Get the gender of the person identified by ⟨label⟩ and store it in ⟨cs⟩ (which must be the name of the command). Gets the name of the person identified by ⟨label⟩ and stores it in ⟨cs⟩ (which must be the name of the command). Gets the full name of the person identified by ⟨label⟩ and stores it in ⟨cs⟩ (which must be the name of the command).

Package Declaration

Package Options

Set\@dtl@intpart. ifnum\@dtl@tmpcount<0\relax. dtl@strip@numgrpchar{\@dtl@intpart}%. let\@dtl@get@nextintpart=\@dtl@get@int@part. let\@dtl@get@nextintpart=\@dtl@get@int@part. multiply\@dtl@tmpcount by -1\relax. let\@dtl@get@nextintpart=\@dtl@get@int@part. let\@dtl@get@nextintpart=\@dtl@get@int@part. let\@dtl@get@nextintpart=\@devour. let\@dtl@get@nextintpart=\@dtl@get@next@intpart. dtl@choptrailingzeroes \@dtl@choptrailingzeroes{⟨cmd⟩}. Trims the trailing zeros from the number given by ⟨cmd⟩. expandafter\@dtl@chop@trailingzeroes#1\@nil%. dtl@chop@trailingzeroes. Trailing zeroes are chopped using a recursive algorithm. dtl@tmpcp must be set before using this.

Determining Data Types

String comparison (starred version ignores case). ifnum\@dtl@tmpcount>0\relax. ifnum\@dtl@tmpcount<0\relax. ifnum\@dtl@tmpcount>0\relax. ifnum\@dtl@tmpcount<0\relax. Are \DTLifnumopenbetweenif {⟨arg⟩}, ⟨min⟩ and ⟨max⟩ numeric, otherwise do \DTLifstringopenbetween or\DTLifstringopenbetween*. expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}%. ifnum\@dtl@datatype>0\relax. expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}%. ifnum\@dtl@datatype>0\relax. The following conditions are only intended to be used within\DTL before they depend on the counterDTLrow⟨n⟩. DTLiffirstrow \DTLiffirstrow{⟨true part⟩}{⟨false part⟩}.

DTLisiclosedbetween Provide conditional command for use in\ifthen. dtl@testopenbetween Command to test whether the first value lies between the second and third values. DTLisiopenbetween Provide conditional command for use in\ifthen. dtl@testclosedbetween Command to test whether the first number lies between the second and third numbers. Specify conditional command to use in \event. dtl@testopenbetween Command to test whether the first number lies between the second and third number.

Defining New Databases

Define a token registry used to store database content. expandafter\newtoks\csname dtldb@#1\endcsname. No check was performed to see if the database exists.). global\advance\csname dtlrows@#1\endcsname by 1\relax Add an empty row to the database. noexpand\db@row@id@w \number\csname dtlrows@#1\endcsname. noexpand\db@row@id@end@%. noexpand\db@row@id@w \number\csname dtlrows@#1\endcsname. noexpand\db@row@id@end@%. noexpand\db@row@elt@end@%. PackageError{datatool}{Database '#2' does not exist}{}%. dtl@getcolumnindex Starred version of \DTLgetcolumnindex. expandafter\let\expandafter#1\csname dtl@ci@#2@#3\endcsname.

Accessing Data

PackageError{datatool}{Cannot add item with ID '#2' to current row of database '#1'}{There is already an item with this ID in current row}%. Checks whether a database with the specified name exists. let\@dtl@next\@dtl@assigncmdnoop. let\@dtl@next\@dtl@assigncmd. dtl@setnull \@dtl@setnull{⟨cmd⟩}{⟨id⟩}sets⟨cmd⟩ to \DTLstringnullor\DTLnumbernull depending on the data type for ⟨id⟩. Database name should be stored in . Retrieves data for given key in database⟨db⟩: column index is stored in ⟨col cs⟩ and data type is stored in ⟨type cs⟩.

Iterating Through Databases

Set definition for this level (sets to at the end of the current iteration). Stores the maximum number of rows for last\DTLforeach. advance\@dtl@tmpcount with 1\relax. csname c@DTLrow\romannumeral\@dtl@tmpcount\endcsname}%.

Gambar

Table 1: Special character mappings used by \DTLloadrawdb (note that the back- back-slash retains its active state)
Table 2: Time to Growth Data Incubation
Table 4: Student scores
Table 5: Student scores
+7

Referensi

Dokumen terkait

Foucault's view related to the phenomenon of triple-entry and double-entry is a power over the knowledge that triple-entry is becoming a new paradigm in the system of recording