更改项目符号的颜色

更改项目符号的颜色

在下面的代码中,我想将项目符号的默认颜色从黑色更改为带阴影的蓝色。你能帮我实现这个吗?

以下是代码:

\documentclass{book}
\usepackage{enumitem}
\usepackage{amsmath,amsfonts,amssymb,amsthm, bm}
\usepackage{xcolor}

\begin{document}
\begin{itemize}[label={$\blacktriangleright$}]
\item First item in the list
\item Second item
\item and so on
\end{itemize}
\end{document}

答案1

不使用新包的解决方案,仅此而已xcolor

您可以使用此处创建的命令为任何符号或文本添加阴影\ourshadow

在此处输入图片描述输出

代码

\documentclass{book}
\usepackage{enumitem}
\usepackage{amsmath,amsfonts,amssymb,amsthm, bm}
\usepackage{xcolor}

\newlength{\tmpShadow}
\newcommand{\ourShadow}[2]{%
    \settowidth{\tmpShadow}{#1}
    \addtolength{\tmpShadow}{.1em}
    \raisebox{-0.25ex}{\textcolor{gray!70}{#1}}%
    \kern-\tmpShadow%
    \textcolor{#2}{#1}%
}

\begin{document}
\begin{itemize}[label={\ourShadow{$\blacktriangleright$}{blue!80}}]
\item First item in the list
\item Second item
\item and so on
\end{itemize}



\end{document}

答案2

这里有两个选项tikz

在此处输入图片描述

代码:

\documentclass{book}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows}

\newcommand*{\MyShadow}{\tikz \draw [baseline, fill=blue,draw=blue,circular drop shadow] circle (2pt);}
\newcommand*{\MyBall}{\tikz \draw [baseline, ball color=red, draw=red] circle (2pt);}

\begin{document}

\begin{itemize}[label={\MyShadow}]
\item First item in the list
\item Second item
\end{itemize}
\begin{itemize}[label={\MyBall}]
\item First item in the 
\item Second item
\end{itemize}
\end{document}

相关内容