Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

FAQ /

PDF

Categories: PDF
<< | Page list | >>

§ How can I include PDF documents in my file?

Use the menu Insert->File->External Material and there the template pdfpages.
For more information about this, see LyX's Embedded Objects manual, section External Material.

If you get the error message "Set output to PDF. (use: \pdfoutput = 1)" when you generate a DVI file instead of a PDF file, you have to update your pdfpages package. With pdfpages version 0.4f, this problem is fixed.

§ How do I create clickable URLs/hyperlinks in a PDF file ?

Enable the hyperref support in the document settings under PDF Properties. Then all URLs within a LyX URL box will be created as clickable hyperlinks.

For more information about this, see LyX's User's Guide manual, section PDF Properties.

§ How do I generate bookmarks in a PDF file?

This is done in the document settings under PDF Properties
For more information about this, see LyX's User's Guide manual, section PDF Properties.

§ How can I create custom PDF bookmarks?

Enable the hyperref support in the document settings under PDF Properties.
Open in LyX a TeX code box by pressing C-L.
Now write: \pdfbookmark{Text of bookmark}{Name of anchor}

§ The fonts are bad in the exported PDF, what can I do?

The default LaTeX fonts (cm or ec) are bitmap fonts. Therefore they cannot be scaled to any size and in PDF they look pixeled.

To avoid these problem, use scalable fonts, like Type 1 (PostScript) or TT (True Type) Fonts. Modern LaTeX distributions ship a whole range of Type 1 fonts. Using True Type fonts is a bit trickier (but some LaTeX distributions like MiKTeX ease their use). Some bleeding edge distributions like XeTeX even provide support for OpenType fonts, which is the latest and greatest font format. However, running these distributions with LyX is still tricky (but might improve in the future).

If you want to keep the look of the default fonts, you have several possibilities.

  1. Choose the font AE (Almost European) in Document→Settings→Fonts
    Caveat: ae are virtual fonts, they 'steal' the T1 fonts from other packages. Therefore the characters do not match as good as the ones from a real font. Also, not all symbols are available with ae, e.g. the French 'guillemets'.
    For using the guillemets with ae, you have to install the package aeguill. It is loaded in the preamble with
    \usepackage[ec]{aeguill}
  2. A better solution is to use the Type 1 replacement for Computer Modern: Choose the font Latin Modern in Document→Settings→Fonts. If LaTeX claims that the font is not installed, install the font, reconfigure LyX (Tools→Reconfigure), and try again.

Alternatively, you can also try one of the other Type 1 fonts that ship with LaTeX; for instance Times or Palatino. Caveat: Times, as the name indicates, is designed for printing newspaper with small columns. Therefore the letters are smaller than in other fonts, what makes them improper for one-column documents.

To use Times select

  • Times as Roman font
  • Helvetica scaled to 90% or 92% (as you like)
  • Courier

To use Palatino select

  • Palatino as Roman font
  • Helvetica scaled to 90% or 92% (as you like)
  • Courier

See also section 3.7.2 "Document Font and Font size" in the LyX User's Guide or the FAQ for the TEX FAQ (keyword=fonts) [tex.ca.uk].

§ How can I edit/write the properties of a PDF file?

This is done in the document settings under PDF Properties
For more information about this, see LyX's User's Guide manual, section PDF Properties.

What you still can't do is encrypt your document. If you want to define what the reader is allowed to do with your document, you have to use Adobe Acrobat (open your PDF with Acrobat and set the properties).
Note, however, that quite a range of the properties (including encryption) can also be set with the free tool pdftk, which is available for several platforms (whereas Adobe Acrobat is not available for, say, UNIX).

§ I have included hyperref and LyX tells me of "undefined code sequence"s!

If you are using for example Algorithm floats you run into problems with LyX and hyperref. hyperref needs to be loaded before the algorithm package. Unfortunately LyX loads 'native' packages before the packages defined in Latex Preamble. A workaround is to _not_ use Algorithm floats (preventing LyX to load the package) and instead define your float in ERT. See http://www.mail-archive.com/lyx-users@lists.lyx.org/msg51007.html for details. An advantage of this method is that you can define your own caption names e.g. 'Listing'

§ Can I add annotations to the PDF?

Yes. Use the LaTeX package pdfcomment. Here is a module that adds some native LyX-support for that package.

§ Can I permit others to insert annotations to the PDF?

As of Adobe Acrobat 7 (pro) you can set the permissions of a PDF so that other users can insert annotations with the free Adobe Reader >= 7.0. By default, this is not allowed. Unfortunately, there is no way yet to change this special permission outside of Acrobat. Due to a very rigid licensing policy (of Adobe) it is unlikely that this will change in the future.

§ Can I generate a PDF file containing a subset of the pages in my document?

There are several methods:

  • Put the text you do not want to export in comments or notes. (Warning: This will change pagination and may cause problems with cross-references.)
  • Make a PDF of the entire document, then use Ghostscript to produce a PDF of selected pages, as in the following (which extracts pages 3 through 5 inclusive from sourcefile.pdf):
      gsc -dFirstPage=3 -dLastPage=5 -sDEVICE=pdfwrite -sOutputFile=test.pdf 
      -dBATCH -dNOPAUSE sourcefile.pdf
  • Use a PDF printer driver (such as PDFCreator for the Windows platform or cups-pdf on Linux) that can output selected pages. Generate the entire document in PDF from LyX, load it into your favorite PDF viewer, print it to the PDF driver and extract just the pages you want.
  • Install the pdftk tool kit and run something like
      pdftk sourcefile.pdf cat 130-140 output test.pdf 
  • Look at the \includeonly command (but note that it does not work in recent releases, due to the handling of temp files).

§ pdfTeX warning stops generating PDF (destination with the same identifier):

You are using package "hyperref" and you have at least two pages "1". ==> recommended hyperref options: plainpages=false,pdfpagelabels

If the pages were labled differently (for example: documentclass book with \frontmatter and \mainmatter the pages are labeled "i" and "1"), then the problem is solved.

If there is a title page without a printed page number, you can set the page counter to zero, for example. Or \thepage can be redefined, eg:

 \begingroup
  \renewcommand{\thepage}{title}
  % commands that generates the title page
  \newpage
 \endgroup

Other options:

  • If there are no references and such stuff on the pages "1", you can ignore the warning.
  • Option "hypertexnames=false" solves the warning, but then index links, \autoref will not work correctly.

§ My eps figures are rotated in the pdf output. What can I do ?

The following is a short digest of this thread.

The Orientation comment is allowed in eps files. Unfortunately it is interpreted differently by different programs Some programs interpret "Orientation Landscape" as "this file is already in landscape orientation", while others interpret it as "this file should be in landscape orientation, therefore it should be rotated by 90 degrees."

This makes it difficult to implement a unique solution to eps file conversion in LyX, and to get the same output in dvi, ps, and pdf.

Ghostcript has a -dAutoRotatePages= switch, which is activated by default in ps2pdf and de-activated by default in recent versions of epstopdf.

  • if the rotation comes after DVI->PS->PDF, export to PS and try
              ps2pdf -dAutoRotatePages=/None foo.ps
  • if the rotation comes after pdflatex, each figure should be separately converted using epstopdf (check with
              lyx -dbg files -e pdf foo.lyx
supposing pdf is the format associated to pdflatex):
  • if epstopdf is used, you may upgrade, or add the switch manually.
  • if ps2pdf is used, the file is recognised as PS instead of EPS, you may normalize it.

Difference of ps2pdf, dvipdfm(x) and pdflatex

LyX supports three different ways of producing PDF files. This is because all of them have their specific pros and cons.

Also see http://mintaka.sdsu.edu/GF/bibliog/latex/LaTeXtoPDF.html

§ ps2pdf method

Traditionally, you converted your LaTeX source file to a DVI file, which could then be converted to PostScript with dvips. This, in turn, can be converted to a PDF file by ps2pdf (LyX does all those steps automatically for you if you select PDF (which is in fact ps2pdf) as output format:

                  latex             dvips            ps2pdf
        text.tex -------> text.dvi -------> text.ps --------> text.pdf

This basically requires all the graphics to be EPS files. But that's not a major problem, as LyX converts all files to the appropriate format if needed (however, if you have the choice, using EPS as native format is recommended). The main advantage of this method (especially compared with PDFLaTeX) is that the resulting PDF file is almost always much smaller. Also, dvi and postscript specials are supported (the former is also true for dvipfdm(x)). For instance, LyX's change tracking feature uses dvi specials to mark the changes in the output. Hence, the change tracking marks are not visible in a PDF produced with PDFLaTeX.

§ Dvipdfm method

If you don't need PostScript output, you can save a step by going directly from DVI to PDF format by using dvipdfm or the newer dvipdfmx, which is intended to supersede the former:

                 latex           dvipdfm(x)
       text.tex -------> text.dvi -------> text.pdf

Once again, the figures must be Encapsulated PS. So you have compact, scalable graphics – with one less step.

§ Pdflatex method

The pdflatex program produces a PDF file directly from the LaTeX source:

              pdflatex
     text.tex --------> text.pdf

That looks pretty painless; but there's a catch. While the previous methods employ EPS exclusively as the graphics format, pdflatex won't accept EPS directly at all: all the graphics have to be converted to JPEG, PNG, or PDF (!) before compiling.

That isn't as bad as it sounds, because EPS can be "wrapped" with PDF headers to become PDF and still have scalable, vector graphics. And JPEG is a compact format for photographs, while PNG is a very compact way to store images with sharp outlines without introducing compression artifacts." And LyX does it again automatically for you, if required.

The advantage of this method is that pdflatex is the most feature-rich converter program. It features, for instance, character protusion and font expansion (see this document for explanation), two microtypographical features that let your document look even better than "ordinary" LaTeX could ever achieve.

§ How can I make Acrobat Reader (acroread) update its display?

§ How can I make gv/Ghostview automatically update its display?

Set the resource (in for instance $HOME/.Xdefaults or $HOME/.gv) to:

  GV.watchFile: True


or change the option Watch File under the menu "State".

§ Where can I find tools for working with PDFs?

Open-source tools:

  • pdftk — PDF Tool Kit — Powerful toolkit, command line only (Windows, Linux, Mac OS X, FreeBSD and Solaris).
  • PdfMod — Simple application for modifying PDF documents under Linux. You can reorder, rotate, and remove pages, export images from a document, edit the title, subject, author, and keywords, and combine documents via drag and drop.
  • DiffPDF — Allows to compare ("diff") two PDF files, textually or visually.
  • PDFJam — Another command line tool for joining, rotating, merging and printing several PDFs on one page (Unix-like operating systems: Linux, Mac OS X, Solaris, etc.)
  • PDFedit — New open source PDF editor for Linux - still alpha/beta quality, but can edit PDF elements, not just metadata.
  • PDFill PDF Tools (MS Windows only)
  • PDF Split and Merge &‐ Utility to split apart (by pages) and merge PDF files (Java application, command line and GUI, with Windows installer).
  • Inkscape — "An Open Source vector graphics editor, with capabilities similar to Illustrator, CorelDraw, or Xara X, using the W3C standard Scalable Vector Graphics (SVG) file format." GUI - runs on Windows, Linux, Mac OS X.
  • Scribus a mighty OpenSource Desktop Publishing (DTP) program with QT GUI for Linux and Windows.
  • Ghostscript A powerful text-based PostScript and PDF interpreter (MS Windows, Apple MacOS, wide variety of Unix-like platforms, and VMS systems)
    • GSview GUI for Ghostscript and previewer (MS Windows, Linux, and IBM OS/2)
    • MacGSview GUI for Ghostscript and previewer (Mac OS)
  • Briss - GUI tool for cropping PDFs (cross-platform, needs Java) (particularly useful when combined with the print "fit to page" option which most PDF viewers have).
  • PDF-Shuffler is a small python-gtk application (frontend for python-pyPdf), which helps the user to merge or split pdf documents and rotate, crop and rearrange their pages using an interactive and intuitive graphical interface.

Commercial tools:

§ The fonts are not embedded in the exported PDF, what can I do?

If all the fonts are not embedded, and if the file is sent to other people who have not the non-embedded fonts installed, there will happen a font substitution which can make the pdf file unreadable. This is the reason why most publishers simply do not accept PDF documents with non-embedded fonts (and with bitmapped fonts, see the previous question).

If you want to check font embedding, you may either use the pdffonts command if it is available on your system, or use the File->Properties-Fonts tag or similar on your favourite viewer.

To make sure that all fonts are embedded:

  • if you use the Latex->ps2pdf way, you have to make sure that GhostScript is called by ps2pdf with the right switches: in the converter section of the LyX preferences, add the following switches to the ps2pdf command (in the PostScript->Pdf (ps2pdf) converter: -dPDFSETTINGS=/prepress -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true
If this does not work, please check the PDF output level of your ps2pdf command: these switches do not work with output level less than or equal to 12.
  • if you use pdflatex, recent distribution are OK with embedded fonts, make sure that you configuration files are correctly set if your distribution is old, cf. e.g. the testflow documentation.

Note that recent versions of the epstopdf script default to embedded fonts creation (a good source of non-embedded fonts are eps files created by external applications).

§ Where can I find more help on PDF?

Check out Herbert's page on PDF.

PDF The Orientation comment is allowed in eps files. Unfortunately it is interpreted differently by different programs Some programs interpret "Orientation Landscape" as "this file is already in landscape orientation", while others interpret it as "this file should be in landscape orientation, therefore it should be rotated by 90 degrees."

This makes it difficult to implement a unique solution to eps file conversion in LyX, and to get the same output in dvi, ps, and pdf.

Ghostcript has a -dAutoRotatePages= switch, which is activated by default in ps2pdf and de-activated by default in recent versions of epstopdf.

  • if the rotation comes after DVI-‐

<< | FAQ.PageList | >>

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2013-10-27 12:45 CET