The Tufte classes provide the @tufte@margin@float environment which is used for tables and figures, but its result it's not automatically aligned with the text. The \marginnote command provide a margin note that it's aligned with the text on wich you put your note on, but however, it does not take a marginfigure environment as input for example. So how can I modify this environment in order to have a figure that's automatically aligned with the text?



            This is a margin figure.



  • 1
    Which should be aligned with the text: the caption, the top of the figure, the bottom of the figure? – godbyk Jul 25 '14 at 1:19
  • @godbyk you are right, I'm sorry, the top of the figure! As a the top of a margin note is aligned! – Aurelius Jul 25 '14 at 23:47

Try adding the following code to your preamble:


\catcode`\V=14 % `V' is a comment character unless [verbose]

\def\FloatBarrier{\begingroup \let\@elt\relax
    V\edef\@tempa{\write\m@ne{Package placeins Info: Float barrier, from
            V  input line \the\inputlineno, processed on page \thepage, lands on
            V  page \noexpand\thepage. }}\@tempa
    \ifx\@tempa\@empty V\PackageInfo{placeins}{No floats held,}%
    \ifx\@fltovf\relax % my indicator of recursion
    \if@firstcolumn V\PackageWarning{placeins}{Some floats are stuck,}%
    \else V\PackageInfo{placeins}{Eject a column and check again:}%
    \else V\PackageInfo{placeins}{Must dump some floats}%
    \newpage \let\@fltovf\relax V\PackageInfo{placeins}{Check again:}%
    \FloatBarrier % recurse once only
    \fi\fi \endgroup
    \@fb@topbarrier }


    \FloatBarrier% process all floats before this point so the figure/table numbers stay in order.
        \begin{minipage}[t]{\marginparwidth}% top-aligned minipage

% Margin figure environment



The only difference between this code and the code from the Tufte-LaTeX document classes is that the minipage environment in the new code is top-aligned as opposed to center-aligned and the default offset was changed from -1.2ex to 0pt.

  • it works but it breaks the line of type on which I put the command! I think because of this \FloatBarrier – Aurelius Jul 27 '14 at 22:21
  • @FormlessCloud: Yes, the \FloatBarrier macro will cause a line break. You can remove that from the definition and things will be okay. The \FloatBarrier macro flushes any pending floats before it typesets the marginfigure so that the figure numbers are kept in the proper order. You could write \FloatBarrier at the start of the paragraph containing your marginfigure if the float numbers are getting out of order. – godbyk Jul 28 '14 at 2:18
  • I've updated your answer with a code that fix every problem. take a look at it end if you think it's a good idea accept my correction. I've just removed \par from \FloatBarrier and changed to -7pt the offset of the marginfigure environment... – Aurelius Jul 29 '14 at 0:15
  • @FormlessCloud: I'm not familiar enough with the inner mechanisms of \FloatBarrier to know if the \par is required or not. – godbyk Jul 29 '14 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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