Bug Tracker 
| ID | 126🔗 |
|---|---|
| Date: | 2019-01-31 07:46:08 |
| Status | Open Sign in if you want to bump this report. |
| Category | datatool |
| Version | 2.29 |
| Summary | Problems with \DTLsubstituteall |
Sign in to subscribe to notifications about this report.
Description
seems the command\DTLsubstituteall of the package datatool does remove braces/pairs of matching catcode1/2-character-tokens where you wish to keep them.
The replacement text of a macro definition is formed by the sequence
{InsideBracesA},OutsideBracesA,{InsideBracesB},OutsideBracesB,{InsideBracesC},OutsideBracesC
When using \DTLsubstituteall for replacing each comma by a slash, you don't get
{InsideBracesA}/OutsideBracesA/{InsideBracesB}/OutsideBracesB/{InsideBracesC}/OutsideBracesC
but you get:
InsideBracesA/OutsideBracesA/InsideBracesB/OutsideBracesB/InsideBracesC/OutsideBracesCThe braces that surround all the phrases "InsideBraces..." get removed.
When replacing commas by slashes with the sequence
{InsideBracesA},OutsideBracesA//{InsideBracesB},OutsideBracesB//{InsideBracesC},OutsideBracesC
you don't get
{InsideBracesA}/OutsideBracesA//{InsideBracesB}/OutsideBracesB//{InsideBracesC}/OutsideBracesC
but you get:
InsideBracesA/OutsideBracesA//{InsideBracesB}/OutsideBracesB//{InsideBracesC}/OutsideBracesC
Only the braces that surround the single phrase "InsideBracesA" get removed.
Seems the behaviour of \DTLsubstituteall regarding the removal of braces cannot be predicted by just reading the datatool-documentation.
MWE
Download (0.99K)
\documentclass[landscape]{article}
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\parskip=\baselineskip
\textwidth=\paperwidth
\addtolength\textwidth{-4cm}%
\evensidemargin=2cm
\addtolength\evensidemargin{-1in}
\addtolength\evensidemargin{-\hoffset}
\oddsidemargin=\evensidemargin
\usepackage{datatool}
\begin{document}
\def\tempa{%
{InsideBracesA},OutsideBracesA,{InsideBracesB},OutsideBracesB,{InsideBracesC},OutsideBracesC%
}
All the braces are there there before the replacement:
\texttt{\meaning\tempa}%
\DTLsubstituteall{\tempa}{,}{/}
All the braces are gone after the replacement:
\texttt{\meaning\tempa}%
\null\hrulefill\null
\def\tempa{%
{InsideBracesA},OutsideBracesA//{InsideBracesB},OutsideBracesB//{InsideBracesC},OutsideBracesC%
}
All the braces are there there before the replacement:
\texttt{\meaning\tempa}
%Let's replace all commas:
\DTLsubstituteall{\tempa}{,}{/}
Only the first pair of braces is gone after the replacement:
\texttt{\meaning\tempa}
\end{document}
Evaluation
Comments
0 comments.
Add Comment
Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=126
