我想改变 上的项目符号颜色itemize
。该怎么做?
答案1
\item
可以使用可选参数并使用与-或\item[..]
相同的标签来更改颜色。itemize
$\bullet$
\textbullet
要更改默认设置,您可以提供更新的label
环境,也可以使用以下命令itemize
创建自己的环境:\newlist
\setlist
\documentclass{article}
\usepackage{enumitem,xcolor}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
A list with a specific \verb|\item| changed:
\begin{itemize}
\item First item
\item[\textcolor{blue}{\textbullet}] Second item
\item Last item
\end{itemize}
Default \verb|itemize| list with updated \verb|label|:
\begin{itemize}[label=\textcolor{blue}{\textbullet}]
\item First item
\item Second item
\item Last item
\end{itemize}
Completely new list \verb|coloritemize|:
\newlist{coloritemize}{itemize}{1}
\setlist[coloritemize]{label=\textcolor{blue}{\textbullet}}
\begin{coloritemize}
\item First item
\item Second item
\item Last item
\end{coloritemize}
\end{document}
您可以进一步自定义输出以使用您选择的颜色。以下是其中一个选项:
\documentclass{article}
\usepackage{enumitem,xcolor}
\newlist{coloritemize}{itemize}{1}
\setlist[coloritemize]{label=\textcolor{itemizecolor}{\textbullet}}
\colorlet{itemizecolor}{.}% Default colour for \item in itemizecolor
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
\colorlet{itemizecolor}{red}
\begin{coloritemize}
\item First item
\item Second item
\item Last item
\end{coloritemize}
\colorlet{itemizecolor}{blue}
\begin{coloritemize}
\item First item
\item Second item
\item Last item
\end{coloritemize}
\end{document}
答案2
您也可以使用以下解决方案(例如,如果您想全局更改项目列表的样式,但不想更新命令以继续使用其可选参数):
\renewcommand{\labelitemi}{$\textcolor{blue}{\bullet}$}
\renewcommand{\labelitemii}{$\textcolor{blue}{\cdot}$}
\renewcommand{\labelitemiii}{$\textcolor{blue}{\diamond}$}
\renewcommand{\labelitemiv}{$\textcolor{blue}{\ast}$}