TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to define a command with key arguments, which stores something in a table with help of the package datatool. My attempt is :

  % declare a new table
  % define the command
%call 4 times the command
% display the content of the table

I would expect "2 3 4 5", but i get "5 5 5 5". This is actually a common problem that i encounter regularly with datatools (that somehow "only the last operation is taken into account"), which shows probably that i still don't know how to use it properly... What am i doing wrong here ?

share|improve this question
up vote 7 down vote accepted

I checked the datatool manual and found the following note about \DTLnewdbentry (page 32):

The value isn’t expanded by default, but you can change this using the declaration: \dtlexpandnewvalue. This can be localised by placing it in a group, or you can switch back using: \dtlnoexpandnewvalue.

I simply rewrote \myCom:


Now the output is correct:

Datatool output

share|improve this answer
great ! i think, this solves some of my other problems with datatool ! :) – nicolas roy Jan 9 '12 at 13:25
@nicolasroy: glad to hear! :) I updated the code with \dtlnoexpandnewvalue right after the insertion. – Paulo Cereda Jan 9 '12 at 13:29
yes, without \dtlnoexpandnewvalue, one gets some bad errors... – nicolas roy Jan 9 '12 at 14:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.