# [R] Is nesting {} inside \eqn OK?

Ross Boylan ross at biostat.ucsf.edu
Tue Nov 9 22:42:31 CET 2004

I'm seeing various things fail when I try to next braces inside \eqn.
This source
\eqn{{\bf\beta}_j}{b(j)} is the vector
produces this error
----------------------------------------------

! Missing $inserted. <inserted text>$
l.258 \eqn{{\bf\beta}_j}{\bf\beta}_
j{{b(j)} is the vector of
coefficients fo...
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing } inserted.
<inserted text>
}
l.258 ...tor of coefficients for outcome \eqn{j}{}
and
I've inserted something that you may have forgotten.
-------------------------------------------------------

Notice that the argument seems to have been doubled.
I tried using \begingroup and \endgroup, and ran into problem with a
later \eqn with nested braces.

For reference, particularly in case I've missed something earlier, here
is a fuller excerpt from the input file:
--------------------------------------------
With \eqn{J} possible outcomes and \eqn{p_j}{p(j)} the probability of
the \eqn{j}'th outcome,
the formula is \deqn{\newcommand{\B}{{\bf \beta}}\newcommand{\X}{{\bf
X}}
p_j = \frac{e^{\X\B_j}}{\displaystyle\sum_{k=0}^J e^{\X\B_k}}.}{
p(j) = exp[X*b(j)]/sum{exp[X*b(k)], k=0 to J}.}
\eqn{{\bf\beta}_j}{b(j)} is the vector of coefficients for outcome
\eqn{j} and
\eqn{{\bf X}}{X} are the covariates.

--------------------------------------------

By the way, the \newcommand is not global, so I can't use \B (for
example) in later \eqn's.

Using R 2.0.0.
--
Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          ross at biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062