3

The below works, but produces an error message Something's wrong--perhaps a missing \item. Does anybody know why it throws an error, and how to correct my code?

\documentclass{article}
\usepackage{enumitem,amssymb}
\usepackage{multicol}
\newlist{todolist}{itemize}{2}
\setlist[todolist]{label=$\square$}

\newenvironment{Ckcol}[1]{\begin{multicols}{#1}%
        \begin{itemize}%
        \begin{todolist}}%
              {\end{todolist}%
                \end{itemize}%
                           \end{multicols}}
\begin{document}

   \begin{Ckcol}{3}

    \item  item 1 
    \item  item 2 
    \item  item 3 
    \item  item 4 
    \item  item 5  
    \item  item 6

   \end{Ckcol}

\end{document}

Output:

enter image description here

I started working on this trying to solve this question: Side by side checkboxes

5
  • 1
    \begin{todolist} is not an \item which is expected by itemize. Why do you need the outer itemize at all?
    – user31729
    May 31 '16 at 17:45
  • 1
    Bypass, but not really good: \newenvironment{Ckcol}[1]{\begin{multicols}{#1}% \begin{itemize}% \item[]\begin{todolist} }% {\end{todolist}% \end{itemize}% \end{multicols} }
    – user31729
    May 31 '16 at 17:51
  • 1
    \newenvironment{Ckcol}[1]{\begin{multicols}{#1}% \begin{itemize}[label=$\square$]% }{% \end{itemize}% \end{multicols}} May 31 '16 at 17:52
  • 1
    Removing the itemize environment produces the same result without complaining… But you can obtain the same result with the tasks package, which has more possibilities (items stretching over several columns, for instance).
    – Bernard
    May 31 '16 at 17:55
  • Thank you all for the great comments, and for the great alternatives. If anyone would care to summarize I will gladly pick it as the answer.
    – A Feldman
    May 31 '16 at 17:57
2

The itemize (and enumerate etc. as well) environment deliberately expects an \item command to work, this isn't provided by todolist.

It can be cured by giving an \item[] with empty label, but this might shift the whole list to the right margin, but in total, the outer itemize environment isn't necessary at all!

A better way, numbering from left to right is using tasks.

\documentclass{article}
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{tasks}
\newlist{todolist}{itemize}{2}
\setlist[todolist]{label=$\square$}%

\newenvironment{Ckcol}[1]{\begin{multicols}{#1}%
    \begin{itemize}%
      \item[]\begin{todolist}
      }%
      {\end{todolist}%
    \end{itemize}%
  \end{multicols}
}
\begin{document}

   \begin{Ckcol}{3}
    \item  item 1 
    \item  item 2 
    \item  item 3 
    \item  item 4 
    \item  item 5  
    \item  item 6
   \end{Ckcol}

\begin{tasks}(3)
\task Foo 1
\task Foo 2
\task Foo 3
\task Foo 4
\task Foo 5
\task Foo 6
\end{tasks}


\end{document}
0

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.