Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
programming:latex [2006/12/14 01:54] cyril created |
programming:latex [2013/09/19 16:40] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
Use latex ! | Use latex ! | ||
+ | |||
+ | ===== Software ===== | ||
+ | |||
+ | For Windows I recommend using [[http:// | ||
+ | |||
+ | With Linux I use TeTex distribution, | ||
+ | |||
+ | ===== Howtos ===== | ||
+ | ==== Use hyperlinks ==== | ||
+ | |||
+ | To have all references as hyperlinks (table of contents, references, URLs) ... | ||
+ | You can also fill title and author fields of the pdf file. | ||
+ | |||
+ | <code latex> | ||
+ | \usepackage[colorlinks=true, | ||
+ | |||
+ | \href{http:// | ||
+ | \url{http:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Include PDF documents ==== | ||
+ | |||
+ | Compile with '' | ||
+ | |||
+ | <code latex> | ||
+ | \usepackage{pdfpages} | ||
+ | \includepdf[pages=-]{pdf_filename_without_extension} % all pages | ||
+ | </ | ||
+ | |||
+ | ==== Highlight syntax in your code ==== | ||
+ | |||
+ | <code latex> | ||
+ | \usepackage{listings} | ||
+ | |||
+ | % this is not mandatory (customization), | ||
+ | \definecolor{colCode}{rgb}{.4, | ||
+ | \lstset{ | ||
+ | language=[ANSI]C++, | ||
+ | basicstyle=\footnotesize\ttfamily\color{colCode}, | ||
+ | keywordstyle=\bfseries, | ||
+ | identifierstyle=, | ||
+ | commentstyle=\rmfamily\itshape\color{blue}, | ||
+ | numbers=left, | ||
+ | showstringspaces=false, | ||
+ | tabsize=2, | ||
+ | extendedchars=true, | ||
+ | xleftmargin=.5cm | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code latex> | ||
+ | \begin{lstlisting} | ||
+ | for(int i = 0; i < 10; i++) | ||
+ | cout << i << " " << endl; | ||
+ | \end{lstlisting} | ||
+ | |||
+ | \begin{lstlisting}[language=XML] | ||
+ | <foo bar=value> | ||
+ | hello | ||
+ | </ | ||
+ | \end{lstlisting} | ||
+ | |||
+ | \lstinputlisting{matlab.m} % include the file | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Bibliography ==== | ||
+ | |||
+ | <code latex> | ||
+ | \bibliographystyle{plain} % before begin{document} | ||
+ | |||
+ | \cite{gaussier99} | ||
+ | |||
+ | \nocite{*} % to print all references in the biblio without citing them | ||
+ | \bibliography{biblio} | ||
+ | </ | ||
+ | |||
+ | In a file '' | ||
+ | <code latex> | ||
+ | @BOOK{IA06, | ||
+ | author = {Stuart Russel and Peter Norvig}, | ||
+ | publisher = {Pearson Education}, | ||
+ | title = {Artificial Intelligence}, | ||
+ | year = {2006} | ||
+ | } | ||
+ | |||
+ | @BOOKLET{gaussier99, | ||
+ | author = {P. Gaussier, C. Joulain, J.P. Banquet, S. LeprĂȘtre, A. Revel}, | ||
+ | title = {The visual homing problem}, | ||
+ | year = {1999} | ||
+ | } | ||
+ | |||
+ | @MANUAL{FAQCPP, | ||
+ | title = {C++ FAQ Lite}, | ||
+ | author = {Marshall Cline}, | ||
+ | note = {Available on the Internet : http:// | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then for compilation : | ||
+ | - [pdf]latex file.tex | ||
+ | - bibtex file | ||
+ | - [pdf]latex file.tex | ||
+ | - [pdf]latex file.tex | ||
+ | |||
+ | ==== Annotations ==== | ||
+ | |||
+ | To add some text that is viewed on the screen, but not printed. | ||
+ | |||
+ | <code latex> | ||
+ | The online version of this document contains additional information at | ||
+ | the end of this paragraph. | ||
+ | \pdfannot width 10em depth 50mm | ||
+ | { /Subtype /FreeText | ||
+ | /Contents (Hello, world!)} | ||
+ | </ | ||
+ | |||
+ | ===== Tips ===== | ||
+ | |||
+ | ==== Multirow entries in a table ==== | ||
+ | |||
+ | <code latex> | ||
+ | \parbox[position][height][inner-pos]{width}{text} | ||
+ | </ | ||
+ | |||
+ | For example : | ||
+ | <code latex> | ||
+ | \begin{tabular}[t]{cc} | ||
+ | short & still short\\ | ||
+ | oh, short & \parbox[t][0.5cm]{4cm}{Oh this is really a very long sentence that I have to write in that cell now}\\ | ||
+ | \end{tabular} | ||
+ | </ | ||
+ | |||
+ | ==== Number subsubsections with letters ==== | ||
+ | |||
+ | <code latex> | ||
+ | \setcounter{secnumdepth}{3} % to number subsubsections | ||
+ | \renewcommand\thesubsubsection{\alph{subsubsection}} % to number them with just a letter | ||
+ | \makeatletter | ||
+ | \renewcommand\p@subsubsection{\thesubsection.} % to reference them with chap.sec.ssec.sssec | ||
+ | \makeatother | ||
+ | </ | ||
+ | ===== Errors ===== | ||
+ | |||
+ | |||
+ | ==== Texhash ==== | ||
+ | |||
+ | When doing a texhash : | ||
+ | texhash: / | ||
+ | | ||
+ | The magic string is : | ||
+ | % ls-R -- filename database for kpathsea; do not change this line. | ||
+ | |||
+ | You must add it as the first line of the file ''/ | ||
+ | |||
+ | **EDIT** by cJ : You're sure of this ? I'm generating my ls-R with '' | ||
+ | **EDIT** by cyril : all I know is that I had this error, there was no magic string, and after adding it texhash didn't complain anymore ... |