Bug Tracker

ID:130 🔗
Status:Closed (Fixed)
Date:2019-05-24 16:05:26
Summary:Some tests don't support well \noalign material



Some tests in dataool.sty (2018/12/07 v2.31 (NLCT)) don't support well \noalign material in one of the <true> and <false> clauses. This is because they use \relax to be sure to terminate a <number>, but this is not necessary as what precedes is already a <number> according to TeX's grammar. The \relax, when seen (which depends on which clause is used), makes TeX stop its search for \noalign, which causes a (for instance) subsequent \rowcolor to fail, because \rowcolor expands to something containing \noalign, but that is too late for \noalign to be valid because of the unneeded \relax. For instance, let's have a look at:

   \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname
   =\csname dtlrows@#2\endcsname\relax

\dtlrows@DBNAME being a \countdef token, it is already a <number>, therefore the \relax isn't necessary, and is actually harmful because it prevents the attached MWE from working ("Misplaced \noalign" error). Removing the \relax in the appropriate definition of \DTLiflastrow allows that example to work.

Note: both definitions of \DTLiflastrow have the same problem.

I haven't looked at all tests, but at least \DTLiffirstrow seems to suffer from the same problem:

   \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname

The \relax shouldn't be needed since a space token terminates a TeX <number>. Besides, space tokens are ignored when TeX is looking for \noalign or \omit inside an alignment, therefore such a space token instead of the \relax would allow for the useful case where ##1 contains \noalign material.

FYI, this problem is mentioned here on TeX.SX:

Color rows with \rowcolor and datatool \DTLforeach loop







After rows from the CSV file



I've removed \relax from \DTLiffirstrow and \DTLiflastrow in version 2.32 (2019-09-27) but your MWE is missing \\ so it won't work even with the fix. I'm guessing you intended \word\\ in the body of the loop.


Comment from anonymous. 2019-11-13 00:27 GMT

Yes, you guessed right about \word\\: somehow, I forgot the \\ when preparing the MWE---sorry about that.

Thanks for the fix. :-)

Comment from Nicola Talbot. 2019-11-13 10:38 GMT

You're welcome :-)

Add comment or return to search results.

Watch This Report

If you would like to be notified whenever updates are made to this report, please fill in your email address in the box below and click on "Notify Me of Changes" button. (Please ensure the address is valid.) Your details won't be passed on to third parties in line with this site's Privacy Policy.

If you supply your name, it will be used in the email greeting, which provides a more personal message, otherwise you'll just get a generic greeting. If you have previously supplied your name when signing up for notifications, you don't need to resupply it unless you want to change it.

If you have previously subscribed to notifications for this report, you can unsubscribe by clicking on the "Stop Notification" button.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

E mail:
Confirm E mail:
Confirm Bug ID:

To unsubscribe from all notifications use the notifications page.


You can append a comment to the report using the form below. Comments are checked first before being added. Any spam or offensive content will be removed first according to this site's Terms of Website Use. Please bear in mind that I develop and maintain free software in my spare time. If you want commerical level support then you can hire a TeX consultant.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional. If provided, it will be shown with the comment.)
Confirm Bug ID:

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace text[/tt]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url]

Ordered list:
[li]first item[/li]
[li]second item[/li]

Unordered list:
[li]first item[/li]
[li]second item[/li]

Click on the Preview button to preview the message.

Return to search results.