TeXnik - Tips TeX and LaTeX

Welcome to the TeXnik website (under construction)

TUG logo

Main page

Search CTAN:


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

Link toc entry and page number

Color and pagebreak

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


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.


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.

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

Also have a look at easymovie.sty.

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:

For epstopdf:

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

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
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.

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).


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:
      \@clubpenalty \clubpenalty
       {\@latex@warning{Empty `thebibliography' environment}}%

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

\usepackage[ps2pdf,...  other options ...]{hyperref}
Write just before your \printindex

It maybe a good idea to write in preamble

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:


in your text write

in your pdf-output you can click on this hyperref and the standard mailer (e.g. Netscape) opens a mail-window.

There is a golden rule that the hyperref-package should be loaded as the last package, except when using sidewaysfigures. Then for example:
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: Sat Jul 11 19:50:28 CEST 2020 ; file is: 379.230127314815 days old
contact webmaster _at_ TeXnik.de