# A simple way to make a line separating the text and the margin notes?

I've done the following:

And I'm trying to make a simple line to separate the text from the margin notes. It's the same as the answer in this question, but it seems too complicated to implement (or perhaps I'm too stupid, that's also a valid hypothesis). I'd like something simple to separate the note from the text. This is the my code.

\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{relsize}
\usepackage{marginnote}
\usepackage[top=1.5cm, bottom=1.5cm, outer=5cm, inner=2cm, heightrounded, marginparwidth=6.5cm, marginparsep=-2cm]{geometry}

\begin{document}

\marginnote{\begin{eqnarray*}
{n!}&=&{(n)(n-1)!} \\
{(n+1)!}&=&{(n+1)(n) (n-1)!}
\end{eqnarray*}
}[2.6cm]

\begin{eqnarray*}
{\frac{\mathlarger{\prod_{j=0}^{n}(j+1)}}{\mathlarger{‎‎\sum_{i=1}^{n}i}}}&=&{\frac{(j+1)!}{\frac{n(n+1)}{2}}} \\
{}&=&{\frac{2(n+1)!}{n(n+1)}} \\
{}&=&{\frac{(2)(n+1)(n) (n-1)!}{(n)(n+1)}} \\
{}&=&{2(n-1)!}
\end{eqnarray*}

\begin{eqnarray*}
{\frac{\mathlarger{\prod_{j=1}^{n}j}}{\mathlarger{‎‎\prod_{i=p+1}^{n-1}i}\cdot \mathlarger{‎‎\prod_{k=1}^{p}k} }}&=&{    \frac{n!}{? \cdot k!}                                       } \\
{}&=&{}
\end{eqnarray*}

\end{document}

• A full MWE would sure help! – John Kormylo Sep 24 '14 at 1:39
• @JohnKormylo What is a MWE? – Billy Rubina Sep 24 '14 at 2:25
• Minimum working example. That way I don't have to guess what packages and parameters to use. – John Kormylo Sep 24 '14 at 2:34
• @JohnKormylo This is the entire code. – Billy Rubina Sep 24 '14 at 2:58

In case you are interested in how to use the solution from Inserting a line to separate the text and the margin note, you simply need to include the appropriate code in your document, and use \marginpar:

## Notes:

• You should avoid using eqnarray as per: eqnarray vs align
• I changed the code to use align and to get the proper math spacing you should use &= and not &=&.
• You should not have blank lines between display math environments. Otherwise you end up with excessive white space.
• I'd recommend you put the code between the %% ------------------ in an external file so you don't need to look at it

## Code:

\documentclass[twoside]{article}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{marginnote}
\usepackage[top=1.5cm, bottom=1.5cm, outer=5cm, inner=2cm, heightrounded, marginparwidth=6.5cm, marginparsep=-2cm]{geometry}

\usepackage{etoolbox}
\usepackage{xcolor}
%% ------------------
%% Following from https://tex.stackexchange.com/questions/89322/inserting-a-line-to-separate-the-text-and-the-margin-note
% patching the OR of LaTeX:
\makeatletter
{\box \@marbox}%
{\hbox{%
\ifmpar@rule@rside
\hskip-\mparrulefactor\marginparsep\mparrule
\hskip\mparrulefactor\marginparsep
\fi
\box \@marbox
\ifmpar@rule@lside
\hskip\mparrulefactor\marginparsep\mparrule
\fi}%
\global\mpar@rule@lsidefalse
\global\mpar@rule@rsidefalse
}%
{\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

{\global\setbox\@marbox\box\@currbox}%
{\global\setbox\@marbox\box\@currbox
\global\mpar@rule@lsidetrue
\else
\global\mpar@rule@rsidetrue
}%
{\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}

\newif\ifmpar@rule@lside
\newif\ifmpar@rule@rside
\makeatother

% \mparrule generates the \vrule but should use no space horizontally
% using color is just for fun ...
\newcommand\mparrule{\textcolor{blue}{\hskip-.2pt\vrule\hskip-.2pt}}

% placement factor: .5 places the rule midway in the space made available
% by \marginparsep
\newcommand\mparrulefactor{.5}
\normalmarginpar
%% ------------------

\begin{document}
Here is an equation:
\marginpar{\begin{align*}
{n!}&={(n)(n-1)!} \\
{(n+1)!}&={(n+1)(n) (n-1)!}
\end{align*}%
}%
\begin{align*}
{\frac{\mathlarger{\prod_{j=0}^{n}(j+1)}}{\mathlarger{‎‎\sum_{i=1}^{n}i}}}&={\frac{(j+1)!}{\frac{n(n+1)}{2}}} \\
{}&={\frac{2(n+1)!}{n(n+1)}} \\
{}&={\frac{(2)(n+1)(n) (n-1)!}{(n)(n+1)}} \\
{}&={2(n-1)!}
\end{align*}
an another one:
\begin{align*}
{\frac{\mathlarger{\prod_{j=1}^{n}j}}{\mathlarger{‎‎\prod_{i=p+1}^{n-1}i}\cdot \mathlarger{‎‎\prod_{k=1}^{p}k} }}&={    \frac{n!}{? \cdot k!}                                       } \\
{}&={}
\end{align*}
\end{document}


The height of a \parbox[c] is the distance from the top to the center, so while it may look like the line is twice as big as it should be, it isn't.

BTW, your margin note is way too wide, as demonstrated by the first \rule.

\documentclass{article}
\usepackage[right=2.5in]{geometry}
\usepackage{mathtools}
\usepackage{marginnote}

\newsavebox{\tempbox}
\newlength{\tempheight}

\begin{document}

\marginnote{\rule{\marginparwidth}{1pt}}

\savebox{\tempbox}{\parbox{\marginparwidth}{% compute height of note
\begin{eqnarray*}
{n!}&=&{(n)(n-1)!} \\
{(n+1)!}&=&{(n+1)(n) (n-1)!}
\end{eqnarray*}
}}%
\settoheight{\tempheight}{\usebox{\tempbox}}%
\marginnote{\hspace{-2pt}\rule[-\tempheight]{.5pt}{2\tempheight}\hspace{1.5pt}% draw line
\usebox{\tempbox}}[2.6cm]

\end{document}


If you want to put a line on every page, try this.

\documentclass{article}
\usepackage[right=6cm]{geometry}
\usepackage{everypage}

\setlength{\marginparwidth}{5cm}