I just create a simple check list following the way described here: How do I generate a check-list?, My code is below:
\documentclass[a4paper,notitlepage]{article}
\usepackage[]{ctex}
\setCJKmainfont{SimSun}
\usepackage{graphicx}
\usepackage[twocolumn]{geometry}
\usepackage{amssymb}
\usepackage{array}
\newcounter{rowno}
\setcounter{rowno}{0}
\usepackage[export]{adjustbox} % draw frame of the image
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm,headheight=1cm,headsep=1cm,footskip=1cm}
\usepackage{wasysym}
\setlength{\marginparwidth}{1.2in}
\let\oldmarginpar\marginpar
\renewcommand\marginpar[1]{\-\oldmarginpar[\raggedleft #1]%
{\raggedright #1}}
\newenvironment{checklist}{%
\begin{list}{}{}% whatever you want the list to be
\let\olditem\item
\renewcommand\item{\olditem -- \marginpar{$\Box$} }
\newcommand\checkeditem{\olditem -- \marginpar{$\CheckedBox$} }
}{%
\end{list}
}
\begin{document}
\begin{checklist}
\checkeditem Open the \TeX book
\checkeditem Find the good page
\item Try to understand
\end{checklist}
\end{document}
The question is, here I use twocolumn option, but you see the checkitem box was put on the left, why? Can you help me, thanks.
See the screen shot image below:
EDIT: This is the new code. I use the
\documentclass[a4paper,notitlepage]{article}
\usepackage{graphicx}
\usepackage[twocolumn]{geometry}
\usepackage{amssymb}
\usepackage{array}
\usepackage[export]{adjustbox} % draw frame of the image
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm,headheight=1cm,headsep=1cm,footskip=1cm}
\usepackage{wasysym}
\setlength{\columnseprule}{0.4pt}
\setlength{\columnsep}{0.5in}
\newcommand\numitem[1]{\item #1 \hfill $\Box$}%
\newcommand\nonnumitem[1]{\item[--] #1 \hfill $\Box$}%
\begin{document}
\begin{enumerate}
\numitem{Open the \TeX book Open the \TeX book Open the abc}
\numitem{Find the good page}
\nonnumitem{Try to understand}
\end{enumerate}
\newpage
\begin{enumerate}
\numitem{Open the \TeX book Open the \TeX book Open the abcdefg}
\numitem{Find the good page}
\nonnumitem{Try to understand}
\end{enumerate}
\end{document}
I found a bug that sometimes, the box was not put in the right side of the column, see the screen shot below:
So, any idea to fix this? Thanks.
EDIT2 I found some code snippet which can solve this issue(force the box go to the right side), just change the code to:
\newcommand\numitem[1]{\item #1 \unskip\linebreak[0]\enspace\hbox{}\nobreak\hfill$\Box$}%
\newcommand\nonnumitem[1]{\item[--] #1 \unskip\linebreak[0]\enspace\hbox{}\nobreak\hfill$\Box$}%
Then, I can fix this bug, but can any till me what does the code means? Thanks.
twocolumn
mode, the margin used to print the\marginpar
is the left one when you are in the left column and the right one when you are in the right column.