Latest news 2021-06-05: New blog post: Dickimaw Books Site Account.

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/OutsideBracesC
The 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

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:

You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

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

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

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=126