TeXnik - Tips TeX and LaTeX


Welcome to the TeXnik website (under construction)

hyperref-FAQ
TUG logo

Main page

Index
UK FAQ
Documentation
Software
CTAN
Search CTAN:

Statistics

Google c.t.t.

Google d.c.t.t.

 


 


2 a5 on one a4 page |  a4 to a5 conversion from PostScript to PDF |  Automatic export |  avi Videos as included files | 
Bibliography hrefs |  Bookmark | 
Color table |  Color and pagebreak | 
draftcopy watermark  | 
Extracting Images from a PDF file  | 
Fonts  |  Forms in a pdf Document  | 
Graphics Quality  | 
hyperref-package  | 
Index hrefs  |  Insert whole a4-pages  | 
Link toc entry and page number  |  Links to docs |  mailto-option as a \href  | 
number of pages  | 
Papersize and pdflatex |  PDF->ASCII |  pdflatex and Papersize  | 
References  | 
Starting with another page  | 
Two a5 on one a4 page  | 
Underscore Character  | 
Video and PDF  | 
Watermark  | 


total pages of a pdf file
\newsavebox\tempbox
\sbox\tempbox{\includegraphics{testa.pdf}}
\edef\testapages{\the\pdflastximagepages}

Link toc entry and page number
link.png

Color and pagebreak

If you have problems with colored text/footnotes/formulas and a pagebreak, so that the color gets lost, use package pdfcolmk

pdfbookmark

To get a bookmark you can use
\pdfbookmark[0]{My Chapter}{myAnchorName}
- 0: Level (0=chapter, 1=section, 2=subsection, ...)
- "My Chapter": Text
- "myAnchorName": anything which hyperref can use for the anchor name.


watermark

To get a watermark for PDF document you cannot use packages which have a solution with PostScript commands (like the draftcopy package). Use the pdfdraftcopy or the following code in your preamble.


Video
The pdf works only with an installed mplayer and the movie frsnel.avi.

Also have a look at easymovie.sty.


References
By default pdflatex converts references (figure/table/equation-numbers) to links, which includes only the number and not the forgoind word like figure/table/Equation. To get this in the link too, write
\hyperref[bar]{figure (\ref*{bar})}
where bar is a label in any figure environment.


a4 to a5 conversion from PostScript to PDF
To get a a5-format pdf-output with ps2pdf from a a4 PostScript doc run
psresize -Pa4 -pa5 file_in.ps | ps2pdf -sPAPERSIZE=a5 - file_out.pdf


Graphics Quality
To get better Graphics conversion from eps to pdf you can try some of the following options:

For ps2pdf:

-dAutoFilterColorImages=false
-dAutoFilterGrayImages=false
-dEncodeColorImages=false
-dEncodeGrayImages=false
-dEncodeMonoImages=false
For epstopdf:
-dAutoFilterColorImages=false
-dAutoFilterGrayImages=false
-sColorImageFilter=FlateEncode
-sGrayImageFilter=FlateEncode
-dPDFSETTINGS=/prepress
-dUseFlateCompression=true


Font Substitution
To get a better output for pdf files substitue the fonts with
\usepackage{mathptmx}% instead of package times
\usepackage[scaled=0.9]{helvet} % or [scaled=0.92], if you like
\usepackage{courier}


Forms in a PDF Document
Download the TeX-demofile from CTAN and run it with
pdflatex testform.tex
than you'll see in the output testfile.pdf what forms are possible for pdf.


Convert Files to pdf
If you have a lot of files to convert from any type to pdf use the following bash command, which makes life easier, because it converts all files with extension "eps":
for FILE in *.eps ; do epstopdf $FILE ; done
You need the program eostopdf, which should be part of your local TeX Installation.


Insert whole a4 pages or two a5 on one a4 page
in latex preamble
\usepackage{pdfpages}
package maybe part of your local tex-installation or available at CTAN. In the text write for example:
\includepdf[pages={1-10}, nup=2, scale=1.414]{a5doc.pdf}
if you want to insert the pages 1-10 of the pdf-document a5doc.pdf in your actual document.


PDF->ASCII
with
pdfimages -f 1 file.pdf DirForTheImages
extract all images in the pdf-file. with option -j you can save them as jpegs, otherwise by default ppm or pbm - format (a good choice).

With

pdftotext file.pdf file.txt
convert all to text.

when the pdf-file has some scanned-text, which is saved as image, you can convert these from pbm to tiff and than running an OCR-program.

In case you're wondering where to get pdfimages and pdftotext, they're part of xpdf.


hyperrefs to bibliography entries
The hyperrefs in a pdf-output, which poin to bib-entries are not correct. Write in latex preamble:
\renewenvironment{thebibliography}[1]{%
     \phantomsection
     \addcontentsline{toc}{chapter}{Bibliography}
     \chapter*{\bibname
        \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}


hyperrefs to the index
You need the hyperref-package, defined in latex preamble:

\usepackage[ps2pdf,...  other options ...]{hyperref}
Write just before your \printindex
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}

It maybe a good idea to write in preamble

\providecommand*{\phantomsection}{}
than you don't get an errormessage when disabling the use of hyperref.

mailto as a hyperref
You can define mailto-refs just like the one in html. You only need the hyperref-package, defined in latex preamble:

\usepackage[ps2pdf,pdftitle={myTitle},urlcolor=blue,linktocpage,a4paper,colorlinks=true]{hyperref}

in your text write

\href{mailto:voss@perce.de}{\texttt{voss@perce.de}}
in your pdf-output you can click on this hyperref and the standard mailer (e.g. Netscape) opens a mail-window.


hyperref-package
There is a golden rule that the hyperref-package should be loaded as the last package, except when using sidewaysfigures. Then for example:
\usepackage{nameref}
  \usepackage{hyperref}
  \usepackage{sidecap}
For more information have a look at the manual


Starting a pdf-doc with another page

View the pdf and you'll see that the doc starts with page no. 2.

local time: Thu Mar 28 09:45:58 CET 2024 ; file is: 1734.85200231481 days old
contact webmaster _at_ TeXnik.de