Math & ScienceHanging margin notes in equation environment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

Hanging margin notes in equation environment

Post by audreyk »

Hi,

I am trying to include the words (Case 1:) and (Case 2:) as margin notes relevant to each line of the numbered equation, quoted below:

Code: Select all

\begin{equation}\label{e10:11}
 \begin{array}{l@{}l@{}l}
d > c & {\marginpar \textbf{Case 1:}} \textrm{ and } & a > b, b < d, c < a\\
d < c & {\marginpar \textbf{Case 2:}} \textrm{ and } & a < b, b > d, c > a
\end{array}
\end{equation}
Unfortunately, I get an error pdftexifying the code.

It appears that \marginpar cannot be used in math mode.

Can someone please provide other suggestions for achieving margin notes within an equation environment, or direct me to some legitimate examples of how to hang text in math mode?

Thanks,
audreyk

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: Hanging margin notes in equation environment

Post by phi »

Hello,

have a look at the marginnote package.
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

Re: Hanging margin notes in equation environment

Post by audreyk »

Yes, I have already referred to the marginnote package, but am still fairly new at using LaTeX and not sure what lines of code I need to add to my preamble or document content in order to execute the hanging text within the equation environment.

Your help would be much appreciated if you could provide more specific examples of where this formatting has been used.

Thanks,
A.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Hanging margin notes in equation environment

Post by phi »

The interface to the marginnote package is very simple. Put

Code: Select all

\usepackage{marginnote}
into the preamble (between \documentclass and \begin{document}) to include the package and then replace \marginpar by \marginnote.

You've made a syntax error in your example (which you probably didn't notice because of the error produced by the \marginpar): The argument of the \marginpar or \marginnote command (the text that is to appear in the margin) must be put in a pair of braces:

Code: Select all

\marginnote{\textbf{Case 1:}}
This is the same kind of syntax that you already used for the \label or \textrm commands.
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

Re: Hanging margin notes in equation environment

Post by audreyk »

Dear phi:

By following your precise instructions, I was able to hang the 'Case 1:' title within the equation environment.

Thanks for your guidance.

Regards,
A.
Post Reply