Next: Avoiding extras space after
Up: Creating various file formats
Previous: Creating various file formats
Creating good PDF files from Latex
Creating a pdf file from Latex source can be trickier than it ought
to be. (Note that this writeup is somewhat old, so while I think much
of the guidance here is reasonable, some of it may be out of date
- CP - 4/2/06) You have to make certain that both the text and the
mathematical symbols show up clearly on screen and that they work
on Windows machines and print out from Windows machines. If you're
converting from ps to pdf the key issue is getting the fonts right.
Here are some options for going from Latex to pdf:
- For slides and presentations, recently I've been using LYX with
the foils package and compiling using pdflatex and have found that
the slides come out nicely. Here's an example Lyx file
for doing this.
- Convert directly from Latex to pdf using pdflatex. For presentations,
pdflatex does a better job with the thickness of the mathematical
symbols than the route below in going through the dvi and ps file
to get to pdf.
- The main issue is in incorporating figures. pdflatex can't incorporate
ps files or use pstricks. Instead, if your figures are from R, create
the pdf files directly in Ror convert your figures:
convert any ps figures to pdf or jpg; to
get the figure size right, you may need to crop the figure:
- for a jpg figure you can do this with xv
- for a pdf figure, convert the ps file to eps >ps2epsi file.ps,
so that it has a bounding box and then do >epstopdf file.epsi
- include \usepackage[pdftex]{graphics}
in the Latex preamble
also, I think that also using \usepackage{times}
gives more clear text for presentations because it seems to be bolder
than is otherwise the case
- include the figure using \includegraphics{file.pdf}
or \includegraphics{file.jpg}
- compile the Latex directly into pdf without sojourning in dvi- or
ps-land: >pdflatex file.tex
- For papers, the following should deal with the text and font issues,
and seems to give good representation of the mathematical fonts. However,
for presentations, I have found that creating
a pdf file in this way may not give mathematical symbols that project
well because the lines in the letters are far too thin. In the past,
I have solved this to some extent by making all the mathematical symbols
bold.
- in the Latex preamble, include the line \usepackage{times}
(I'm not completely sure this is necessary.)
- >latex file.tex
- >dvips -Ppdf -G0 file.dvi
- Either
- >ps2pdf file.ps file.pdf
- >convert file.ps file.pdf (you might try convert
-enhance)
- Now check that only Type-1 fonts are included in the pdf file. To
do this open the pdf file using Acrobat (this may only work on Windows).
Click on "file" -> "Document Properties"
-> "Fonts" and make sure there are only Type-1 fonts.
If there are other fonts (like Type-3), they might come from graphics
files imported into the document. I don't understand the technicalities,
but pdf files with only Type-1 fonts seem to display on-screen and
print much better.
- A colleague of mine suggests the following recipe, but I've found
that the pslatex package seems to cause the greek letters in the output
to stand out in a funny way.
- include \usepackage{pslatex} in the preamble
of the document
- compile your Latex file as usual, latex file.tex
- dvips -Ppdf -G0 -o file.ps file.dvi
- ps2pdf -dCompatabilityLevel=1.3 file.ps
- If you're not satisfied with either solution above, you can delve more deeply in the gory details of the fonts.
On the CMU stat system (and presumably others), this issue with the
fonts seems to be largely solved using approach #1 above.
Next: Avoiding extras space after
Up: Creating various file formats
Previous: Creating various file formats
Chris Paciorek
2006-04-02