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 want to use marginfigure, but it is inserting space inline. Check out my minimal example:

documentclass{tufte-book}

\begin{document}
Hello\begin{marginfigure}$2+2=4$\end{marginfigure}I'm new here.

\end{document}

enter image description here

As you can see, the "Hello I'm new here" is two different lines--I want a single line. Of course, one "solution" is to simply move the marginfigure; however, this is not an option for me.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The culprit appears to be the \FloatBarrier command (provided by the placeins package). If we remove the \FloatBarrier command from the code that generates the marginfigure, then no space is inserted:

\documentclass{tufte-book}

% Remove \FloatBarrier from marginfigure definition
% to prevent unwanted spaces.
\makeatletter% so we can use @ commands
\renewenvironment{@tufte@margin@float}[2][-1.2ex]{%
  %\FloatBarrier% removed because it adds unwanted white space
  \begin{lrbox}{\@tufte@margin@floatbox}%
  \begin{minipage}{\marginparwidth}%
    \@tufte@caption@font
    \def\@captype{#2}%
    \hbox{}\vspace*{#1}%
    \@tufte@caption@justification
    \@tufte@margin@par
    \noindent
}{%
  \end{minipage}%
  \end{lrbox}%
  \marginpar{\usebox{\@tufte@margin@floatbox}}%
}
\makeatother% restore meaning of @


\begin{document}

Hello\begin{marginfigure}$2+2=4$\end{marginfigure}I'm new here.

\end{document}
share|improve this answer
    
Thanks! This helped a lot! –  Bart Snapp Jan 15 '13 at 20:18
    
To make this work in Lyx, simply remove \makeatletter% so we can use @ commands and \makeatother% restore meaning of @ from the code and use everything else in between inside Document>Settings>LaTeX Preamble for Lyx. –  Black Milk Oct 30 '13 at 0:13

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.