Latex – Autres astuces
Voici quelques snipets de LaTeX basé sur mon rapport de stage / Master.
Pour faire cadres et avoir un fond en couleur
Pour avoir un cadre autour de votre texte, un peu de la même manière que pour afficher le code sur ce site :
\begin{figure}[htb!]
\centering
\fcolorbox{black0}{graylight}{\parbox{1\textwidth}{
\paragraph{}
A concrete example in our case would be to retrieve all the URIs watched by the client with the URI "sip:cz@iptel.org". This can be done with the following XPath query: \texttt{//service[@uri="sip:cz@iptel.org"]//entry/@uri}. This would also work in the case there are multiple \texttt{list} elements associated to the URI "sip:cz@iptel.org".
}}
\caption{The XPath query language}\label{fig:XCAPquery}
\end{figure}
Tableaux
\begin{table}[htb!]
\caption{Improvements and their level of implementation}\label{table:3lvl}
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
Improvement \ Level & JBoss Server & Configuration & Asterisk \\
\hline
\hline
Call control & X & & X \\
\hline
External SIP proxy support & & X & X \\
\hline
H.323 support & X & X & X \\
\hline
Statistics & X & & X \\
\hline
Non-human user detection & & & X \\
\hline
\end{tabular}
\end{center}
\end{table}
Pour ajouter des éléments dans la table des matières
Par exemple, pour ajouter la bibliographie à la table des matières :
\usepackage[nottoc]{tocbibind}
Pour faire des chapitres non-numérotés mais présents dans la table des matières :
\chapter*{Acknowledgments}\label{section:ack}\addcontentsline{toc}{chapter}{Acknowledgments}
Utiliser verbatimtab
Pour afficher du texte, tel quel :
\begin{figure}[p]
\begin{verbatimtab}
<?xml version="1.0" encoding="UTF-8"?>
<rls-services>
<service uri="sip:smith-list@iptel.org">
<resource-list>http://localhost/xcap-root/resource-lists/users/smith/
resource-list.xml/~~/resource-lists/list[@name=\%22default\%22]
</resource-list>
<packages>
<package>presence</package>
</packages>
</service>
<service uri="sip:cz@iptel.org">
<list name="czech iptel">
<entry uri="sip:abc@iptel.org">
<display-name>A B</display-name>
</entry>
<entry uri="sip:cde@iptel.org">
<display-name>C D</display-name>
</entry>
<entry uri="sip:efg@iptel.org">
<display-name>Ef Ge</display-name>
</entry>
</list>
<packages>
<package>presence</package>
<package>email</package>
</packages>
</service>
</rls-services>
\end{verbatimtab}
\centering%
\caption{Example of RLS services document~\cite{presencehandbook}}
\label{fig:rlsdoc}
\end{figure}
Résumé en plusieurs langues
Parfois, vous voulez faire un résumé (abstract) en plusieurs langues, pour ce faire vous pouvez utiliser le code ci-dessous :
\usepackage[swedish,french,english]{babel}
...
\selectlanguage{english}
\begin{abstract}
\paragraph{}
The increased use of computer networks has lead to the adoption of Internet-based solutions for reducing telephony costs. This has proved a boon to callers who can reach the other party directly via the Internet. Unfortunately numerous business person still need to call to and from mobile phones which are currently a domain where the customers are generally tightly bound to their operators. To provide a simple solution to this problem, Opticall AB has designed an integrated system called the Dial over Data (DoD) solution, coupling a mobile interface with an Asterisk PBX and a GSM gateway, which allows calls to be originated remotely at the best price, exploiting the company's existing network. This scheme allows the company to easily control telecommunications costs and to monitor of their employees' efficiency.
\end{abstract}
\selectlanguage{swedish}
\begin{abstract}
Den nuvarande ökningen av datanätverk har lett till adoptionen av Internetbaserade lösningar för att
förminskar kostnader inom telefoni. Tyvärr behöver åtskilliga affärsmän fortfarande ringa till och ifrån
mobiler som återstår som ett område där kunderna är fastkedjade till deras operatörer. För att tillföra en
enkel lösning till detta problem har Opticall AB planlagt ett integrerat system som kallas den DoD
servern som kopplar ihop ett mobilt gränssnitt, med en Asterisk PABX\glossary{[PABX] Private Automatic Branch eXchange, synonym with PBX} och en GSM förmedlingsnod, som tillåter telefonsamtal påbörjas avlägset på det billigaste priset tack vare företagets nätverk. Det ger möjligheten till företaget att vara centralt för sina personals kommunikationer. Det medger ett enkelt sätt att kontrollera kostnader samt övervaka personalens effektivitet.
\end{abstract}
\selectlanguage{french}
\begin{abstract}
L'omniprésence des réseaux informatiques aujourd'hui a pour effet de pousser de plus en plus à l'adoption de solutions en ligne pour réduire les coûts liés à la téléphonie. Malheureusement de nombreux hommes d'affaires doivent toujours appeler vers et depuis des téléphones portables, qui, pourtant, demeurent un domaine où les clients sont étroitement dépendants des opérateurs. Afin de fournir une solution à ce problème, Opticall AB a conçu un système intégré appelé le Dial over Data Server, comprenant une interface mobile à un PABX Asterisk et une passerelle GSM, qui permet à des appels d'être lancés à distance au meilleur prix en utilisant le réseau de l'entreprise. Un tel dispositif place l'entreprise aux centres des communications de ses employés en permanence. Ceci permet un meilleur contrôle des coûts et une surveillance centralisée de l'activité des employés.
\end{abstract}
Accolades géantes
Pour mettre une belle portion de votre texte entre accolades, et pas seulement sur une ligne : notez que ce snippet comporte aussi le “cadre couleur” évoqué plus haut
\begin{figure}[htb!]
\centering
\fcolorbox{black0}{gray1}{
The administrator $\left\{\begin{tabular}{m{4.2in}}
has access to full settings through a dedicated Web interface. Timeout periods, dialplan contexts, and the number of conferences simultaneously allowed can be adjusted to suit the needs of the company. Users and operators can also be managed via this interface.\\
\\
The manager $\left\{\begin{tabular}{m{3.2in}}
has access to detailed statistics for each user as both raw values and graphs, to allow monitoring of user activity. The manager can also access aggregated values per day, week, or month for each user.\\
\\
The user $\left\{\begin{tabular}{m{2.4in}}
can place calls and manage their contacts. He or she can also access a small subset of the statistics concerning her.
\end{tabular}\right.$
\end{tabular}\right.$
\end{tabular}\right.$
}
\caption{Access level model for the DoD interface}\label{fig:modelauth}
\end{figure}
Le secret réside dans le
$\left\{\begin{tabular}{m{4.2in}} \\ xxx \\.
Mes headers
Pour la bonne bouche, voilà tous mes includes et définitions en tête de document :
\documentclass[10pt,a4paper,onecolumn, openright]{report}
\usepackage[applemac]{inputenc}
\usepackage[swedish,french,english]{babel}
\author{Max Weltz}
\title{Dial over Data solution}
\usepackage[left=1.5in, right=1in, top=1in, bottom=1in, includefoot, headheight=13.6pt]{geometry}
\usepackage{multirow}
\usepackage{listings}
\usepackage{graphics}
\usepackage{footmisc}
\usepackage{verbatim}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[left]{eurosym}
\usepackage{array}
\usepackage{xy}
\usepackage{url}
\usepackage{afterpage}
\usepackage{float}
\restylefloat{figure}
\usepackage{moreverb}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{subfigure}
\usepackage{color}
\definecolor{gray1}{gray}{0.5}
\definecolor{graylight}{gray}{0.7}
\definecolor{black0}{gray}{0}
\setlength{\fboxrule}{1pt}%
\setlength{\fboxsep}{10pt}%
\makeglossary
\usepackage[nottoc]{tocbibind}%ajouter une entrée bibliographique à la table des matières %
\usepackage{graphicx}
\newcommand{\footnoteremember}[2]{\footnote{#2}\newcounter{#1}\setcounter{#1}{\value{footnote}}}\newcommand{\footnoterecall}[1]{\footnotemark[\value{#1}]}
\newcommand{\montitre}{\Huge Dial over Data solution}
\hyphenpenalty=5000
\tolerance=1000
\usepackage{hyperref}
\pdfcompresslevel=9
\hypersetup{
colorlinks=true, %colorise les liens
breaklinks=true, %permet le retour à la ligne dans les liens trop longs
urlcolor= blue, %couleur des hyperliens
linkcolor= blue, %couleur des liens internes
anchorcolor = blue,
citecolor = blue,
filecolor = blue,
pagecolor = blue,
pdftitle={Dial over Data solution}, %informations apparaissant dans
pdfauthor={Max Weltz} %dans les informations du document sous Acrobat.
}


