提问于:
浏览数:
3516
```tex
\documentclass[11pt,a4paper]{ctexart}
\usepackage{listings} %插入代码
\usepackage{xcolor} %代码高亮
%插入代码“listing”设置
\lstset{
numbers=left, %设置行号位置;
numberstyle={\tiny\color{lightgray}},
stringstyle=\color{orange},%字符串颜色
keywordstyle=\color{magenta},%设置关键字颜色
commentstyle=\color{gray},%设置注释颜色
}
\begin{document}
\section{第一节}
\begin{lstlisting}[language=R]
#各层样本户拥有汽车的情况
x1 = c(0,0,0,1,0,0,0,1,0,0)
x2 = c(0,1,0,0,0,0,0,0,1,0)
x3 = c(1,1,0,0,0,0,1,0,1,0)
x4 = c(1,0,0,0,0,0,0,0,0,0)
\end{lstlisting}
\end{document}
```
怎样调节,可以改变代码块中数字的颜色呢?
![](https://pics.latexstudio.net/data/images/202003/7f72b9332825f58.png)