1

In my latex document no matter how much I change the width the images are not getting displayed at the center. Below is the output that I am getting using the following command. Most of my figures are either getting pushed towards the left end margin, or coming outside the 2 column like Fig5 or getting shrinked like Fig4. What should I do so that the image gets displayed in the center and is not shifted here and there.

Preamble

\RequirePackage{fix-cm}

\documentclass[twocolumn]{svjour3}          % twocolumn
%
\smartqed  % flush right qed marks, e.g. at end of proof
%
\usepackage{graphicx}
\usepackage{epstopdf}
 \usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{hhline}
\usepackage{amssymb}

\begin{figure}
\centering
 \begin{adjustbox}{center}
\includegraphics[height=55mm,width=\columnwidth]{Fig5.eps}
 \end{adjustbox}
 \caption{test}
\end{figure}

Updated Images img

6
  • 1
    Why are you encasing the \includegraphics instruction in an adjustbox environment?
    – Mico
    Jun 11 '20 at 4:49
  • 1
    Off-topic: Nowadays, the graphicx package loads the epstopdf package automatically. The only conceivable reason for having an explicit \usepackage{epstopdf} statement in the preamble is that your TeX distribution is at least eight years old and hasn't ever seen an update -- in which case you really ought to be thinking actively about updating your TeX distribution.
    – Mico
    Jun 11 '20 at 4:55
  • I have been using this before as it worked for many documents.
    – Sm1
    Jun 11 '20 at 4:56
  • I use Overleaf and these preamble since old age. I guess I need to delete few of them. Have been lazy.
    – Sm1
    Jun 11 '20 at 4:57
  • 1
    also do not use both height= and width= as that risks distorting the document, just use one or the other Jun 11 '20 at 7:32
1

Omitting the adjustbox wrappers should fix the issue you're experiencing.

If it doesn't, do check if the eps files' bounding boxes are set correctly, i.e., do check that there's no excess whitespace to the left and/or right of some of the graphs contained in the eps files.

enter image description here

\documentclass[twocolumn,demo]{svjour3} % omit 'demo' option in real doc.
\usepackage{graphicx} % for '\includegraphics' macro
%\usepackage{amsmath,amssymb,bm,hhline} % not needed for this example
\usepackage{lipsum} % filler text
\usepackage{microtype} % optional

\begin{document}
\addtocounter{figure}{3} % just for this example
\lipsum[2] % filler text
\begin{figure}[h]
   \includegraphics[height=65mm,width=\columnwidth]{Fig4.eps}
   \caption{A Test}
\end{figure}

\lipsum[1-4] % more filler text
\begin{figure}[h]
   \includegraphics[height=45mm,width=\columnwidth]{Fig5.eps}
   \caption{Another Test}
\end{figure}

\lipsum[2] % still more filler text
\end{document}
2
  • Thank you for your answer. I applied the height only and removed adjust command. But there was no change. I was still getting lot of white space around fig4 and Fig5 was still shifted out of the column. However, when I converted the images to .png and edited it via paint the white spaces went away and the image is able to span the entire width of the column. I have doubled checked that none of my eps files have any white spaces around the margins. If I put the eps images inside *figure then these problems disappear.
    – Sm1
    Jun 11 '20 at 14:41
  • It is only when I insert them in 2 column, some of the eps files don't get displayed correctly.
    – Sm1
    Jun 11 '20 at 14:41
0

You are setting both height and width in includegraphics.

This causes the image aspect ratio to change.

Try setting either the height or the width, but not both. This worked for me (not having your source files I used one of mine)

\begin{figure}
\centering
\includegraphics[height=0.5\columnwidth]{test.png}
\includegraphics[width=\columnwidth]{test.png}
 \caption{test}
\end{figure}
2
  • Are you sure that the OP's issue is related to fixing both the height and width of the displayed graphic?
    – Mico
    Jun 11 '20 at 5:11
  • I couldn't get their MWE to work as is, so in mine, setting both height and width simultaneously caused similar symptoms to OP. Setting only one or the other fixed them in my MWE. In reworking the MWE I may have omitted or changed the case somewhat but am reasonably sure the aswer fixes at least a major subset of their issues. (if not, I'l gladly edit or delete my answer)
    – agryson
    Jun 11 '20 at 5:41

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.