datatool package FAQ
When you add an entry to a database (either explicitly using \DTLnewdbentry
or implicitly by loading an external file), by default the value isn’t expanded. This protects any fragile commands that may be contained in the value, however if you are programatically adding values, for example, you want to do something like
\DTLnewdbentry{mydata}{SampleField}{\SampleValue}then the content for that cell will be set to
\SampleValue
, which means that whenever you use this entry it will do whatever’s the current definition of \SampleValue
at the time of use not at the time the value was stored.
If you actually want to expand the command when you add it to the database, you must enable expansion using \dtlexpandnewvalue
before you add the value to the database, but you will then need to take care to protect fragile commands.
2020-07-03 12:08:57
Permalink: https://www.dickimaw-books.com/faq.php?id=199
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=dtlexpandnewvalue
Category: datatool package
Topic:
Unexpected output