Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've recently started using tufte-book for typesetting solutions to math problems. I like it very much that you're encouraged to use the margin, which is very nice for giving hints, pointers and references concerning the steps of finding a solution.

Unfortunately, the sidenote and marginnote commands don't work in math environments (not in outer par mode). Most of the time, I'm able to work around it by putting the commands after the environment, using the optional offset with a decimal value via \marginnote[-length]{content}. But this breaks when a math environment is pushed to the end of a page: the notes are then pushed to the next page, no longer appearing on the same page. This also happens if you first put the commands and then the environment.

So, is there any way to enable sidenote and marginnote in math environments? (I thought of using the samepage environment, but this adds a lot of ugly whitespace, as the whole math environment is pushed to the next page without necessity)

\documentclass{tufte-book}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{tikz}

\newcommand{\filler}[1][10]%
{   \foreach \x in {1,...,#1}
    {   test 
    }
}

\begin{document}

\lipsum[1]

\begin{align*}
    &\int\int\int t\ dt^3\\
    =&\int\int \frac{t^2}{2}\ dt^2\\
    =&\int  \frac{t^3}{6}\ dt\\
    =&\frac{t^4}{24}
\end{align*}\marginnote[-3.7cm]{first note}\marginnote[-1.7cm]{second note}

\lipsum[2]
\filler[50]

\begin{align*}
    &\int\int\int t\ dt^3\\
    =&\int\int \frac{t^2}{2}\ dt^2\\
    =&\int  \frac{t^3}{6}\ dt\\
    =&\frac{t^4}{24}
\end{align*}\marginnote[-3.7cm]{first note}\marginnote[-1.7cm]{second note}

\end{document}

enter image description here

As you can see, the second align* is still on the first page, but the marginnotes are pushed to the second page.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The AMS environments conveniently give you a hook to place text at a known position relative to the margin so I'd do

\documentclass{tufte-book}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{tikz}

\newcommand{\filler}[1][10]%
{   \foreach \x in {1,...,#1}
    {   test 
    }
}

\def\mathnote#1{%
  \tag*{\rlap{\hspace\marginparsep\smash{\parbox[t]{\marginparwidth}{%
  \footnotesize#1}}}}
}

\begin{document}

\lipsum[1]

\begin{align*}
    &\int\int\int t\ dt^3\\
    =&\int\int \frac{t^2}{2}\ dt^2\\
    =&\int  \frac{t^3}{6}\ dt\\
    =&\frac{t^4}{24}
\end{align*}\marginnote[-3.7cm]{first note}\marginnote[-1.7cm]{second note}

\lipsum[2]
\filler[50]

\begin{align*}
    &\int\int\int t\ dt^3\mathnote{first note}\\
    =&\int\int \frac{t^2}{2}\ dt^2\\
    =&\int  \frac{t^3}{6}\ dt\\
    =&\frac{t^4}{24}\mathnote{second note}
\end{align*}

\end{document}
share|improve this answer
    
Thank you, that's what I was looking for. Your code was missing a closing } in the mathnote definition, so I took the liberty to add it. –  Tom Bombadil Jul 12 '12 at 14:26
    
After reading Aleander Perlis' A complement to \smash, \llap, and \rlap, I not only use your solution, but finally do understand it. Thanks again. –  Tom Bombadil Sep 28 '12 at 16:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.