82

I am having trouble trying to create a simple to-do list in LaTex. Basically, what I want is a list with empty squares/boxes down the left side instead of bullets, numbers, letters, etc.

Here is what I have been playing around with:

%%To do list%%

\documentclass[12pt]{article} \usepackage[utf8]{inputenc} \usepackage{enumerate} %\setenumerate[0]{label=(\square*)} %\usepackage{enumitem} \usepackage[checklist]{enumitem} \renewcommand{\theenumi}{\square{enumi}}

%\renewcommand{\labelitemi}{$\Box$} %\renewcommand{\labelitemi}{$\star$} \renewcommand{\labelenumi}{\theenumi}

\begin{document} My todo list.\ Immediate plan of action.\

\let\oldenumerate\enumerate \renewcommand{\enumerate}{ \oldenumerate \setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \setlength{\parsep}{0pt} }

\begin{enumerate}
    \item List item 1 goes here.  
    \item List item 2 goes here. 
        \begin{enumerate}
            \item Sublist item 1 goes here. 
            \item Sublist item 2 goes here. 
        \end{enumerate}
    \item List item 3 goes here
    \item List item 4 goes here.
\end{enumerate}

\end{document}

I have tried placing the new command after \begin{enumerate} in a few different ways, even tried to place it before and after \item, but nothing seems to work. I can get the list to enumerate with circles, stars, diamonds, etc. but for some reason, not the box/square. What am I doing wrong?

I have been using LaTex for nearly a decade now and know there are more-often-then not numerous ways to achieve the same goal with LaTex, yet, I cannot figure this one out.

jaykeno
  • 823

4 Answers4

122

Here is a variant of Werner's answer with checkmarks for recording progress.

\documentclass{article}
\usepackage{enumitem,amssymb}
\newlist{todolist}{itemize}{2}
\setlist[todolist]{label=$\square$}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand{\done}{\rlap{$\square$}{\raisebox{2pt}{\large\hspace{1pt}\cmark}}%
\hspace{-2.5pt}}
\newcommand{\wontfix}{\rlap{$\square$}{\large\hspace{1pt}\xmark}}

\begin{document}
My ToDo list

\begin{itemize}
  \item Immediate plan of action.
  \begin{todolist}
  \item[\done] Frame the problem
  \item Write solution
  \item[\wontfix] profit
  \end{todolist}
\end{itemize}
\end{document}

enter image description here

Joe Corneli
  • 4,340
71

I would use enumitem (and not intermix it with using the enumerate package):

enter image description here

\documentclass{article}
\usepackage{enumitem,amssymb}
\newlist{todolist}{itemize}{2}
\setlist[todolist]{label=$\square$}
\begin{document}
My ToDo list

\begin{itemize}
  \item Immediate plan of action.

  \begin{todolist}
    \item List item 1 goes here.
    \item List item 2 goes here.
    \begin{todolist}
      \item Sublist item 1 goes here.
      \item Sublist item 2 goes here.
    \end{todolist}
    \item List item 3 goes here
    \item List item 4 goes here.
  \end{todolist}

\end{itemize}
\end{document}

We create a new type of list called todolist, which has two levels of nesting and is based on itemize. Each label within a todolist is set as $\square$, at both levels.

Werner
  • 603,163
  • @samcarter; thank you cleaning up my first post. @Werner; thank you for the code, it is appreciated and what I was looking for. – jaykeno May 29 '15 at 20:22
  • 3
    If one does not want to use $\square$ (for example in a pandoc template) one can also use the following: \newcommand{\checkbox}{\text{\fboxsep=-.15pt\fbox{\rule{0pt}{1.5ex}\rule{1.5ex}{0pt}}}} and then replace all $\square$ with \checkbox. – Zelphir Kaltstahl Oct 12 '16 at 16:50
  • that works fine! I use the \tightlist-command in my other lists. It works here, too - just not at the end of the first-level-list before starting the 2nd-level-list. Any idea how to solve that? – PikkuKatja Sep 10 '20 at 10:07
10

I adjust the font size of the icon from packages pifont and amssymb, use \raisebox and \hspace to fit the icon position, finally, it looks good, here is a full example:

\documentclass{article}

\usepackage{pifont}
\usepackage{amssymb}

\begin{document}

\begin{itemize}
\item[$\square$]
no checked
\item[\rlap{\raisebox{0.3ex}{\hspace{0.4ex}\tiny \ding{52}}}$\square$]
failed
\item[\rlap{\raisebox{0.3ex}{\hspace{0.4ex}\scriptsize \ding{56}}}$\square$]
checked
\end{itemize}
\end{document}

enter image description here

Sailist
  • 101
0

I wanted something super simple with no package dependencies. This worked for me:

\begin{itemize}[label={}]
    \item \lbrack\_\rbrack unchecked
    \item \lbrack x\rbrack checked
\end{itemize}
  • It would be nice, to not only show the itemize environment, but a minimal working example, starting with \documentclass and ending with \end{docment} (see the other answers). You should at least explain, which packages are needed for your suggestion. Without at least beginners would have problems in trying to use your code. – cabohah May 16 '23 at 07:48
  • The point is NO packages are required at all. To my knowledge this itemize snippet can be cut and pasted into any LaTeX doc and it will work. – SpeedCoder5 May 20 '23 at 19:37
  • 2
    The standard LaTeX kernel environment itemize does not provide options to the environment itself. So you need either a class, that provides it or a package. However, if you think, your code does work with, e.g., article class without any package, show this, to show LaTeX beginners that it is such easy. But here I get: “LaTeX Error: Something's wrong--perhaps a missing \item.” if I only add \documentclass{article}\begin{document} before your code and \end{document} after it. – cabohah May 22 '23 at 07:02