[texhax] marginpar in maths environment

doug waud douglas.waud at umassmed.edu
Sun Jul 20 01:22:04 CEST 2003


Hi

Harish S. Bhanderi wrote:

> I have a question about margin notes, namely the command \marginpar. I
> can't use it within a maths environment. So if I have:
> 
> \marginpar{The first eq. comes from (1.64), the second comes from ...}
> \begin{eqnarray}
> A = B \\
> B = C \\
> C = D
> \end{eqnarray}
> 
> This works but the comment in the margin appears on the line above the
> equation rather than on the same line. So when I try:
> 
> \begin{eqnarray}
> \marginpar{This eq. comes from (1.64)}
> A = B \\
> \marginpar{This eq. comes from (1.83)}
> B = C \\
> \marginpar{This eq. comes from (1.93)}
> C = D
> \end{eqnarray}
> 
> Everything goes wrong! 

In the Latex Users Guide, page 59, under 3.5.2 Marginal Notes, line 3 
states that "TeX is in paragraph mode" when processing the marginal 
note. You are not there when you are in the middle of the eqnarray. So 
it looks like the old "you can't get there from here".

I did find a work-around which my help if you do not have too many cases 
where you want to do this. Here is the test/example file I used.

\documentclass{article}
\begin{document}
This is just a document to test $\backslash$marginpar and 
$\backslash$eqnarray.

\marginpar{\vspace{27pt}This equation comes from (1.60)}
\begin{eqnarray}
A=B\\
B=C\\
C=D
\end{eqnarray}

\marginpar{\vspace{24pt}From (1.60)
\par\vspace{3pt}From (1.61)
\par\vspace{3pt}From (1.62)}
\begin{eqnarray}
A=B\\
B=C\\
C=D
\end{eqnarray}

\end{document}

The first eqnarray just shows how to move that marginal comment down to 
a place opposite the first equation.

The next shows how to get a comment for each equation (of course I had 
to shorten the comment so it would fit on one line).

You do have to play with those vspaces on a trial and error basis, but 
on page 60 the manual notes that you may have to do this in other cases 
and simply recommends that you wait until the last run for such fine-tuning.

Please note I am not a guru here; there may be a more elegant solution 
but I did not see one come up so I thought the above might be better 
than nothing.  :-)

doug








More information about the texhax mailing list