# Bug Tracker

ID: 126 🔗 Open datatool 2.29 2019-01-31 07:46:08 Problems with \DTLsubstituteall

## Report

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}


## Watch This Report

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).

Name: (Optional.)