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 ?


1 Answer 1


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

  • great ! i think, this solves some of my other problems with datatool ! :) Jan 9, 2012 at 13:25
  • @nicolasroy: glad to hear! :) I updated the code with \dtlnoexpandnewvalue right after the insertion. Jan 9, 2012 at 13:29
  • yes, without \dtlnoexpandnewvalue, one gets some bad errors... Jan 9, 2012 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .