3

Here is the problem, you can see the figure is too close to the text, And it is even affecting the text.

enter image description here

the code I use is

\documentclass[ reprint,amsmath,amssymb,aps]{revtex4-1}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{epstopdf}

\begin{document}
some text

\begin{figure}[htbp]
\includegraphics[width=\columnwidth]{FIG_3}
\end{figure}

some text
\end{document}

What is odd enough is that when I insert the same code between other paragraphs of my paper, the problem is not showing any more.

after add \fbox{} to show the bounding box as follows

enter image description here


Edited

Here is the problematic tex file that I share on google drive problematic tex file


here is the example show that two same figure code but different position have different space to the text.

enter image description here

user15964
  • 865
  • 4
    That shouldn't happen, which means that there is a problem in some code you haven't shown us. – David Carlisle Jan 16 '14 at 12:21
  • 2
    Bad bounding box for figure? – jonalv Jan 16 '14 at 12:31
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Martin Schröder Jan 16 '14 at 12:34
  • @MartinSchröder Thank you for the welcome, I elaborated my question. – user15964 Jan 16 '14 at 12:55
  • @jonalv well, I tried many eps figure (even borrowed from other people) inserted in that place, all oddly failed. – user15964 Jan 16 '14 at 12:57
  • 1
    @user15964: Please add an \fbox{} around your \includegraphics. This will show the bounding box TeX sees. And please make your code a minimal working example (MWE). And a suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder Jan 16 '14 at 12:58
  • @MartinSchröder I add the \fbox{} – user15964 Jan 16 '14 at 13:21
  • @MartinSchröder I share a problematic tex, see my edited question or here https://drive.google.com/file/d/0By4WA9GK6t9DQkRtWDRmN1BINUk/edit?usp=sharing – user15964 Jan 18 '14 at 12:42

1 Answers1

2

See How to change the spacing between figures/tables and text?

An exaggerated example to play:

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{lipsum}

% for figure A between text
\setlength{\intextsep}{5em plus 1em minus .1em} 

% for the figure B on top (or bottom)
\setlength{\textfloatsep}{10em plus 5em minus .1em} % for figure B

\begin{document}
\lipsum[1]

\begin{figure}[h]
\includegraphics[width=\linewidth]{example-image-a}
\end{figure}
\lipsum[2]

\begin{figure}[t]
\includegraphics[width=\linewidth]{example-image-b}
\end{figure}

\lipsum[3-6]

\end{document}

Edit: the edited question now show a MWE with the problem in the revtex4-1 class. For some reason I obtained some wrongs compilations using this MWE but I cannot explain why. This code work fine:

\documentclass[reprint,amsmath,amssymb,aps]{revtex4-1}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{epstopdf}
\usepackage{lipsum}

\setlength{\intextsep}{2cm} 
\setlength{\textfloatsep}{2cm} 

\begin{document}

\lipsum[2]

\begin{figure}[h]
\includegraphics[width=\columnwidth]{example-image-a}
\end{figure}

\lipsum[2]

\begin{figure}[t]
\includegraphics[width=\columnwidth]{example-image-b}
\end{figure}

\lipsum[2]

\begin{figure}[b]
\includegraphics[width=\columnwidth]{example-image-c}
\end{figure}

\lipsum[3-6]

\end{document}

MWE

Fran
  • 80,769
  • Thank you for your answer, Fran! what does MWE mean? – user15964 Jan 17 '14 at 00:52
  • I tried your method, it didn't work for that particular position. I really don't understand what kind of bug it is! I tried to progressively add text before this figure code, and only if I add enough text will the space become normal. Quite odd! – user15964 Jan 17 '14 at 01:07
  • I look through a latex document, and that document said if I use [h], then the \intextsep is 12pt plus 2pt minus 2pt by default. So I think your method maybe not working for my problem. – user15964 Jan 17 '14 at 01:25
  • @user15964 A MWE is a minimal working example that illustrates exactly your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Fran Jan 17 '14 at 09:04
  • @user15964 Add to your question a MWE with example figures of the mwe package (so we can also compile the MWE without problem) and the enough dummy text to reproduce where \intextsep or another length is ignored. – Fran Jan 17 '14 at 09:14
  • see the problematic tex file https://drive.google.com/file/d/0By4WA9GK6t9DQkRtWDRmN1BINUk/edit?usp=sharing – user15964 Jan 18 '14 at 12:45
  • @user1596 It seems a bug of revtex4-1. For some reason, \intextsep is ignored just in this circumstances, but usually it is recognized, so ... – Fran Jan 19 '14 at 03:14