Latex
Overview
Automatically Generating a Table
The above table works to display a table, but it has the downside that one has to type in the
data. Because the latex app utilizes the
dynamic text specification, you can write a script that will iterate over a dataset and insert
the appropriate text. The following demonstrates an example, where the dataset is named "category"
and contians three columns: category, subcategory and value.
tikz
\begin{table}[h!]
\centering
\begin{tabular}{l l l}
\hline\hline
category & subcategory & value\\\hline
{:
$val("category").forEach(p=>{
print(p.category);
print(" & ");
print(p.subcategory);
print(" & ");
print(p.value);
print(" \\\\ \n");
});
:}\hline
\end{tabular}
\end{table}
As a shortcut to writing the above code, the latex app includes the ability to auto generate a table from a dataset. Open the
table tool by clicking the table link. There will be drop down box. Select the dataset that you wish to generate a table from,
and then click add. The table script will be inserted in the latex document where the current mouse cursor is at. Note,
this will generate a table for all columns, if you wish to only use a subset of the columns, or use them in a particular order,
you will need to edit the script.
Gallery