# Incompatibility between etextools and etoolbox command \dolistloop (\forlistloop)?

The following code uses the etoolbox package to convert a list a,b,c into an internal list (called \mylist) and then typesets that with colons: a:b:c:. However, when I load the etextools package (by uncommenting the second line), I get no list output.

\documentclass{minimal}
\usepackage{etoolbox}
%\usepackage{etextools}
\begin{document}
A list:
\def\mylist{}
\def\do#1{#1:}
\dolistloop{\mylist}
\end{document}


I suspect it is is a bug since etextools claims to depend on etoolbox. Is this a bug or am I doing something wrong? In either case, how can I use \dolistloop with etextools (which I want for goodies like \expandnext)?

## Notes

• \show\mylist produces the same output a|b|c| in both cases, so the problem is with \dolistloop which expands to \forlistloop\do
• The \forlistloop command becomes substantially more complicated when etextools is used.
• This question might be relevant (but not obviously).
-
The \DeclareCmdListParser\listloop{|} command in etextools.sty is responsible for changing \forlistloop. Not sure yet why this breaks the behaviour. –  mforbes Mar 26 '12 at 22:12
If one is committed to using etextools, then \listloop{\mylist} works where \dolistloop{\mylist} fails. I would still like code that works with and without etextools. –  mforbes Mar 26 '12 at 22:19
Just a note that this bug has been noticed before. I also sent a message to Florent Chervet mentioning this bug. –  mforbes Mar 28 '12 at 4:13

This might be a bug in the etextools package. In fact, \forlistloop is currently redefined in a way incompatible with the etoolbox package. Hence, try:

\usepackage{etoolbox}
\let\origforlistloop\forlistloop
\usepackage{etextools}
\let\forlistloop\origforlistloop

-
This does not explain what the problem is, but is a reasonable practical solution (though may create other issues with etextools). Hopefully the maintainer will step in, confirm the bug, and have a suggestion for fixing it. –  mforbes Apr 12 '12 at 17:44
@mforbes: Both the etoolbox package and the etextools package define \forlistloop, but unfortunately not with the same argument signature. This is the problem. –  mhp Apr 12 '12 at 21:07
@mforbes: If you need the \dolistloop of the etoolbox package, but otherwise the \forlistloop of the etextools package don’t restore \forlistloop and use \patchcmd to replace \forlistloop with \origforlistloop in the definition of \dolistloop. –  mhp Apr 13 '12 at 6:29

If you are willing to use catoptions package, you can do

\documentclass{minimal}
%\usepackage{etoolbox} % you may load this if you like
%\usepackage{etextools} % load if you like
\usepackage{catoptions}

\begin{document}
% Add these elements to list container \mylist: