Cours L
ATEX EDITE de Paris
Bibliographies, commands, packages
21/01/2011
Outline
Bibliographies BibTEX Citations
Commands
Packages and Classes Miscellaneous
Application
Outline
Bibliographies BibTEX Citations
Commands
Packages and Classes Miscellaneous
Application
21/01/2011
BibTEX
Bibliographymanagement software
BibTEX database: .bibtext file describing bibliographic references, with a specific syntax
Each reference is identified by an alphanumerickey General principle: first compilation withpdflatexto gather bibliographic citations, call tobibtexon the name of the LATEX document without.tex, second and third compilations with pdflatexto integrate bibliographic references
Old software: sometimes some displeasing aspects to make it run. In particular, “old-style” accents need sometimes to be used (e.g., “\’e” for “é”), macros need to be protected with braces, etc.
Auxiliary files
From documents (.tex), packages (.sty), class (.cls), etc., LATEX produces the final document (.pdfor.dvi) as well as auxiliary files:
.aux all references encountered in the file .toc titles that will make up the table of contents .out bookmarks generated by hyperref
.log a compilation log etc.
From the.auxfile, the bibliography file (.bib), the bibliography style (.bst), BibTEX produces a.bblfile that contain the formatted bibliography.
If such a.bblfile exists, it is used to produce the final document during the next compilation.
21/01/2011
Example of BibTEX reference
@article{ bryant92symbolic, author = "Randal E. Bryant",
title = "Symbolic {Boolean} Manipulation with Ordered Binary-Decision Diagrams",
journal = {ACM Computing Surveys}, volume = 24,
number = 3,
pages = {293-318}, year = 1992}
A BibTEX file is a collection of such refeences. bryant92symbolicis the key, the other lines describe fields; the value of a complex field is put between double quotes or between braces.
Most commonly used reference types
@article journal article
@book book
@incollection book chapter
@inproceedings article published in conference proceedings
@mastersthesis Master’s thesis
@misc miscellaneous
@phdthesis PhD thesis
@techreport technical report
@unpublished unpublished
21/01/2011
Existing fields
author authors of the document, must be separated with “and”
(e.g.,"Jean Dupont and Jacques Durand"or"Dupont, Jean and Durand, Jacques")
title document title; if it contains uppercase letters that should be preserved (acronym, person name), they should be protected with braces
month month, abbreviated: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
institution, school for technical reports or theses booktitle for conference articles or book chapters
editor for the editor of a contributed book publisher for the publisher of a book
address for the address of the publisher volume, number, pages, year, note
Outline
Bibliographies BibTEX Citations
Commands
Packages and Classes Miscellaneous
Application
21/01/2011
In L
ATEX
According to~\cite{bryant92symbolic}, OBDDs are very interesting.
...
\bibliographystyle{alpha}
\bibliography{biblio}
\cite{key} to cite a reference, \nocite{key} to include a reference in the bibliography without citing it, \nocite{*} to include all references
Standard bibliography styles: alpha, plain, unsrt bibliois the name of the BibTEX file (without extension)
Customizing references
Numerous reference styles, including French styles (unsrt-fr, plain-fr, alpha-fr, etc.)
packages to customize citations in the body of the document:
natbib,jurabib
packages for multiple bibliographies: bibtopic,multibib,splitbib creating custom bibliographic styles: difficult with the traditional system, but thebiblatexpackage (still a bit experimental) facilitate things
21/01/2011
Outline
Bibliographies Commands
Defining LATEX Commands Defining TEX Commands
Packages and Classes Miscellaneous
Application
Outline
Bibliographies Commands
Defining LATEX Commands Defining TEX Commands
Packages and Classes Miscellaneous
Application
21/01/2011
Commands without arguments
\newcommand{\hello}
{Hello, what’s up?\par}
\hello\hello\hello
Hello, what’s up?
Hello, what’s up?
Hello, what’s up?
Redefining commands
\[\epsilon\leq\phi\geq\emptyset\]
\renewcommand{\epsilon}{\varepsilon}
\renewcommand{\phi}{\varphi}
\renewcommand{\emptyset}{\varnothing}
\renewcommand{\leq}{\leqslant}
\renewcommand{\geq}{\geqslant}
\[\epsilon\leq\phi\geq\emptyset\]
𝜖≤𝜑≥ ∅
𝜀6𝜙>∅
21/01/2011
Commands with arguments
\newcommand{\textitbf}[1]
{{\itshape\bfseries #1}}
It is in \textitbf{bold italic}.
It is inbold italic.
There is also \newcommand* that requires its argument not to contain a paragraph break.
Commands with an optional argument
\newcommand{\mister}[2][Mr]
{#1~\textsc{#2}}
\mister[Jean]{Dupont} and
\mister{Durand} have come.
Jean DUPONT and Mr DURAND
have come.
The default value of the optional argument (there can only be one) is given after the number of arguments.
21/01/2011
Environments
\newenvironment{listoneel}
{\begin{itemize}\item } {\end{itemize}}
\begin{listoneel}
toto
\end{listoneel}
toto
One can also define environments with arguments, with an optional argument, redefine environments, etc.
Outline
Bibliographies Commands
Defining LATEX Commands Defining TEX Commands
Packages and Classes Miscellaneous
Application
21/01/2011
Aliases
\let\t=\textbf
\renewcommand{\textbf}[1]
{\textit{#1}}
\t{toto} \t{titi}
\textbf{toto} \textbf{titi}
toto titi toto titi
Definition of TEX macros
\def\bouh#1(#2)+#3 {\textbf{#1}\textit{#2}%
\textsc{#3}}
\bouh to(ti)+ta
totiTA
Definition of macros with (almost) arbitrary syntax!
21/01/2011
Outline
Bibliographies Commands
Packages and Classes Creating a Package Creating a class Installation
Miscellaneous Application
Outline
Bibliographies Commands
Packages and Classes Creating a Package Creating a class Installation Miscellaneous Application
21/01/2011
Main ideas
Package: LATEX file with.styextension
In a package, use \RequirePackage instead of \usepackage Only important difference: in a package, command names may contain a @ character, not in a document. Commands with @ are thus kept for package internals
To use a command with @ in a document all the same, use
\makeatletter before and \makeatother afterwards Possible to have package options
Package skeleton
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mypackage} % Package name
\DeclareOption*{
\PackageError{mypackage}{Unknown option ‘\CurrentOption’}
}
\DeclareOption{optiona}{codea}
\DeclareOption{optionb}{codeb}
\ProcessOptions
% Arbitrary code
codea is executed if optiona is provided.
21/01/2011
Making option processing easier
\newif\if@optiona
\DeclareOption{optiona}{\@optionatrue}
\ProcessOptions
\if@optiona ...
\else ...
\fi
Outline
Bibliographies Commands
Packages and Classes Creating a Package Creating a class Installation Miscellaneous Application
21/01/2011
Document class
Very similar to a package,.clsfile Often constructed from a base class Skeleton:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{class} % Class name
% Options can be sent to the base class
\PassOptionsToClass{options}{baseclass}
% Options can be dealt with as in
% packages with \DeclareOption, \ProcessOptions
% The base class is loaded
\LoadClass{baseclass}
% Other instructions
Outline
Bibliographies Commands
Packages and Classes Creating a Package Creating a class Installation
Miscellaneous Application
21/01/2011
Installing a package or a class
If it is just a file: copy it into the compilation directory Otherwise, more complex. Under Unix:
Create a$HOME/texmf/tex/latex/directory
Put all package files (uncompressed) there, in a subdirectory whose name is the package name
Typetexhash ~/texmfin the command line Test!
Outline
Bibliographies Commands
Packages and Classes Miscellaneous
Application
21/01/2011
Other L
ATEX features
create indexes withmakeindex, an external program similar to BibTEX
include source code with thelistingspackage
\begin{lstlisting}
[language=C]
int main(void) { printf("Hello.\n");
return 0;
}
\end{lstlisting}
int m a i n (v o i d) { p r i n t f (" H e l l o .\ n ");
r e t u r n 0;
}
define pseudo-code algorithms with thealgorithm2epackage and many other things!
Outline
Bibliographies Commands
Packages and Classes Miscellaneous
Application
21/01/2011
Application
Follow the instructions of the lab sheet, available on the course Web site.
Licence de droits d’usage
Contexte public} avec modifications
Par le téléchargement ou la consultation de ce document, l’utilisateur accepte la licence d’utilisation qui y est attachée, telle que détaillée dans les dispositions suivantes, et s’engage à la respecter intégralement.
La licence confère à l’utilisateur un droit d’usage sur le document consulté ou téléchargé, totalement ou en partie, dans les conditions définies ci-après et à l’exclusion expresse de toute utilisation commerciale.
Le droit d’usage défini par la licence autorise un usage à destination de tout public qui comprend : – le droit de reproduire tout ou partie du document sur support informatique ou papier,
– le droit de diffuser tout ou partie du document au public sur support papier ou informatique, y compris par la mise à la disposition du public sur un réseau numérique,
– le droit de modifier la forme ou la présentation du document,
– le droit d’intégrer tout ou partie du document dans un document composite et de le diffuser dans ce nouveau document, à condition que : – L’auteur soit informé.
Les mentions relatives à la source du document et/ou à son auteur doivent être conservées dans leur intégralité.
Le droit d’usage défini par la licence est personnel et non exclusif.
Tout autre usage que ceux prévus par la licence est soumis à autorisation préalable et expresse de l’auteur :[email protected]