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.

4
  • 1
    Please make a complete small document that shows all the packages loaded so the problem may be reproduced. Nov 27, 2012 at 23:04
  • Try \textcolor{red}{(B)} instead of {\color{red}(B)}
    – egreg
    Nov 27, 2012 at 23:15
  • @egreg That does not fix the error. Thanks anyways Nov 27, 2012 at 23:16
  • You get the same error with A \Rightarrow {(B)} and without loading color. So this is a problem of nath that doesn't like parentheses hidden by braces.
    – egreg
    Nov 27, 2012 at 23:19

1 Answer 1

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.

4
  • 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 Nov 27, 2012 at 23:49
  • @Abhishek I know. I never use nath because it wants to be too smart.
    – egreg
    Nov 27, 2012 at 23:58
  • Is there any other package that can do automatic nested parenthesis size adjustment for me? Nov 28, 2012 at 0: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, 2012 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .