[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ next ]
Translations of this chapter:
You can find a translation into
Ukranian
by Kate Belevets of OhMyEssay.com
.
You can find a translation to French by Maxwell Edward in this link
.
You can find a translation to Hindi by Mahesh Varma in this
link
.
You can find translations to Sindi and Urdu by Samuel Badree in this
link
and this
link
.
pdftk
application examplesUpdated on April 18th, 2017.
Updated on December 1st, 2011.
We present several examples of transforming PDF files using the
program pdftk
, a powerful and simple application to work with
PDF files.
Removing pages. If we have a file named text.pdf
with ten pages,
the following commands transform the file removing certain pages and saving the
transformed output in file out_text.pdf
:
Remove first two pages:
$ pdftk text.pdf cat 3-10 output out_text.pdf
Remove pages 2, 3, and 6:
$ pdftk text.pdf cat 1 4-5 7-10 output out_text.pdf
Merge PDF files.
$ pdftk 1.pdf 2.pdf 3.pdf 4.pdf cat output file1234.pdf
This command merges four files into a final file file1234.pdf.
Split the pdf file into pages. If you want to create a pdf including only the first page of file jpcA.pdf
pdftk jpcA.pdf cat 1 output jpcA_p1.pdf
In case you want to extract pages 1 to 3, leave out pages 4 and 5, and include the rest of the pages you can execute
pdftk jpcA.pdf cat 1-3 6-end output jpcA_partial.pdf
If you want to extract all the pages of a pdf document in separate files you
can use the burst option. If the file document_A.pdf
has 8 pages the command
pdftk document_A.pdf burst output document_A_page_%01d.pdf
creates files document_A_page_1.pdf
...
document_A_page_8.pdf
.
If you want to include a pdf file amid the pages of another pdf document, e.g.
we want to include file document_small.pdf
after page 8 of file
document_big.pdf
and save the final result into a file called
document.pdf
, we can do this as follows
pdftk A=document_big.pdf B=document_small.pdf cat A1-8 B A9-end output document.pdf
(To Do) Decrypt input or encrypt output.
(To Do) Generate FDF data stencil from PDF forms.
(To do) Apply a background watermark or a foreground stamp.
Updated on December 1st, 2011.
We explain an alternative way to merge PDF files, to avoid using
pdftk
. This is also applicable to PostScript files.
You can also merge two PostScript or PDF files using
gs
$gs -q -dNOPAUSE -dBATCH -sDEVICE=pswrite \ -sOutputFile=bla.ps -f foo1.ps foo2.ps $gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \ -sOutputFile=bla.pdf -f foo1.pdf foo2.pdf
bibtex
You can include the term et al. to replace a long set of authors in a
bibtex
reference using and others. Thus, if you want
to include only the first two authors and replace the rest by others, the
bibtex
author field should be written as
author = {First Author and Second Author and others},
LaTeX
You can include the bibliography after each chapter in LaTeX
using
the package chapterbib
. You can even change the citation style
for each chapter. In order to do so include at the beginning of the main
tex source file the line
\usepackage{chapterbib}
Then at the end of each chapter include
\bibliographystyle{alpha} \bibliography{texfilename}
For each chapter you can change the bibliography style if necessary. If you
are using \include{filename do not forget to run
bibtex
to each of the included files possessing a bibliography
entry.
LaTeX
In order to comment one or several paragraphs in a LaTeX
source
file instead of making use of the % character you can use the
verbatim package including at the beginning of your tex
file
\usepackage{verbatim}
And then you can simply comment several lines of the file making use of \begin{comment} and \end{comment}
\begin{comment} Commented fragment ... \end{comment}
LaTeX
package or style.
The way to install a LaTeX
package in the right path is shown.
The first step is to look for the place where the package should be installed.
$ kpsewhich -expand-var "\$TEXMFLOCAL" /usr/local/share/texmf
Unpack the latex package that is going to be installed and copy the directories (bibtex/, doc/, tex/ ...) to the previous path, /usr/local/share/texmf and rehash the database.
$ sudo cp -r doc tex source bibtex /usr/local/share/texmf $ texhash texhash: Updating /usr/local/share/texmf/ls-R... texhash: Updating /var/lib/texmf/ls-R-TEXMFMAIN... texhash: Updating /var/lib/texmf/ls-R-TEXLIVE... texhash: Updating /var/lib/texmf/ls-R... texhash: Done.
The style is now ready and installed.
DebianDoc
files
In order to change the selected language for a DebianDoc
sgml file the option -l is employed. This affects
the different tags and labels in the text.
For example, assuming that the default language in the system is English and we want to generate a version in Spanish in ASCII format of the file test.sgml we should employ
debiandoc2text -les_ES test.sgml
In this case we suppose that the locale es_ES is available[14].
When preparing pdf files from LaTeX
files sometimes the
dvipdf script takes a very long time to complete the pdf file and
outputs some errors like in the following example.
$ dvipdf test.dvi Page 1 may be too complex to print Page 3 may be too complex to print Warning: no %%Page comments generated.
Moreover, when the final pdf file is opened with a viewer there is a long series of error messages
$ xpdf test.pdf Error: Bad bounding box in Type 3 glyph Error: Bad bounding box in Type 3 glyph Error: Bad bounding box in Type 3 glyph Error: Bad bounding box in Type 3 glyph Error: Bad bounding box in Type 3 glyph Error: Bad bounding box in Type 3 glyph
This is due to the inclusion of the command \usepackage[T1]{fontenc} in the input file. This is convenient when writing in Spanish because in this way you have access to special characters (as accented letter).
The solution to the problem consists in making use of the latin-modern fonts. The heading of the tex file should include
\usepackage[T1]{fontenc} \usepackage{lmodern}
The Debian
package that includes this fonts should be installed
and its name is lmodern.deb.
LaTeX
lists
LaTeX
distinguishes between three different list environments:
enumerate, itemize, and description.
Each environment provides four levels, which implies you can have nested lists
of up to four levels. The description of the three environments is the
following.
Enumerate
The syntax in this case is
\begin{enumerate} \item ... \end{enumerate}
The enumerate environment permits the definition of numbered lists. If you like to change the appearance of the enumerator, the simplest way to change is to use the enumerate-package, giving you the possibility to optionally choose an enumerator.
\usepackage{enumerate} ... \begin{enumerate}[I]%for capital roman numbers. \item \end{enumerate} \begin{enumerate}[(a)]%for small alpha-characters within brackets. \item \end{enumerate}
Itemize
Itemization is probably the mostly used list in LaTeX
. It also
provides four levels.
\begin{itemize} \item ... \end{itemize}
The bullets marking each item can be changed for each level using the following command:
\renewcommand{\labelitemi}{$\bullet$} \renewcommand{\labelitemii}{$\cdot$} \renewcommand{\labelitemiii}{$\diamond$} \renewcommand{\labelitemiv}{$\ast$}
Amongst the more commonly used symbols are $\bullet$, $\cdot$, $\diamond$, $-$, $\ast$, and $\circ$.
Description
The description list is very handy if you need to explain notations or terms. Its neither numbered nor bulleted. The user can define the string marking each item.
\begin{description} \item[] ... \end{description}
In the three environments the space between different items can be controlled with the \itemsep command that can only be added just after begin
\begin{itemize}\itemsep2pt \item \end{itemize}
LaTeX
In order to use utf encoding in LaTeX
the following
line should be added to the tex file
\usepackage[utf8]{inputenc}
If this option does not work use utf8x instead utf8.
LaTeX
Added on November 30th, 2011.
In order to use colors in your in LaTeX
the following line should
be added to the file preamble
\usepackage{color}
The text can be colored in different ways
\textcolor{declared-color}{text} {black text\color{declared-color} text}
where declared-color is a color that was defined before by \definecolor. You can change the background color of the whole page by:
\pagecolor{declared-color}
LaTeX
Added on January 20th, 2012.
Updated on February 1st, 2012
In order to define a LaTeX
document with smaller margins than the
default without tampering too much with measures and sizes the
fullpage package can be used adding the your document header
\usepackage[options]{fullpage}
Possible options for this package are
in: (default) margins set to 1 in.
cm: margins set to 1.5 cm.
plain: (default) selects plain page style.
empty: neither headers nor footers.
headings: both headers and footers.
myheadings: both headers and footers.
\usepackage[cm]{fullpage}
With A4 papersize another possibility is
\usepackage{a4wide}
LaTeX
Added on January 8th, 2016.
The standard footnote symbol in a LaTeX
text are numbers, and
sometimes, when combined with equations, can produce certain ambiguity. The
symbols can be changed to a set of rotating nine different symbols adding to
the text preamble
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
Another option is to change to alphabetic uppercase labels with the command
\renewcommand{\thefootnote}{\Alph{footnote}}
LaTeX
Added on February 5th, 2012.
Sometimes in LaTeX
it is necessary to make reference to the same
footnote several times in a page. The following syntax allows for this
Text that has a footnote\footnote{This is the footnote} looks like this. Later text referring to same footnote\footnotemark[\value{footnote}] uses the other command.
It is important to take into account that this doesn't work if there are other footnotes between the first reference and any of the other duplicates.
LaTeX
Added on February 7th, 2012.
The euro currency symbol in LaTeX
is added making use of the
package eurosym, which is part of all the major
GNU/Linux
distributions. The package has to be loaded in the
document header
\usepackage{eurosym}
Then there are two possible ways of including the euro currency symbol.
The book is 10 \euro. The book is \euro 10. The book is \EUR{10}. \textbf{The book is \EUR{10}.} \textit{The book is \EUR{10}.}
LaTeX
textsAdded on November 16th, 2012.
The occurrence of a large table or figure in LaTeX
sometimes
hamper the display in the default portrait orientation. This can be solved
changing one or various pages to landscape orientation.
The geometry package allows to change the full document to landscape orientation adding to the document header
\usepackage[landscape]{geometry}
The lscape package allows to change to landscape orientation a section of the document. To do so add the following line to the document header
\usepackage{lscape}
And whenever it is needed to switch to landscape orientation, e.g. to include a large table or figure the region affected by the change is defined as
\begin{landscape} ... table or figure here ... \end{landscape}
This is specially suited for printing. To change also the orientation in the pdf file and for better screen readibility use the package pdflscape in the header instead of lscape
\usepackage{pdflscape}
And proceed as before
\begin{landscape} ... table or figure here ... \end{landscape}
LaTeX
documentAdded on November 18th, 2012.
Sometimes when writing a two-column document the occurrence of a large table or
figure in LaTeX
forces its display in a single-column way. This
can be solved for figures and tables using the -* variant
\begin{table*} \end{table*} \begin{figure*} \end{figure*}
In this way figures and tables will occupy the full page.
LaTeX
Added on January 15th, 2016.
The horizontal spacing between words and between words and objects in
LaTeX
is automatically determined. However we may be interested
in adding or removing space. This can be done making use of the command
\hspace{length}
Where length can be expressed in cm, px, etc. If such a space should be kept even if it falls at the end or the start of a line, use the command \hspace*.
The command
\stretch{n}
acts differently, generating "elastic" spacing. It extends until all the remaining space on a line is occupied. If two \hspace{\stretch{n}} commands are issued on the same line, they grow according to the stretch factor.
X\hspace{\stretch{1}} X\hspace{\stretch{2}} X x x x
BibTeX
References in the TeX
source fileAdded on July 2nd, 2019.
Once you successfully compile your LaTeX
source, including
external references with bibtex
from a bibfile you can include the
references into the LaTeX
source following two steps.
First, remove the line in your tex file defining the bibliography, e.g. \bibliography{xxx}, and then insert in the file the contents of the bbl file previously generated. Remove then the existing aux file and recompile.
[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ next ]
Some Mini-Howtos of Interest
Curro Perez-Bernalmailto:francisco.perez@dfaie.uhu.es