0

How do I increase the spacing between the top page margin and a figure? Currently, I have figures with some text and the text is not aligned properly (see screenshot)Text_misalignment.

Here's an MWE:

\documentclass[twocolumn,draft]{article} % For reference, I'm actually using the ieee document class, but this also reproduces the problem.
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage[backend=biber]{biblatex}
\title{\LARGE \bf
LadiDadi}


% \author{Steve Heim}
\begin{document}


\emph{Curabitur pulvinar, ex vitae congue pharetra, nibh turpis lacinia tellus, ac viverra risus ligula et odio. Vivamus non velit ut est fringilla auctor nec nec nibh. Curabitur condimentum nulla vel dolor facilisis, ut condimentum justo lobortis. In molestie odio a ex vehicula bibendum. Vivamus at arcu massa. Curabitur tempor mollis euismod. Mauris in urna ornare, malesuada tortor quis, fermentum erat. Donec vitae pellentesque ante. Integer pulvinar massa sed neque fringilla aliquam. Donec auctor, dui et vestibulum egestas, ligula ex semper augue, a vulputate mauris quam in sapien. Vivamus interdum massa non placerat varius. Proin nec turpis vel neque imperdiet porttitor id eget nunc.} \newpage

\begin{figure}[!t]
    \centering
    \text{ \medskip This Title is done in Latex}\par\medskip
    \includegraphics[width=0.95\columnwidth]{graphics/policiyGauss.pdf}
    \caption{The title is not part of the image, and is not aligned properly. Instead it sticks out a little higher (compare with text in other column) }
    \label{fig:controllers}
\end{figure}
\emph{Proin in purus libero. Aenean tempus enim at quam sagittis efficitur.
Curabitur pulvinar, ex vitae congue pharetra, nibh turpis lacinia tellus, ac viverra risus ligula et odio. Vivamus non velit ut est fringilla auctor nec nec nibh. Curabitur condimentum nulla vel dolor facilisis, ut condimentum justo lobortis. In molestie odio a ex vehicula bibendum. Vivamus at arcu massa. Curabitur tempor mollis euismod. Mauris in urna ornare, malesuada tortor quis, fermentum erat. Donec vitae pellentesque ante. Integer pulvinar massa sed neque fringilla aliquam. Donec auctor, dui et vestibulum egestas, ligula ex semper augue, a vulputate mauris quam in sapien. Vivamus interdum massa non placerat varius. Proin nec turpis vel neque imperdiet porttitor id eget nunc.}
\end{document}

enter image description here

  • This depends on the document class, \caption etc. settings -- we don't see any line of your code. – user31729 Jan 28 '18 at 11:19
  • @ChristianHupfer I know, I was still working on the MWE (and added a comment "MWE coming") ^_~. Here it is. – Steve Heim Jan 28 '18 at 11:42
  • 2
    epsfig has been obsolete for at least two decades. Use just graphicx. – egreg Jan 28 '18 at 11:53
  • Thanks, done. Doesn't solve the spacing issue though. – Steve Heim Jan 28 '18 at 12:47
3

The internal structure of the float box is not known at the point the box is added to the page, and at the point the float is typeset it is not known that it will appear at the top of the page.

It is set within the page boundaries but the baseline of the first line of text is, in this case higher than the baseline of the body text. I would simply do some thing like

\begin{figure}[tp]
    \centering

\smallskip

    This Title is done in Latex

Note that the \text in your example is essentially \mbox so had the effect of stopping the \medskip add any space.

I changed [!t] to [tp] as you shouldn't routinely use ! (it is for over-riding the defaults on special occasions) and not having p greatly increases the chances of the float going to the end of the document) But this change doesn't affect the vertical spacing here.

enter image description here

|improve this answer|||||

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.