7

I have a file that compiles fine. It uses nath and color packages:

\documentclass[10pt,a4paper]{article}
\usepackage{color}
\usepackage{nath}
\delimgrowth=1

\begin{document}
\begin{equation}
 A \Rightarrow (B)
\end{equation}
\end{document}

But as soon as I try to color (B), I get an error extra {. The complete file (which does not compile) is:

\documentclass[10pt,a4paper]{article}
\usepackage{color}
\usepackage{nath}
\delimgrowth=1

\begin{document}
\begin{equation}
 A \Rightarrow {\color{red}(B)}
\end{equation}
\end{document}

Removing the nath package and \delimgrowth command fixes the error. The following code compiles fine.

\documentclass[10pt,a4paper]{article}
\usepackage{color}

\begin{document}
\begin{equation}
 A \Rightarrow {\color{red}(B)}
\end{equation}
\end{document}

Also, If I remove the braces around B, the error is gone. The following code compiles fine:

\documentclass[10pt,a4paper]{article}
\usepackage{color}
\usepackage{nath}
\delimgrowth=1

\begin{document}
\begin{equation}
 A \Rightarrow {\color{red}B}
\end{equation}
\end{document}

Thanks to @egreg for pointing out that nath does not like paretheses hidden away inside braces. The following code also does not compile:

\documentclass[10pt,a4paper]{article}
\usepackage{nath}
\delimgrowth=1

\begin{document}
\begin{equation}
 A \Rightarrow {(B)}
\end{equation}
\end{document}

So, my question is: Is there a way to have colored equations in a file that uses nath to automatically resize nested parentheses?

I learned about the nath package from automatic size adjustment for nested parentheses.

1 Answers1

6

You get the same error with the following document:

\documentclass[10pt,a4paper]{article}
\usepackage{nath}
\delimgrowth=1

\begin{document}
\begin{equation}
 A \Rightarrow {(B)}
\end{equation}
\end{document}

with or without \delimgrowth, because nath doesn't like the parentheses to be hidden inside braces.

You can go around this limitation like this:

\documentclass[10pt,a4paper]{article}
\usepackage{color}
\usepackage{nath}
\delimgrowth=1

\begin{document}
\begin{equation}
 A \Rightarrow \textcolor{red}{\mbox{$(B)$}}
\end{equation}
\end{document}

but I don't know if this is useful for your real case.

egreg
  • 1,121,712
  • Thanks @egreg . It compiles and looks good. However, This solution turns off nath's automatic parenthesis size adjustment inside the mbox part. This might not be desirable in general – Abhishek Anand Nov 27 '12 at 23:49
  • @Abhishek I know. I never use nath because it wants to be too smart. – egreg Nov 27 '12 at 23:58
  • Is there any other package that can do automatic nested parenthesis size adjustment for me? – Abhishek Anand Nov 28 '12 at 00:07
  • @Abhishek Maybe I'm old fashioned, but I like to choose by myself when growing fences or two story fractions should be used. – egreg Nov 28 '12 at 00:11