Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
Please make a complete small document that shows all the packages loaded so the problem may be reproduced. –  David Carlisle Nov 27 '12 at 23:04
    
@DavidCarlisle Did that. Thanks –  Abhishek Nov 27 '12 at 23:12
    
Try \textcolor{red}{(B)} instead of {\color{red}(B)} –  egreg Nov 27 '12 at 23:15
    
@egreg That does not fix the error. Thanks anyways –  Abhishek Nov 27 '12 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 '12 at 23:19
add comment

1 Answer

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.

share|improve this answer
    
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 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 Nov 28 '12 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 '12 at 0:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.