Skip to content

Instantly share code, notes, and snippets.

@gwpl
Last active May 9, 2016 20:43
Show Gist options
  • Save gwpl/5128cb3cd348c38492da59800b6ab3f2 to your computer and use it in GitHub Desktop.
Save gwpl/5128cb3cd348c38492da59800b6ab3f2 to your computer and use it in GitHub Desktop.
standalone_verbatim.tex is parametrized tex template, that genrates cropped pdf containing given text verbatim of given file in monospace. Just compile below, or get some ascii art penguin into penguin.txt (e.g. from: http://chris.com/ascii/index.php?art=logos%20and%20insignias/linux ) and run: $ pdflatex '\def\txtfile{penguin.txt} \input{standa…
% Following standalone configuration: http://tex.stackexchange.com/a/94395/7128
\documentclass[varwidth=\maxdimen]{standalone}
% Usage: pdflatex '\def\txtfile{input.txt} \input{this_document_template.tex}'
% Example pdflatex '\def\txtfile{penguin.txt} \input{standalone_verbatim.tex}'
\usepackage{verbatim}
\begin{document}
% following http://tex.stackexchange.com/a/1495/7128
\ifdefined\txtfile
%
%Specified file: \txtfile
%
\verbatiminput{\txtfile}
\else
\begin{verbatim}
/\
/ \
/ \
/ \
/ \
| |
| Please |
| define |
| txtfile |
| |
|__________|
Usage: pdflatex '\def\txtfile{input.txt} \input{this_document_template.tex}'
example: pdflatex '\def\txtfile{penguin.txt} \input{standalone_verbatim.tex}'
_
/ \
\_/
\end{verbatim}
\fi
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment