如何在列表中设置不同的颜色?

如何在列表中设置不同的颜色?

我想将列表分成三种不同的颜色。该怎么做? 在此处输入图片描述

我读过了Peter Grill 的回答并像这样应用它:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[svgnames]{xcolor}
\usepackage{remreset}
\usepackage{bera}
\usepackage{geometry}
\usepackage{listings}

\lstset{language=[LaTeX]TeX,
basicstyle=\color{DarkSlateGray}\small,
texcsstyle=\bf\color{Aquamarine},
identifierstyle=\color{Crimson}\bfseries,
stringstyle=\color{brown}\ttfamily,
columns=fullflexible,
breaklines=true,
escapeinside=<>,{},
keywordstyle=\color{teal},
stringstyle=\color{brown}\ttfamily,
commentstyle=\color{cyan},
morekeywords={},
otherkeywords={$,\{ ,\} , [ , ], & },
moretexcs={maketitle, subsection, subsubsection, appendix, tableofcontents,includegraphics},
}

\begin{document}
\section*{How to set different color in listing}
\begin{lstlisting}
\perintahbeamer[<argumen opsional>]{<argumen pertama>}{<argumen kedua>}
\end{lstlisting}

\end{document}

答案1

你确实应该澄清你的问题,但这是我试图给出的答案。这是你想要的吗?

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage[svgnames,dvipsnames]{xcolor}
\usepackage{bera}
\usepackage{listings}

\lstset{language=[LaTeX]TeX,
basicstyle=\color{DarkSlateGray}\small,
texcsstyle=\bf\color{Aquamarine},
identifierstyle=\color{Crimson}\bfseries,
moredelim=[s][\color{ForestGreen}]{\{}{\}},
moredelim=[s][\color{blue}]{[}{]},
keywordstyle=\color{teal},
stringstyle=\color{brown}\ttfamily,
commentstyle=\color{cyan},
morekeywords={},
otherkeywords={$,\& },
moretexcs={maketitle, subsection, subsubsection, appendix, tableofcontents,includegraphics},
}

\begin{document}
\section*{How to set different color in listing}
\begin{lstlisting}
\perintahbeamer[<argumen opsional>]{<argumen pertama>}{<argumen kedua>}
\end{lstlisting}

\end{document}

相关内容