Skip to content

Instantly share code, notes, and snippets.

@luctrudeau
Last active April 5, 2016 21:54
Show Gist options
  • Save luctrudeau/990d99d26b935e8873984e6600ad24a3 to your computer and use it in GitHub Desktop.
Save luctrudeau/990d99d26b935e8873984e6600ad24a3 to your computer and use it in GitHub Desktop.
VimGolf: One number per line
\documentclass[preview]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[canadian]{babel}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{subfig}
\begin{document}
\includegraphics[scale=0.25]{vim_golf_logo.png} \textbf{VimGolf} \\ \\
% ======= STORE/BOX LISTINGS =======
\vspace{-4em}
\textbf{Defis:}
\newsavebox{\firstlisting}
\begin{lrbox}{\firstlisting}% Store first listing
\begin{lstlisting}
- One number per line -
-----------------------
2,3,5,7,
11,13,17,
19,23,29,
\end{lstlisting}
\end{lrbox}
\newsavebox{\secondlisting}
\begin{lrbox}{\secondlisting}% Store second listing
\centering
\begin{lstlisting}
2
3
5
7
11
13
17
19
23
29
\end{lstlisting}
\hspace{3cm}
\end{lrbox}
\begin{figure}[h]
\captionsetup[subfigure]{labelformat=empty}y
\subfloat[Fichier de départ]{\usebox{\firstlisting}}\hspace{2cm}%
\subfloat[Fichier final]{\usebox{\secondlisting}}
\end{figure}
\vspace{-2em}
\textbf{Solution ML2:}
\[
{\color{blue}\underbrace{2D}_{\substack{\text{Efface} \\ \text{2 lignes}}}}
{\color{Mulberry}\overbrace{gJ.}^{\substack{\text{Tout sur} \\ \text{une ligne}}}}
{\color{OliveGreen}\underbrace{:s/,/\text{\textbackslash}r/g<CR>}_{\substack{\text{Substitution de , par} \\ \text{saut de ligne}}}}
{\color{WildStrawberry}\overbrace{dd}^{\substack{\text{Efface} \\ \text{dernière} \\ \text{ligne} }}}
{\color{YellowOrange}\underbrace{ZZ}_{\substack{\text{Sauvegarde} \\ \text{fermeture}}}}
\]
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment