I have created a diagram using word drawing, however, when I saved it as a pdf and exported it with LaTeX the figure seem to be the whole page and could not adjust it only the figure size. If anyone knows the solution, please help advice me. I tried to convert from pdf to esp file using Inkscape, but the figure was not clear although it looks fine as pdf.
Asked
Active
Viewed 303 times
2 Answers
6
If you save an image created in Word, using Save As PDF, it will save a one page document with the image. To turn this document into an image of the right size, you can use the pdfcrop program, which is part of TeX Live (and I assume MikTeX). From the commandline, navigate to your file's folder and then use:
pdfcrop <your-pdf-file.pdf>
This will create a file named <your-pdf-file-crop.pdf>
This file can then be inserted into your TeX document using \includegraphics.
Alan Munn
- 218,180
-
Or you can use the
trimoption of the\includegraphicscommand, which lets you crop the original pdf. – Aug 24 '15 at 15:40 -
1@MarcvanDongen The
pdfcropmethod is much simpler since you don't have to do any measuring of how much to trim.pdfcropcrops to the natural size of the content automatically. – Alan Munn Aug 24 '15 at 15:47 -
-
Thanks for your contribution Alan, but I did not really catch what you meant. Do you mean saving the file using different extension or just adding the code of pdfcrop instead of the one that I am using which is [\includegraphics {file.pdf} – sifo Aug 24 '15 at 15:52
-
@sifo No, you still use
\includegraphicsto insert your file, but you create a cropped version of the original file beforehand using thepdfcropprogram. You use that program from the command line. It's not part of your TeX document. What OS and TeX distribution are you using? – Alan Munn Aug 24 '15 at 15:54
1
I've done the following for including .pdf images in the past...
If I want to include an existing .pdf document:
\includepdf[offset=30mm -20mm,noautoscale,pages=1-2]{name_of_your.pdf}
If I want to include an image, like what you're doing:
\begin{figure}[htb]
\centering
\setlength\fboxrule{0.5pt}
\fbox{\includegraphics[scale=0.5]{name_of_your.pdf}}
\caption{lorem ipsum.}
\label{fig:name_of}
\end{figure}
gbby
- 26
-
3Welcome to the site! I don't think this answers the OPs question, I'm afraid. The problem is that when saving a PDF from Word, there is a lot of whitespace around the figure, and the OP wants to remove that whitespace. – Torbjørn T. Aug 24 '15 at 16:25
-
-
@sifo I thought that was your original question. The best way I know of is the one Alan mentioned in his answer. Another way is to use
trimandclipas seen in for example Crop an inserted image? – Torbjørn T. Aug 24 '15 at 20:36 -
1I think @gbby wrongly interpreted the question because the wording is ambiguous. "...the figure seem to be the whole page" could mean "the whole page of the LaTeX document," and that is how I interpreted it. I'm not a Word user, so I didn't know that "the PDF contains the whole page of the Word document" is what the OP meant. – alephzero Aug 24 '15 at 22:54