5

I can insert JPEG figures in publications, but when it comes the time to include PDF figures (I prefer them for graphics because of its vectorial nature) I cannot scale them properly.

I am using width=0.5\textwidth because I have two-column text format, but I guess there should be a more elegant method to adjust.

I also don't find any help for \includegraphics inside figure environment commands, like

\begin{figure}[h]
\includegraphics{image.pdf}
\end{figure}

Any link or help on this topic would be nice.

Martin Scharrer
  • 262,582
Jav_Rock
  • 323

1 Answers1

9

Use either \linewidth or \columnwidth. You can also use \centering before the \includegraphics if the image size is smaller than \linewidth.

enter image description here

\documentclass[twocolumn,a6paper]{article}

\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}
\section{Higgs Boson}
\lipsum[1]
\begin{figure}
\includegraphics[width=\columnwidth]{example-image-a}
\caption{Image A}
\label{fig:imagea}
\end{figure}

\lipsum[1-2]
\begin{figure}
\includegraphics[width=\linewidth]{example-image-b}
\caption{Image B}
\label{fig:imageb}
\end{figure}

\lipsum[3-5]
\end{document}

Edit 3

We usually ignore the file extension for the sake of simplicity (we can change compiler easily later).

If you use pdflatex then the compiler will search for JPG, PNG, or PDF. If you use latex then the compiler will search for EPS. For xelatex, it will search for JPG, PNG, PDF, and EPS.

  • Perfect answer. Thanks. Is there a good tutorial or doc webpage where I can dig on this topic? I am writing paper and I want to manage graphics without losing much time. – Jav_Rock Jul 13 '12 at 18:56
  • 2
    @Jav_Rock: I think the theory above is sufficient unless you need more fancy image layout. – kiss my armpit Jul 13 '12 at 19:11
  • @Jav_Rock I like the inclusion of graphics in latex guide at ctan http://mirror.ctan.org/info/epslatex/english/epslatex.pdf Its the best and crisp on graphics magic – texenthusiast Oct 24 '12 at 22:23