[texhax] parenthesis problem in LaTeX

Tom Schneider toms at ncifcrf.gov
Wed Jan 14 01:43:42 CET 2009


Here's a puzzle for the sharp folks on this list!

\documentclass{article}
\newcommand{\theversion}{{version = 1.00 of latex2009jan13.tex 2009 Jan 13 }}
\begin{document}
\begin{center}
\textbf{A Bug in \LaTeX?}
\\
\theversion
\end{center}

\begin{equation}
H =
P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)
+
P_{\mbox{silent}} \times \left( -\log_2 ( P_{\mbox{silent}}) \right)
\end{equation}

The outer pair of parenthesis on the left are made using
\verb|\left(|
and
\verb|\right)|, and indeed they show up as larger than the inner parenthesis.
However, on the right side of the equation, the same
pair of commands fails to give the same size parenthesis.

Ok, try go get around the bug by using big:

\begin{equation}
H =
P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)
+
P_{\mbox{silent}} \times \big( -\log_2 ( P_{\mbox{silent}}) \big)
\end{equation}
That failed.

Try bigg:
\begin{equation}
H =
P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)
+
P_{\mbox{silent}} \times \bigg( -\log_2 ( P_{\mbox{silent}}) \bigg)
\end{equation}
bigg is too big!

\begin{equation}
H =
P_{\mbox{ring}}   \times \bigg( -\log_2 ( P_{\mbox{ring}})   \bigg)
+
P_{\mbox{silent}} \times \bigg( -\log_2 ( P_{\mbox{silent}}) \bigg)
\end{equation}

Extra braces do not help:
\begin{equation}
H =
{P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)}
+
{P_{\mbox{silent}} \times \left( -\log_2 ( P_{\mbox{silent}}) \right)}
\end{equation}

Finally, make the equation parts exactly identical:
\begin{equation}
H =
P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)
+
P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)
\end{equation}
That worked.  So why would the height be different?  It's the `g'?

Try removing the g:
\begin{equation}
H =
P_{\mbox{ring}}   \times \left( -\log_2 ( P_{\mbox{ring}})   \right)
+
P_{\mbox{rinc}}   \times \left( -\log_2 ( P_{\mbox{rinc}})   \right)
\end{equation}
Now they are the same, but of course it says the wrong thing.

So how should this be typeset?

\begin{verbatim}

Tom

  Dr. Thomas D. Schneider
  National Institutes of Health
  National Cancer Institute
  Center for Cancer Research Nanobiology Program
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  toms at ncifcrf.gov
  permanent email: toms at alum.mit.edu
  http://www.ccrnp.ncifcrf.gov/~toms/
\end{verbatim}
\end{document}


More information about the texhax mailing list