答案1
作为沃纳已经提到,您可以使用listings
包产生类似的输出;一个小例子(参考包文档来了解它提供的所有定制可能性):
\documentclass{article}
\usepackage{pgfplots}
\usepackage{listings}
\usepackage{xcolor}
\definecolor{myblue}{RGB}{63,88,167}
\definecolor{mygray}{RGB}{204,202,229}
\lstset{ language=[LaTeX]TeX,
basicstyle=\ttfamily,
keywordstyle=\color{myblue},
morekeywords={addplot,coordinates,legend,axis,tikzpicture},
backgroundcolor=\color{mygray},
texcsstyle=*\color{black}
}
\begin{document}
\begin{lstlisting}
\begin{tikzpicture}
\begin{axis}[grid=major,width=6cm]
\addplot [thick,blue]
coordinates {(1,0.0000001) (2,0.0065) (3,0.1) (4,0.9)};
\end{axis}
\end{tikzpicture}
\end{lstlisting}
\end{document}