Bug Tracker 
| ID | 319🔗 |
|---|---|
| Date: | 2026-08-21 19:35:58 |
| Last update: | 2026-08-22 06:47:11 |
| Status | Open Sign in if you want to bump this report. |
| Category | datatool |
| Version | 3.4.4 |
| Summary | \DTLifhaskey no longer accepts paragraphs in arguments |
Sign in to subscribe to notifications about this report.
Description
\DTLifhaskey no longer accepts paragraphs in its code arguments (true / false branches) in Datatool 3.4.4, whereas this worked with the old Datatool 2.32. Background and MWE:
In datatool 3.4.4, \DTLifhaskey is now defined as
\NewDocumentCommand \DTLifhaskey { s m m m m }
As a consequence, the true and false code arguments cannot contain \par. Like in this MWE (also attached):
\documentclass{article}
\usepackage{datatool}
\begin{document}
\DTLnewdb{db}
\DTLifhaskey{db}{key}
{True branch. \par With extra paragraph.}
{False branch.\par With extra paragraph.}
\end{document}
Attempting to do so causes an error:
Runaway argument?
{True branch.
! Paragraph ended before \DTLifhaskey was complete.
<to be read again>
\par
l.10 {True branch. \par
With extra paragraph.}
Old Version:Currently I am converting all my documents from 2.x to the 3.x generation of DATATOOL.
If using the same MWE with the old Datatool 2.32 from 2019, then there is no problem.
Here is the code from old Datatool:
\newcommand*{\DTLifhaskey}{\@ifstar\@sDTLifhaskey\@DTLifhaskey}
\newcommand{\@DTLifhaskey}[4]{...}
Note that in the past \@DTLifhaskey was a long command. This means that also \DTLifhaskey has accepted paragraphs in its argument.In the latest Datatool 3.4.4 the macro is defined as:
\NewDocumentCommand \DTLifhaskey { s m m m m }
Would it perhaps be better (especially regarding backward compatibility) for the two code arguments to be long arguments, preserving the previous behaviour?
\NewDocumentCommand \DTLifhaskey { s m m +m +m }
This would also seem consistent with, for example,
\NewDocumentCommand \DTLifdbempty { m +m +m }
I you decide that \DTLifhaskey will not accept long arguments, then please tell me. I would need to change my documents then.Other macros:
I also noticed two related commands:
\NewDocumentCommand \DTLmaprow { m m }
\NewDocumentCommand \dtlmapcurrentrow { m m }
In both cases the second argument is used as code/a loop body. Perhaps these arguments should be +m as well?Thanks
In any case thanks for providing the wonderful DATATOOL package.
MWE
Download (218B)
\documentclass{article}
\usepackage{datatool}
\begin{document}
\DTLnewdb{db}
\DTLifhaskey{db}{key}
{True branch. \par With extra paragraph.}
{False branch.\par With extra paragraph.}
\end{document}Evaluation
Comments
0 comments.
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=319
