Edit Links |
FAQ /
Categories: PDF << Numbering | Page list | EquationNumbering >>This page contains frequently asked questions about LyX and PDF
§ How can I include PDF documents in my file?From LyxUsersThreadRoot:14869 — See the LaTeX-package pdfpages for including PDF files. § How do I create clickable URLs/hyperlinks in a PDF file ?Write in the LaTeX preamble: \usepackage{hyperref} To make the links look like normal web-links (avoids boxes around the links and colors them blue instead of magenta), add "colorlinks=true" and "urlcolor=blue" as options: \usepackage[colorlinks=true,urlcolor=blue]{hyperref}If you don't want the URL but a certain word as a hyperlink, open an ERT box by pressing C-L. \href{http://www.lyx.org}{LyX-Homepage}
\href{mailto:abc@lyx.abc}{my email address}
or \href{mailto:abc@lyx.abc?subject=LyX}{my email address}
\href{run:program.exe}{your program}
§ How do I generate bookmarks in a PDF file?In the LaTeX preamble write: \usepackage[bookmarks]{hyperref} \usepackage[bookmarks, bookmarksopen=true, bookmarksnumbered=true]{hyperref}
§ How can I create custom PDF bookmarks?Write in the LaTeX preamble : \usepackage{hyperref} § 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 scaleable 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 possibilites.
If you use LyX 1.5 or greater: Set the document font to "Latin Modern Roman". If it claims that the font is not installed, install the font, reconfigure LyX (Tools->Reconfigure), and try again. Before LyX 1.5:
To use "lm" in LyX documents, add to the preamble 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. Before LyX 1.5: To use Times do not select Times in Layout→Document, but rather insert in the preamble: To use Palatino do not select Palatino in Layout→Document, but rather insert in the preamble: See also section 5.3.6 in Extended.lyx for more general informations, or the FAQ for the TEX FAQ (keyword=fonts) [tex.ca.uk]. § How can I edit/write the properties of a PDF file?Use the LaTeX package hyperref. colorlinks=true %to avoid the red boxed around cross-references
pdftitle={Title of PDF document}
pdfauthor={Author of PDF document}
pdfstartpage={3} %the PDF is opened on page three
\usepackage[pdftitle={A Summer Holiday}]{hyperref}
Multiple options can be combined like this: \usepackage[pdftitle={A Summer Holiday},pdfauthor={John Smith}]{hyperref}
For further description look at the hyperref manual. 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). § 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 § Can I add annotations to the PDF?This is possible with a fairly recent version of pdftex and some PDF specials or with dvipdfm(x) and with dvi specials, respectively. This style file defines a command \pdfremark[optional title]{text}, whose content will be inserted as an annotation in the PDF file (line breaks can be inserted with \\). It works for me (using Adobe Reader, not with xpdf), but I haven't tested it very much. /JSpitzm § 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:
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
pdftk sourcefile.pdf cat 130-140 output test.pdf
§ 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:
§ My eps figures are rotated in the pdf output. What can I do ?The following is a short digest of this thread Citing Georg Baum: "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 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.
ps2pdf -dAutoRotatePages=/None foo.ps
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. § Where can I find more help?Check out Herbert's page on PDF. Difference of ps2pdf, dvipdfm(x) and pdflatexLyX supports three different ways of producing PDF files. This is because all of them have their specific pros and cons. According to a post by Stephen LyxUserPost:31933 Well, I think I've read this more than one place. ps2pdf methodTraditionally, you converted your LaTeX source file to a DVI file, which could then be converted to PostScript with
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 methodIf 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 methodThe 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. Where can I find tools for working with PDFs?Free tools:
Commercial tools:
<< Numbering | FAQ.PageList | EquationNumbering >> |