I have a an itemize
environment in LaTeX. How can I represent a tick and a cross symbol instead of a dot?
3 Answers
With the enumitem
package you can use label={}
to specify it on a per instance basis, or use \setlist[itemize,<n>]{label=<symbol>}
to set it based on the nesting level, where:
<symbol>
is to be used at the given nesting level <n>
:
Here I have used the \checkmark
from the amsfonts
package, but you can use any symbol you like.
References:
- If you need depper lists see A five level deep list.
Code:
\documentclass{article}
\usepackage{enumitem}
\usepackage{amsfonts}
\setlist[itemize,1]{label=$\times$}
\setlist[itemize,2]{label=$\checkmark$}
\setlist[itemize,3]{label=$\diamond$}
\setlist[itemize,4]{label=$\bullet$}
\begin{document}
\begin{itemize}[label={$\bullet$}]
\item foo
\end{itemize}
\begin{itemize}[label={\checkmark}]
\item bar
\end{itemize}
\begin{itemize}
\item foo
\begin{itemize}
\item bar
\begin{itemize}
\item abc
\begin{itemize}
\item def
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}
\begin{itemize}
\item bar
\end{itemize}
\end{document}
Without the enumitem
package you could use \renewcommand{\labelitem<n>}{<symbol>}
to redefine the marker, where <n>
is a roman numeral (i
, ii
, iii
, or iv
) representing the nesting depth of itemize
. The following yields a similar result to above:
\documentclass{article}
\usepackage{amsfonts}
\begin{document}
\renewcommand{\labelitemi}{$\bullet$}
\begin{itemize}
\item foo
\end{itemize}
\renewcommand{\labelitemi}{$\checkmark$}
\begin{itemize}
\item bar
\end{itemize}
\renewcommand{\labelitemi}{$\times$}
\renewcommand{\labelitemii}{$\checkmark$}
\renewcommand{\labelitemiii}{$\diamond$}
\renewcommand{\labelitemiv}{$\bullet$}
\begin{itemize}
\item foo
\begin{itemize}
\item bar
\begin{itemize}
\item abc
\begin{itemize}
\item def
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}
\begin{itemize}
\item bar
\end{itemize}
\end{document}
I recommend the enumitem
package too, but your task can be done without it, by supplying the \item
command with its optional argument
\documentclass{article}
\usepackage{amsfonts} % for the \checkmark command
\begin{document}
\begin{itemize}
\item[\checkmark] foo
\item[$\times$] bar
\end{itemize}
\end{document}
Building on @cmhughes solution, if you have a long list of item , you can define commands as shortcuts:
\documentclass{article}
\usepackage{amssymb}
\newcommand{\done}{\item[\checkmark]}
\newcommand{\crossed}{\item[$\times$]}
\begin{document}
\begin{itemize}
\done this is done
\crossed this is still not done
\crossed this is also not done
\done but this is
\end{itemize}
\end{document}
-
do you need the
enumitem
package then? :) best to keep code samples as minimal as possible :)– cmhughesMar 14, 2012 at 17:56 -
Hmm no actually you don't, somehow I mistakenly assumed that specifying the label after the item definition was an
enumitem
thing, but it is not. Thanks, answer updated. Mar 14, 2012 at 18:03