2

I used this kind of code to put several Figures in a Latex document

\documentclass[preprint]{revtex4-1}
\usepackage{graphicx}

\begin{document}
\begin{figure}[!h]
  \begin{center}
    \begin{tabular}{c}
      \resizebox{0.5\linewidth}{!}{\includegraphics{image1}}
      \resizebox{0.5\linewidth}{!}{\includegraphics{image2}}\\
      \resizebox{0.5\linewidth}{!}{ \includegraphics{image3}}
      \resizebox{0.5\linewidth}{!}{ \includegraphics{image4}}\\
   \end{tabular}
   \caption{Here is the caption of my figure.}
   \label{fig:figure1}
  \end{center}
\end{figure}
\end{document}

and I compile with latex and dvipdfmx.

My images are the following http://heberg-fichiers.informatique13.com/uploads/c21bea2965.eps, http://heberg-fichiers.informatique13.com/uploads/3241c8d389.eps, http://heberg-fichiers.informatique13.com/uploads/e30b2e3f5e.eps, http://heberg-fichiers.informatique13.com/uploads/6700fd0f83.eps,

It was working perfectly until I update from Tex Live 2009 to TeX Live 2014. Now some parts of the caption are on top of the Figure.

  • Please help us to help you and add a minimal working example (MWE) that illustrates 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}. – user31729 Jul 10 '14 at 15:53
  • It is hard to believe, that the behaviour of \caption command should change completely from 2009 to 2014. Are you using \caption package? Is there some \captionsetup command? – user31729 Jul 10 '14 at 15:54
  • Thanks for the remark. It is in fact due to the class \documentclass[preprint]{revtex4-1}, but again it was not behaving like this in the previous version of Tex. I edit my question – lambertmular Jul 10 '14 at 16:03
  • How do you compile? – Ulrike Fischer Jul 10 '14 at 16:56
  • Why don't you use pdflatex? It will automatically convert the EPS files to PDF. I've seen other problems of dvipdfmx with some EPS files. – egreg Jul 10 '14 at 17:21
2

I don't see any problem with this code if I do either of the following: (1) run latex and then dvips and then ps2pdf; or (2) convert the eps figures to pdf (with epstopdf) and then run pdflatex.

I do see the problem described when running first latex and then dvipdfm, but that is a rather unnatural way to process a file with a lot of eps figures.

  • Thank you, I do not remember why I was using the dvipdfmx (more or less 5 years I have been using it) but it is alright with latex and then dvips and then ps2pdf. – lambertmular Jul 11 '14 at 9:49
2

If you want to compile with dvipdfmx, then you should explicitly pass the option to graphicx; without it, the behavior is indeed like you describe, and it is caused by graphicx believing that the dvips driver is desired.

\documentclass[preprint]{revtex4-1}
\usepackage[dvipdfmx]{graphicx}

\begin{document}
\begin{figure}[htp]
\centering
\includegraphics[width=.45\linewidth]{image1}\hfil
\includegraphics[width=.45\linewidth]{image2}\\
\includegraphics[width=.45\linewidth]{image3}\hfil
\includegraphics[width=.45\linewidth]{image4}

\caption{Here is the caption of my figure.}
\label{fig:figure1}
\end{figure}
\end{document}

I have also simplified the input: the tabular is not necessary and also \resizebox.

enter image description here

However, if you don't need dvipdfmx for other reasons, you can simply remove the dvipdfmx option and process the file with pdflatex, that will automatically convert the EPS files to PDF.

  • It is working, but since I have a lot of this kind of Figure and I need to change the code, I prefer the second option. Thank you – lambertmular Jul 11 '14 at 9:50
  • @lambertmular You don't need to change the code. The only required action is using \usepackage[dvipdfmx]{graphicx} instead of \usepackage{graphicx}. The code you use for placing the images is not the best, though. – egreg Jul 11 '14 at 9:55

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.