开发者

LaTeX: changing the fonts inside figures

开发者 https://www.devze.com 2023-03-27 18:51 出处:网络
I am using some terminal output as a figure in a report I am writing and need to change just the text within the figure to monospace.

I am using some terminal output as a figure in a report I am writing and need to change just the text within the figure to monospace.

\begin{figure}[ht]

%bunch of text here

\caption{Mass calculation program output}       开发者_开发知识库    
\label{fig:calcMass}                                
\end{figure}    


Take a look at the (usually built-in) listings package. A tutorial can be found here.

The package includes syntax highlighting (if you're using bash) and can read input from external files (which can be useful if you're documenting a program you're writing and don't want to manually change the LaTeX code if you make a change in the program).


The verbatim environment usually does a good job at that:

\begin{verbatim}# cd /
# rm -rf *
# reboot
bash: reboot: command not found
\end{verbatim}

The environment also prevents special treatment of any TeX commands.

0

精彩评论

暂无评论...
验证码 换一张
取 消