My personal LaTeX notes

Introduction

I often use LaTeX to make my own reports. I will use this page as a personal reminder, hope it will help other people.

Front Page

\documentclass{article}
\usepackage[utf8]{inputenc}
\author{shebangthedolphins.net}
\title{My Title}

\begin{document}
\maketitle
\end{document}
LaTeX | Front Page
\begin{document}
\maketitle
\newpage
\tableofcontents
\newpage
\end{document}

Bullets

\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}
LaTeX | Bullets items

Tables

Multipage tables

\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}
LaTeX | Array

Tables with Multicolumn

\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}
LaTeX | Multicolumn

Images

Images with caption

\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}
LaTeX | Image

Images at the right of the text

\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}
LaTeX | Image

Lines of code

PowerShell

Download this file : latex-listings-powershell.tex and put it in the same folder as your .tex document.

\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}
LaTeX | PowerShell code

DOS

\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}
LaTeX | Batch code

raw 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
LaTeX | raw code

Miscellaneous

Symbols

\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}
LaTeX | Copyright Symbol

http reference

\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}
LaTeX | url reference

Landscape

\documentclass{article}
\usepackage{lscape} %landscape module
\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}
LaTeX | landscape

Header

Header text centered in a red box. Top Secret style.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{fancyhdr} %header
\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
LaTeX | top secret header
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :