I have an error I do not understand. I'm running TeX Live 2009 on a Linux Debian. The following is a minimal example. The log file is attached.
Combining the new command
\aaa
with \testa
brings the error message below. What I do not understand is that it works with \bbb
, \ccc
and \testb
where the only differences areeither the parenthesis (
\ccc
) or the missing default argument (\bbb
, \testb
).I've read that this error sometimes is related to "robust" and "fragile" so I tested using
\DeclareRobustCommand
, \protect
and \newrobustcmd
(from the etoolbox package) but it did not changed a thing.Code: Select all
\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\newcommand{\aaa}[1][]{{#1}}
\newcommand{\bbb}[1]{{#1}}
\newcommand{\ccc}[1][]{#1}
\newcommand{\testa}[1][]{#1}
\newcommand{\testb}[1]{#1}
\begin{document}
%Don't work
$\aaa[ \testa[1] ]$
$\aaa[ \protect\testa[1] ]$
%Works
$\aaa[ \testa ]$
$\bbb{ \testa[1] }$
$\ccc[ \testa[1] ]$
$\aaa[ \testb{1} ]$
$\bbb{ \testb{1} }$
$\ccc[ \testb{1} ]$
\end{document}
\newcommand{\aaa}[1][]{A_{#1}}
.