Command/definedataset
< Command
Jump to navigation
Jump to search
\definedataset
Syntax
\definedataset[...][...,...=...,...] | |
[...] | name |
[...,...=...,...] | delay |
delay | yes no |
Description
Define a dataset, inside which key-value tables can be stored with \setdataset. If any tables are defined, the dataset is stored in the .tuc
file. If the optional second argument [delay=yes]
is added, each table stored in this dataset will have three extra entries: index
and order
will both contain the number (1, 2, 3, ...) of the \setdataset call that defined the table; realpage
will contain the number of the PDF page that TeX was working on when the table was stored with \setdataset.
Usage
Here is an example where the dataset is defined with the [delay=yes]
option. If the option had not been given, the index
, order
, and realpage
entries would simple be missing.
% Create the dataset `mydata` \definedataset[mydata][delay=yes] % index=1, realpage=2 \setdataset[mydata][goldfish][colour=gold] % index=2, realpage=1 \setdataset[mydata][silverfish][type=insect] \page[yes] % index=3, realpage=2; overwrites previous goldfish table. \setdataset[mydata][goldfish][type=fish] % Results in the following Lua table in the .tuc file % ["mydata"]={ % ["goldfish"]={ % ["type"]="fish", % ["index"]=3, % ["order"]=3, % ["realpage"]=2, % }, % ["goldfish"]={ % ["type"]="insect", % ["index"]=2, % ["order"]=2, % ["realpage"]=1, % }, % }
See also
- \setdataset to store a key-value tables in a dataset
- \datasetvariable to retrieve a value from a key-value table in a dataset
- More detailed explanations and examples can be found in the Key-Value Assignments article, under the section Multi-pass data.
Help from ConTeXt-Mailinglist/Forum
All issues with: