I am trying to transition to using the etoolbox
package, but seem to have run into some difficulties and they appear related to the hyperref
and bm
packages which to me seem totally unrelated. The MWE example compiles since \RemoveEToolbox
is defined and shows that there is no apparent problem before etoolbox
was used.
Commenting out the \def\RemoveEToolbox{}
line produces two problems:
-
With both the
\renewcommand
, and theusepackage{hyperref}
commented, this results in "Runaway argument? Paragraph ended before \bm@test@token was complete". -
Including the
usepackage{hyperref}
(with\renewcommand
commented) results in "Undefined control sequence. \Call@AtVeryEndDocument …cumentHook \@undefined"
But if uncomment the \renewcommand{\bm}{#1}
line (effectively doing without any \bm
), then this seems to compile.
I have been using this for a while now and things appeared to have been working fine, but now that I attempt to use etoolbox
I seem to run into problems.
\documentclass{standalone}
\def\RemoveEToolbox{}% Shows that this works fine without {etoolbox}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{bm}
\ifdefined\RemoveEToolbox
\newcommand*{\iftoggle}[3]{#2}% Default to true value of "if"
\else
\usepackage{etoolbox}
\newtoggle{paper}
\toggletrue{paper}
%\renewcommand{\bm}[1]{#1}% Why can't I have a normal \bm with {etoolbox}?
\fi
% \usepackage{hyperref}
\begin{document}
This document is intended for
\iftoggle{paper}{paper}{electronic}
distribution.
\bm{\textcolor{blue}{Solve $x^2-1=0$}}
\begin{align*}
a &= b\\
\iftoggle{paper}{
c &= d\\
}{}
e &= f\\
\end{align*}
\end{document}
Best Answer
The issues is that both the
standalone
class and theetoolbox
package redefine thedocument
environment. This causes a clash. You can avoid this by loadingetoolbox
before the class using\RequirePackage
. I will try to support the normal of this package, but it will take a while until I have to time to release a new version ofstandalone
.Workaround:
Update 2011/12/21
The new version 1.0 of
standalone
works fine withetoolbox
, due to a changed way to patch thedocument
environment. However, the new default settings ignore paragraph breaks, so you will a problem withalign*
. You can fix easily this by using thevarwidth
class option.