# Bug Tracker

ID 126🔗 2019-01-31 07:46:08 Open Sign in if you want to bump this report. datatool 2.29 Problems with \DTLsubstituteall

## 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

\documentclass[landscape]{article}

\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\parskip=\baselineskip
\textwidth=\paperwidth
\evensidemargin=2cm
\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

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.