TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use marginfigure, but it is inserting space inline. Check out my minimal example:


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


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
up vote 6 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:


% Remove \FloatBarrier from marginfigure definition
% to prevent unwanted spaces.
\makeatletter% so we can use @ commands
  %\FloatBarrier% removed because it adds unwanted white space
\makeatother% restore meaning of @


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

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


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.