16

How can I change the color of bullets in a book?

\documentclass{book}
\usepackage{pifont}
\usepackage{xcolor}
\definecolor{myblue}{RGB}{0,29,119}

\begin{document}

\begin{dinglist}{110}
  \item{Sample text}

  \begin{dinglist}{228}
    \item{Sample text}

   \begin{dinglist}{227}
     \item{Sample text}

   \end{dinglist}
  \end{dinglist}
\end{dinglist}

\end{document}

enter image description here

  • Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. – Claudio Fiandrino Apr 22 '13 at 18:54
10

you can define custom item commands:

\documentclass{book}
\usepackage{pifont}
\usepackage{xcolor}
\definecolor{myblue}{RGB}{0,29,119}

\newcommand{\bsquare}{\item[\color{myblue}\ding{110}]} 
\newcommand{\barrow}{\item[\color{myblue}\ding{228}]}
\newcommand{\bwarrow}{\item[\color{myblue}\ding{227}]}

\begin{document}

\begin{dinglist}{110}
  \bsquare{Sample text}

  \begin{dinglist}{228}
    \barrow{Sample text}

   \begin{dinglist}{227}
     \bwarrow{Sample text}

   \end{dinglist}
  \end{dinglist}
\end{dinglist}

\end{document}

or as per Christoph B comment (same preamble):

\begin{document}

\begin{itemize}
  \bsquare Sample text

  \begin{itemize}
    \barrow Sample text

   \begin{itemize}
     \bwarrow Sample text

   \end{itemize}
  \end{itemize}
\end{itemize}
\end{document}

enter image description here

| improve this answer | |
  • Normal itemize environments should suffice, making your solution independent of the pifont package. – Christoph B. Apr 22 '13 at 18:51
19

The following MWE provides \itemcolor{<colour>} that allows you to set the colour of the list item as you wish:

enter image description here

\documentclass{article}
\usepackage{pifont,xcolor}% http://ctan.org/pkg/{pifont,xcolor}
\definecolor{myblue}{RGB}{0,29,119}
\newcommand{\itemcolor}[1]{% Update list item colour
  \renewcommand{\makelabel}[1]{\color{#1}\hfil ##1}}
\begin{document}

\begin{dinglist}{110}
  \itemcolor{myblue}
  \item Sample text
  \begin{dinglist}{228}
    \itemcolor{green!70}
    \item Sample text
    \itemcolor{red!50}
    \item Sample text
    \begin{dinglist}{227}
      \item Sample text
   \end{dinglist}
  \end{dinglist}
\end{dinglist}

\end{document}

enumitem provides a list-wise hook into the items via the label key-value:

enter image description here

\documentclass{article}
\usepackage{enumitem,pifont,xcolor}% http://ctan.org/pkg/{enumitem,pifont,xcolor}
\definecolor{myblue}{RGB}{0,29,119}
\begin{document}

\begin{itemize}[label={\color{myblue}\Pifont{pzd}{\char110}}]
  \item Sample text
  \begin{itemize}[label={\color{green}\Pifont{pzd}{\char228}}]
    \item Sample text
    \item Sample text
    \begin{itemize}[label={\color{red!50}\Pifont{pzd}{\char227}}]
      \item Sample text
   \end{itemize}
  \end{itemize}
\end{itemize}

\end{document}

As usual, you don't have to define these lists at the document level. It can be done within the preamble, separating structure from content. See the enumitem documentation (section 5 Global settings, p 9) and the use of \setlist[<list type + level>]{<format>}.

| improve this answer | |
1

You can hack into pifont and redeclare one of its commands, for example \Pisymbol:

\documentclass{book}
\usepackage{pifont}
\usepackage{xcolor}
\definecolor{myblue}{RGB}{0,29,119}

\newcommand{\myPisymbolformatcommand}{}

\newcommand{\hackintoPisymbol}[1]{%
\renewcommand{\myPisymbolformatcommand}{#1}
}

\renewcommand{\Pisymbol}[2]{{\Pifont{#1}\myPisymbolformatcommand\char#2}}

\begin{document}

\begin{dinglist}{110}
  \item{Sample text}

  \begin{dinglist}{228}\hackintoPisymbol{\color{myblue}}
    \item{Sample text}

   \begin{dinglist}{227}
     \item{Sample text}

   \end{dinglist}
  \end{dinglist}
\end{dinglist}

\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.