Terminal screenshot generator
Something like this? (Actually stolen from tcolorbox
manual and slightly changed ;-))
A verbatim
input environment is necessary in my point of view, so a listings
etc. style approach might be very convenient.
The tcolorbox
wrappers of listings
provide nice features to improve the look of the surroundings of a listings
environment.
Use the every listings line=
option to provide some information like hostname
or user name
etc, depending on your special terminal
style.
\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcblisting{commandshell}{colback=black,colupper=white,colframe=yellow!75!black,
listing only,listing options={language=sh},
every listing line={\textcolor{red}{\small\ttfamily\bfseries DeathStar \$> }}}
\begin{document}
\begin{commandshell}
ls -al
cd /usr/lib
rm -rf *
\end{commandshell}
\end{document}
Knitr can show not only outputs from R, but also from another engines. May be this is not the ideal approach to mimic a real screenshot, but can show the true outputs of a bash
shell typing only the commands.
\documentclass{article}
\usepackage{xcolor}
%\usepackage[black]{sourcecodepro}
\begin{document}
\section*{Top Linux utilities:}
\subsection*{fortune}
<<eval=F,background='lightyellow',>>=
me@mypc$ fortune
@
\noindent\fcolorbox{green}{black}{
\parbox{\linewidth}{\color{white}\sffamily
<<engine='bash', echo=F, results="asis">>=
fortune fortunes
@
}}
\subsection*{apt-get moo}
<<engine='bash'>>=
apt-get moo
@
\subsection*{cowsay}
<<eval=F>>=
cowsay "Hello, World"
@
<<engine='bash', background='lightcyan', comment="",echo=F>>=
cowsay "Hello, World"
@
\end{document}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{listingsutf8}
\def\CS#1{\texttt{\textbackslash#1}}
\usepackage[most]{tcolorbox}
\newtcblisting{commandshell}{colback=black,colupper=white,colframe=yellow!75!black,
listing only,listing options={style=tcblatex,language=sh},
every listing line={\textcolor{red}{\small\ttfamily\bfseries DeathStar \$> }}}
\begin{document}
\begin{commandshell}
ls -al
cd /usr/lib
rm -rf *
\end{commandshell}
\begin{lstlisting}[escapechar=ä,numbers=none,framerule=0.0pt]
ä\colorbox{black}{%
\parbox{5.7in}{\color{white} C:\CS{}>cd \CS{}Python27 \\ C:\CS{}Python27>cd scripts \\ C:\CS{}Python27\CS{}Scripts>easy\_install pygmentize}
}
\end{lstlisting}
\end{document}
The solution of Christian is still included.