\documentclass{scrartcl}
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[francais,american]{babel}
\usepackage{hyperref}

\title{TP \LaTeX{} EDITE\\
Bibliography, commands, packages}

\author{Pierre Senellart}
\date{21 January 2011}

\begin{document}

\maketitle

\section{Bibliography}
Reproduce the following bibliography with
Bib\TeX~\cite{btxdoc} It should be rendered in a French style.
One can download the 
\texttt{alpha-fr.bst} French bibliographic style (not installed by
default in \LaTeX{} distributions)
distributions de \LaTeX) from
\url{http://www.ctan.org/tex-archive/biblio/bibtex/contrib/bib-fr/}

\selectlanguage{francais}
\nocite{*}
\bibliographystyle{alpha-fr}
\bibliography{tp}
\selectlanguage{american}

\section{Installation}

Install the beamer and pgf packages (the latter is the \LaTeX{} package
that contains TikZ), available on the Web, in their latest version, in
your
\verb|$HOME/texmf/| directory (see the instructions in the slides). Test
the installation by compiling this minimal file:
\begin{verbatim}
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\frame{Hello}
\end{document}
\end{verbatim}

\section{Commands and packages}

\begin{itemize}

\item Create a \texttt{macros.sty} file with a minimal package structure.
Create a companion
\texttt{document.tex} file that uses this package.

\item Define in \texttt{macros.sty}
a \LaTeX{} command \verb|\set| with one argument. The command
\verb|$\set{1\dots n}$| should produce
$\{\,1\dots n\,\}$.

\item Modify \verb|\set| so that it takes an optional argument.
The command \verb|$\set[f(x)\neq 0]{x\in X}$| should produce $\{\,x\in X\mid
f(x)\neq 0\,\}$. If the optional argument is not present, nothing should
change.
To test this, one can use the \LaTeX{} command
\verb|\@ifempty|: \verb|\@ifempty{arg}{toto}{titi}| outputs \verb|toto|
if \verb|arg| is empty, \verb|titi| otherwise. This command requires a
\verb|\usepackage{amsmath}|.

\item One would like the optional argument to come after the required
argument and not before.
This is not possible in \LaTeX{}, but it is in \TeX{}:
\begin{verbatim}
\def\set#1{\@ifnextchar[{\setinternal#1}{\left\{#1\right\}}}
\def\setinternal#1[#2]{\left\{\,#1 \mid #2\,\right\}}
\end{verbatim}

Study this definition, understand, and test.

\end{itemize}

\section{Custom class for writing letters}

Study the documentation of the KomaScript package
(\verb|texdoc scrguien|) about the document class
scrlttr2. Build a minimal example of a letter with your address.
From this example, build a custom document class on top of 
scrlttr2 allowing to write letters in the easiest way as possible,
without having to write again and again your address and other similar
information.

If you still have time, add the possibility to choose between English and
French, between personal address and professional address, etc.

\end{document}
