logo rss

Mes notes personnelles LaTeX

Introduction

J'utilise souvent le langage LaTeX pour faire mes my rapports. J'utiliserais cette page comme d'un pense-bĂȘte, si cela peut en plus aider d'autres personnes…

Windows

J'utilise personnelement MiKTeX.

GNU/Linux

  • Installation :
root@host:~# apt update && apt install texlive texlive-latex-extra texlive-lang-french
  • Installation complĂšte :
root@host:~# apt update && apt install texlive-full
  • Convertir un fichier tex en fichier pdf :
user@host:~$ pdflatex file.tex
  • Convertir un fichier tex en fichier rtf (Word ou Writer) :
root@host:~# apt update && apt install latex2rtf user@host:~$ latex2rtf file.tex

Page de garde

  • Code :
\documentclass{article} \usepackage[utf8]{inputenc} \author{shebangthedolphins.net} \title{My Title} \begin{document} \maketitle \end{document}
  • Aperçu :
LaTeX | Front Page
  • Ajout d'une table des matiĂšres :
\begin{document} \maketitle \newpage \tableofcontents \newpage \end{document}

Bulles

  • Code :
\begin{document} \begin{itemize} \item[$\bullet$] \textbf{Name :} shebangthedolphins.net \item[$\bullet$] \textbf{Version :} 1.0 \subitem $\bullet$ element 1 \subitem $\bullet$ element 2 \end{itemize} \end{document}
  • Aperçu :
LaTeX | Bullets items

Tableaux

Tableaux sur plusieurs pages

  • Code :
\documentclass{article} \usepackage{longtable} \begin{document} \begin{center} \begin{longtable}{ | p{3.6cm} |p{3.6cm} | p{3.6cm} | } \hline \textbf{Programs} & \textbf{Editors} & {\textbf{Version}} \\ \hline \hline Microsoft Visual C++ 2005 Redistributable & Microsoft Corporation & 8.0.56336 \\ \hline Microsoft Visual C++ 2005 Redistributable (x64) & Microsoft Corporation & 8.0.56336 \\ \hline Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.17 & Microsoft Corporation & 9.0.30729 \\ \hline Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161 & Microsoft Corporation & 9.0.30729.6161 \\ \hline Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.17 & Microsoft Corporation & 9.0.30729 \\ \hline Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161 & Microsoft Corporation & 9.0.30729.6161 \\ \hline Microsoft Visual C++ 2010 x64 Redistributable - 10.0.40219 & Microsoft Corporation & 10.0.40219 \\ \hline Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219 & Microsoft Corporation & 10.0.40219 \\ \hline Microsoft Visual C++ 2010 x86 Runtime - 10.0.40219 & Microsoft Corporation & 10.0.40219 \\ \hline Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.61030 & Microsoft Corporation & 11.0.61030 \\ \hline Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030 & Microsoft Corporation & 11.0.61030 \\ \hline Microsoft Visual C++ 2012 x86 Additional Runtime - 11.0.61030 & Microsoft Corporation & 11.0.61030 \\ \hline Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.61030 & Microsoft Corporation & 11.0.61030 \\ \hline Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005 & Microsoft Corporation & 12.0.21005 \\ \hline Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005 & Microsoft Corporation & 12.0.21005 \\ \hline Microsoft Visual C++ 2013 x86 Additional Runtime - 12.0.21005 & Microsoft Corporation & 12.0.21005 \\ \hline Microsoft Visual C++ 2013 x86 Minimum Runtime - 12.0.21005 & Microsoft Corporation & 12.0.21005 \\ \hline Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.24212 & Microsoft Corporation & 14.0.24212 \\ \hline Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.24212 & Microsoft Corporation & 14.0.24212 \\ \hline Microsoft Visual C++ 2015 x86 Additional Runtime - 14.0.24212 & Microsoft Corporation & 14.0.24212 \\ \hline Microsoft Visual C++ 2015 x86 Minimum Runtime - 14.0.24212 & Microsoft Corporation & 14.0.24212 \\ \hline Microsoft Visual Studio 2010 Shell (Isolated) - ENU & Microsoft Corporation & 10.0.40219 \\ \hline Microsoft VSS Writer for SQL Server 2014 & Microsoft Corporation & 12.2.5000.0 \\ \hline \end{longtable} \end{center} \end{document}
  • Aperçu :
LaTeX | Array

Tableaux avec Multicolonnes

  • Code :
\documentclass{article} \usepackage{longtable} \usepackage{array} \begin{document} \begin{center} %Ref : https://tex.stackexchange.com/questions/338478/break-long-word-in-tabular \newcolumntype{P}[1]{>{\hspace{0pt}}p{#1}} \begin{longtable}{ |P{5cm}|P{2cm}|P{2cm}|P{2cm}| } \hline \textbf{Function} & \textbf{mplayer} & \textbf{mpv} & \textbf{vlc}\\ \hline \hline \multicolumn{4}{|c|}{Commands} \\ \hline Adjust audio delay (A/V sync) & -/+ & Ctrl-/Ctrl+ & j/k \\ \hline Adjust subtitle delay & x/z & Z/z & h/g \\ \hline \end{longtable} \end{center} \end{document}
  • Aperçu :
LaTeX | Multicolumn

Tableaux avec Multicolonnes II

  • Code :
\documentclass{article} \usepackage{longtable} %pour les longs tableaux de plusieurs pages \usepackage{multirow} \usepackage[table,dvipsnames]{xcolor} %pour colorer les cellules (table) et colorier le texte (erreur si les deux sont séparés avec un usepackage chacun ex : \usepackage[table]{xcolor} + \usepackage[dvipsnames]{xcolor} \begin{document} \section{AV Test} \setlength\LTleft{-2.0cm} %réduire la mage à gauche de 2cm \begin{center} \begin{longtable}{ | p{3.5cm} | p{5.5cm} | c | c | c | } \hline & & \textbf{Test AV} & \textbf{Test Virus} & \textbf{Quarantine} \\ \hline \hline \multirow{2}{*}{\textbf{Update}} & Success & \textcolor{Green}{OK} & - & \cellcolor{black} \\ \cline{2-5} & Fails & - & \textcolor{Red}{KO} & \cellcolor{black} \\ \hline \multirow{4}{*}{\textbf{Scan AV}} & AV Scan & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \cellcolor{black} \\ \cline{2-5} & Boot Scan & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \cellcolor{black} \\ \cline{2-5} & Manual Scan & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \cellcolor{black} \\ \hline \multirow{3}{*}{\textbf{Check Virus}} & Real Time Protection & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \textcolor{Green}{OK} \\ \cline{2-5} & CD/DVD & - & - & - \\ \cline{2-5} & USB & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \textcolor{Green}{OK} \\ \hline \multirow{3}{3.5cm}{\textbf{Test with compressed achives}} & Real Time Protectoin & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \textcolor{Red}{KO}\\ \cline{2-5} & CD/DVD & - & \textcolor{Green}{OK} & - \\ \cline{2-5} & Clé USB & \textcolor{Green}{OK} & \textcolor{Green}{OK} & \textcolor{Red}{KO} \\ \hline \textbf{Stop and Start} & Try to stop then restart computer & \textcolor{Red}{KO} & \cellcolor{black} & \cellcolor{black}\\ \hline \end{longtable} \end{center} \setlength\LTleft{0cm} %réinit marge à gauche \end{document}
  • Aperçu :
LaTeX | Multicolumns II

Images

Images avec légende

  • Code :
\documentclass{article} \usepackage{graphicx} % Required for including images \graphicspath{{C:/Users/std/Documents/LaTeX_Images/}} %root path to images \usepackage[font=small,labelfont=bf]{caption} % Required for specifying captions to tables and figures \begin{document} \begin{center} \includegraphics[width=120mm]{std/banniere.jpg} %std is a folder inside C:/Users/std/Documents/LaTeX_Images/ \captionof{figure}{shebangthedolphins.net - banner} \end{center} \end{document}
  • Aperçu :
LaTeX | Image

Images Ă  la droite du texte

  • Code :
\documentclass{article} \usepackage{wrapfig} %Right text images \usepackage{graphicx} % Required for including images \graphicspath{{C:/Users/std/Documents/LaTeX_Images/}} %root path to images \usepackage[font=small,labelfont=bf]{caption} % Required for specifying captions to tables and figures \begin{document} \begin{wrapfigure}{r}{0.45\textwidth} %this figure will be at the right \centering \includegraphics[width=0.20\textwidth]{EricCartman.png} \captionof{figure}{Eric Cartman} \includegraphics[width=0.25\textwidth]{ButtersStotch.png} \captionof{figure}{Butter Stotch} \end{wrapfigure} \section{South Park} \subsection{Introduction (Wikipedia)} \textbf{South Park} is an American animated sitcom created by Trey Parker and Matt Stone and developed by Brian Graden for Comedy Central. The series revolves around four boys—Stan Marsh, Kyle Broflovski, Eric Cartman, and Kenny McCormick—and their exploits in and around the titular Colorado town. The show became infamous for its profanity and dark, surreal humor that satirizes a wide range of topics towards a mature audience. Parker and Stone developed the show from The Spirit of Christmas, two consecutive animated shorts. The latter became one of the first Internet viral videos, ultimately leading to South Park's production. The pilot episode was produced using cutout animation, leading to all subsequent episodes being produced with computer animation that emulated the cutout technique. South Park features a very large ensemble cast of recurring characters. Since its debut on August 13, 1997, 308 episodes of South Park have been broadcast. It debuted with great success, consistently earning the highest ratings of any basic cable program. Subsequent ratings have varied but it remains one of Comedy Central's highest-rated shows and is slated to air new episodes through 2022. Since 2000, each episode has typically been written and produced in the week preceding its broadcast, with Parker serving as the primary writer and director. A one-hour special episode, titled "The Pandemic Special", premiered on September 30, 2020. South Park has received numerous accolades, including five Primetime Emmy Awards, a Peabody Award, and numerous inclusions in various publications' lists of greatest television shows. The show's popularity resulted in a feature-length theatrical film, South Park: Bigger, Longer \& Uncut which was released in June 1999, less than two years after the show's premiere, and became a commercial and critical success, and garnered a nomination for an Academy Award. In 2013, TV Guide ranked South Park the tenth Greatest TV Cartoon of All Time. \end{document}
  • Aperçu :
LaTeX | Image

Lignes de code

PowerShell

  • Code :

TĂ©lĂ©charger le fichier : latex-listings-powershell.tex et le placer dans le mĂȘme dossier que notre document .tex.

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[dvipsnames]{xcolor} \usepackage{listings} %needed for code parts % -- POWERSHELL \definecolor{lst-gray}{rgb}{0.98,0.98,0.98} \definecolor{lst-blue}{RGB}{40,0.0,255} \definecolor{lst-green}{RGB}{65,128,95} \definecolor{lst-red}{RGB}{200,0,85} \input{./latex-listings-powershell.tex} \lstdefinestyle{PowerShell} { commentstyle=\color{lst-green}, basicstyle=\small\ttfamily, backgroundcolor=\color{lst-gray}, breaklines=true, captionpos=b, columns=fixed, extendedchars=true, frame=single, framesep=2pt, keepspaces=true, keywordstyle=\color{lst-blue}, language={PowerShell}, numbers=left, numberstyle=\small\ttfamily, showstringspaces=false, stringstyle=\color{lst-red}, tabsize=2, } \lstnewenvironment{PowerShell} {\lstset{style=PowerShell}} {} % -- FIN POWERSHELL \begin{document} \begin{lstlisting}[style=PowerShell] $users = New-Object System.Collections.ArrayList [void] $users.AddRange( ("Bruce Wayne","Alfred Pennyworth","Selina KYLE")) $password = "ComplexP@ss908!" $addomain = "shebangthedolphins.net" \end{lstlisting} \end{document}
  • Aperçu :
LaTeX | PowerShell code

DOS

  • Code :
\documentclass{article} \usepackage[dvipsnames]{xcolor} \usepackage{listings} %needed for code parts % DOS (https://tex.stackexchange.com/questions/63961/how-to-accept-three-different-languages-on-lstlisting/63962#63962 et https://tex.stackexchange.com/questions/193470/how-to-show-similar-display-of-codes-of-different-programming-languages-in-latex) \lstdefinestyle{Common} { basicstyle=\scriptsize\ttfamily\null, numbers=left, numbersep=1em, frame=single, framesep=\fboxsep, framerule=\fboxrule, xleftmargin=\dimexpr\fboxsep+\fboxrule, xrightmargin=\dimexpr\fboxsep+\fboxrule, breaklines=true, breakindent=0pt, tabsize=5, columns=flexible, showstringspaces=false, captionpos=b,% or t for top (default) abovecaptionskip=0.5\smallskipamount, % there is also belowcaptionskip } \lstdefinestyle{DOS} { style=Common, backgroundcolor=\color{Black}, basicstyle=\color{White}\scriptsize\ttfamily, numbers=none, } \lstnewenvironment{DOS} {\lstset{style=dos}} {} % -- FIN DOS \begin{document} \begin{lstlisting}[style=dos] C:\Users\Administrator>fsutil file createnew test.txt 1048576000 \end{lstlisting} \end{document}
  • Aperçu :
LaTeX | Batch code

Code brut

  • Code :
\documentclass{article} \begin{document} \section{AutoIt Backup Script} \begingroup \fontsize{7pt}{9pt}\selectfont \begin{verbatim} #include <Date.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> [...] $SFolders[2] = "Personal" $SFolders[3] = "My Music" $SFolders[4] = "My Pictures" $SFolders[5] = "My Video" \end{verbatim} \endgroup \end{document}
  • Aperçu :
LaTeX | raw code

Code brut avec bordure

  • Code :
\documentclass{article} \usepackage{fancyvrb} \begin{document} \section{Cisco Configuration} \begingroup \fontsize{7pt}{9pt}\selectfont \begin{Verbatim}[frame=single] switch(config)#line console 0 switch(config-line)#exec-timeout 15 \end{Verbatim} \endgroup \end{document}
  • Aperçu :
LaTeX | raw code with border

Divers

Symboles

  • Copyright :
\begin{document} \section{Fairphone} \textbf{{Fairphone }\copyright} is a social enterprise company which aims to develop smartphones that are designed and produced with minimal environmental impact. \end{document}
  • Aperçu :
LaTeX | Copyright Symbol

Références http

  • Code :
\documentclass{article} \usepackage{url} \begin{document} \section{shebangthedolphins.net} Welcome to the \textbf{\#!the dolphins} webstite\footnote{\url{https://shebangthedolphins.net}}, this is all about \textbf{rock 'n' roll music/(noise)} and \textbf{tux}! I'm just an \textbf{alien} so there will be some \textbf{English mistakes}. Don't hesitate to contact me (my email : \textbf{admin} + \textbf{@} + \textbf{shebangthedolphins.net}), in order to correct them or just to say hi! :) We can write url like this : \url{https://shebangthedolphins.net} \end{document}
  • Aperçu :
LaTeX | url reference

Mode Paysage

  • Code :
\documentclass{article} \usepackage{lscape} %permet de positionner des pages en mode landscape \usepackage[font=small,labelfont=bf]{caption} % Required for specifying captions to tables and figures \usepackage{graphicx} % Required for including images \begin{document} \begin{landscape} \section{RDS MFA} \begin{center} \centerline{\includegraphics[width=175mm]{rds_mfa.png}} \captionof{figure}{RDS MFA} \end{center} \end{landscape} \end{document}
  • Aperçu :
LaTeX | landscape

En-tĂȘte

En-tĂȘte centrĂ© avec bordures rouges, façon Top Secret.

  • Code :
\documentclass{article} \usepackage[dvipsnames]{xcolor} \usepackage{fancyhdr} %en-tĂȘte \pagestyle{fancy} \renewcommand\fbox{\fcolorbox{red}{white}} %red border %\fancyhf{} % clear all header and footer fields \renewcommand{\headrulewidth}{0pt} %remove header black bar \chead{\fbox{\textcolor{Red}{\textbf{TOP SECRET}}}} \rhead{} %clear auto right header
  • Aperçu :
LaTeX | top secret header
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

adresse mail de contact