6

It's my problem, I am not writing margin note in \equation and \align. It's an error. But it's working in text. My aim, margin note with equation must be aligned.

\definecolor{background}{RGB}{255,255,170}

\begin{equation}% \begin{align}
\colorbox{background}{$\displaystyle{} R_A+R_B=\frac{R_3(R_1+R_2)}{R_1+R_2+R_3}$}
\end{equation}% \end{align}

odd page

enter image description here

even page

enter image description here

I'm sure this is a duplicate of another question that I just can't find. So, does anyone know how to fix it.

3
  • Please complete your code snippet to a minimal working example (MWE) so we know which class your are using. Sep 1, 2014 at 6:49
  • Indeed, I am so sorry. Whereupon, I will observe. Thanks for your attention.
    – Özgür
    Sep 2, 2014 at 0:56
  • No problem, it is just a suggestion of how to improve your question so that you get a relevant answer (which now seems to be the case) and so it will be most helpful to others visiting the site in future. Sep 2, 2014 at 11:45

1 Answer 1

6

You have better ways of colouring an equation. See for example: this question and its answers. I have used empheq in my example. With tcolorbox, you can be more fancier.

Now the real problem. The following code works with the help of marginnote package.

\documentclass{book}
\usepackage{mathtools}
\usepackage{xcolor}
\definecolor{background}{RGB}{255,255,170}
\usepackage{empheq}
\newcommand*\mybox[1]{%
\colorbox{background}{\hspace{1em}#1\hspace{1em}}}
\usepackage{kantlipsum}
\usepackage[fulladjust]{marginnote}
\setlength{\marginparsep}{5mm}
\setlength{\marginparwidth}{1in}
\reversemarginpar
\begin{document}
  \kant[1]
  \begin{empheq}[box=\mybox]{align}
     R_A+R_B &=\frac{R_3(R_1+R_2)}{R_1+R_2+R_3}\marginnote{Some margin note here}
  \end{empheq}
  \kant[2]
  \clearpage
  \kant[1]
  \begin{empheq}[box=\mybox]{align}
     R_A+R_B &=\frac{R_3(R_1+R_2)}{R_1+R_2+R_3}\marginnote{Some margin note here}
  \end{empheq}
  \kant[2]

\end{document}

enter image description here

As you didn't reveal the document class you are using, I have used book class. If you are using memoir, you may better use the native \marginpar command.

2
  • "+1" Thanks for your answer. I worked very well.I don't this package. How [closed] this question?
    – Özgür
    Sep 2, 2014 at 1:45
  • @Özgür Glad it was helpful. Do you mean how to close this question? If so, You have already accepted the answer, hence the question is concluded. :-)
    – user11232
    Sep 2, 2014 at 1:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .