![将字体样式设置为 Courier New,并将字体大小设置为 10pt](https://linux22.com/image/311849/%E5%B0%86%E5%AD%97%E4%BD%93%E6%A0%B7%E5%BC%8F%E8%AE%BE%E7%BD%AE%E4%B8%BA%20Courier%20New%EF%BC%8C%E5%B9%B6%E5%B0%86%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F%E8%AE%BE%E7%BD%AE%E4%B8%BA%2010pt.png)
我想将framed
环境中的字体从 Times New Roman 更改为 Courier New,并且字体大小应为 10pt。
这是我当前的编码:
\begin{lstlisting}
define("USE_PCONNECT", false);
####### LOCAL CONFIGARATION #######
define("SERVER","localhost");
define("USER","root");
define("PASSWORD","");
define("DB","learning");
\end{lstlisting}
在我的文档文件中:
\usepackage{listings}
\lstset{
numberstyle=\small,
numbersep=10pt,
frame = single,
language=PHP
}
答案1
除了有关如何提问的提示之外,这里还有一个可能的解决方案:
\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\lstset{%
basicstyle = \fontfamily{pcr}\fontsize{10pt}{12pt}\selectfont ,
numberstyle = \small ,
numbersep = 10pt ,
frame = single ,
language = PHP
}
\begin{document}
\begin{lstlisting}
define("USE_PCONNECT", false);
####### LOCAL CONFIGARATION #######
define("SERVER","localhost");
define("USER","root");
define("PASSWORD","");
define("DB","learning");
\end{lstlisting}
\end{document}