3

I am trying to import a graphic from Excel to LaTeX. The graph has been printed on a PDF but when trying to import it into LaTeX it doesn't scale.

Using the \fbox function shows a box where I would like the graph to be but the graph itself is over it, justified on the left and going out of the margin on the right.

The .pdf file has white space around it but the use of the trim argument doesn't change the output.

\begin{figure}[h]
\centering
\includegraphics[width=\textwidth,center]{domaine.pdf}
\caption{domaine}
\label{fig:domaine}
\end{figure}

Problem solved, output has to be to PDF directly.

12
  • 1
    Welcome to TeX.SX. Is there any whitespace around the graph in the PDF? Commented Feb 20, 2015 at 20:48
  • 2
    Use \fbox{\includegraphics[width=\textwidth,center]{domaine.pdf}} to see the real space used by the image.
    – Sigur
    Commented Feb 20, 2015 at 20:49
  • 1
    there is no center key to \includegraphics. You do not give many clues but I would guess that excel printed a full page image (even if it is white around the edge) scaling a full page image to the textwidth will not do much. You need to either crop the image first or use the clip or trim keys. As a debugging aid use \fbox{\includegraphics...} to see how big latex thinks the image is Commented Feb 20, 2015 at 20:50
  • The box is centered to text width but the graph itself is left justified and far out on the right. The pdf has indeed more white space around than the excel graph but it still doesn't scale at all. Commented Feb 20, 2015 at 20:51
  • 1
    @JPPiedboeuf Little hint, you can ping people about news using the @-sign in front of the name. But everytime, the changes will be seen by a very limited amount of people. You can edit the question and add more details. The Q will go back on top on the main site.
    – Johannes_B
    Commented Feb 20, 2015 at 21:32

2 Answers 2

1

Since the output format is DVI, it is very likely that the DVI viewer is not able to handle the scaling of PDF files. PDF as output format is a better choice here (e.g. via pdflatex).

The documentation for package graphicx also explains drivers, see Packages in the 'graphics' bundle.

0

this might get you started. I took a somewhat random pdf from here and downloaded p. 16. Looks like this

enter image description here

Then I ran the code below and got this.

dkld

\documentclass[a4paper,12pt]{article}

\usepackage{graphicx}
\usepackage{blindtext} 
\usepackage{hyperref}

\begin{document}

\blindtext
\begin{figure}[h]
\centering
\includegraphics[trim = 8mm 47mm 110mm 47mm, clip, width=10cm]{domaine.pdf}
\caption{domaine.pdf from p. 16 in \url{https://web.stanford.edu/group/scspi/slides/Inequality_SlideDeck.pdf}}
\label{fig:domaine}
\end{figure}
\blindtext


\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .