11

I want to show terminal commands as well as command prompt commands (windows) and was wondering what is the best way to format these in latex.

1 Answer 1

20

enter image description here

\documentclass{article}

\usepackage{xcolor}
\usepackage{listings}


\lstdefinestyle{DOS}
{
    backgroundcolor=\color{black},
    basicstyle=\scriptsize\color{white}\ttfamily
}

\begin{document}
Hi, I am Garbage Collector!
\begin{lstlisting}[style=DOS]
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

c:\User\Garbage Collector>
\end{lstlisting}
\end{document}
6
  • Nice. I trust the listings package lets the user change the color scheme (as you can do in windows) for printing something other than white text on black. Aug 6, 2012 at 20:01
  • @EthanBolker Yes it does. I can just change the background color etc to get a nice looking terminal Aug 6, 2012 at 20:22
  • 1
    Your screenshot made me smile. :) Aug 7, 2012 at 1:14
  • 1
    @GarbageCollector: Also the c above is lower case...it is actually upper case in cmd's window. Aug 16, 2012 at 16:49
  • 3
    @GarbageCollector; I was just saying that to again point out that your post isn't a screen shot. It's further proof! Aug 16, 2012 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.