4

I would like to align the checkboxes in my enumerate list below:

\documentclass{article}
\begin{document}

\begin{enumerate}
\item mbood \hspace{0.2cm} \framebox(10,10){}
\item frall \hspace{0.5cm} \framebox(10,10){}
\item coofp \hspace{0.5cm} \framebox(10,10){}
\item ktleem    \hspace{0.2cm} \framebox(10,10){}
\item sproke    \hspace{0.2cm} \framebox(10,10){}
\item flube     \hspace{0.2cm} \framebox(10,10){}
\item sglop \hspace{0.2cm} \framebox(10,10){}
\item blick     \hspace{0.2cm} \framebox(10,10){}
\item bnick \hspace{0.2cm} \framebox(10,10){}
\item strock    \hspace{0.2cm} \framebox(10,10){}
\end{enumerate}

\end{document}

I tried to use the \hspace{} command, but I was wondering if there is any faster way to do this. Thanks!

enter image description here

  • 3
    This is something rather for a table than for an enumerate environment – user31729 Jan 16 '17 at 17:32
  • 2
    I’d also suggest considering the tabbing environment, instead of tabular, since the former permits page breaks. Or, would it be acceptable to have the chekboxes go before the words? – GuM Jan 16 '17 at 17:40
2

Use a \parbox around your items and \hfill witin:

\begin{enumerate}
\item \parbox{.5\textwidth}{mbood \hfill \framebox(10,10){}}
\item \parbox{.5\textwidth}{frall \hfill \framebox(10,10){}}
\item \parbox{.5\textwidth}{coofp \hfill \framebox(10,10){}}
\item \parbox{.5\textwidth}{ktleem    \hfill \framebox(10,10){}}
\item \parbox{.5\textwidth}{sproke    \hfill \framebox(10,10){}}
%% ...
\end{enumerate}

now the text looks not aligned with the number of the list anymore...

then try this inside out:

\parbox{.5\textwidth}{%
   \begin{enumerate}
    \item mbood\hfill \framebox(10,10){}
    \item frall\hfill \framebox(10,10){}
    \item coofp\hfill \framebox(10,10){}
    \item ktleem\hfill \framebox(10,10){}
    \item sproke\hfill \framebox(10,10){}
    %% ...
    \end{enumerate}%
}
  • thanks for your reply! although, now the text looks not aligned with the number of the list anymore... – RobertP. Jan 16 '17 at 19:53
  • nice! that's exactly what I was looking for. – RobertP. Jan 16 '17 at 20:59
  • @RobertP. off topic you are aware of the document type exsam which can do multiple choice test too? – Timothy Truckle Jan 16 '17 at 21:09
3

A possible solution with using automatic numbers and alignment within a tabular environment.

Use a longtable environment if page breaking is an issue!

\documentclass{article}
\usepackage{array}
\newcounter{linecounter}
\newcolumntype{N}{>{\refstepcounter{linecounter}\thelinecounter.}r}
\newcolumntype{B}{>{\framebox(10,10){}}c}
\begin{document}

\begin{tabular}{NlB}
  & mbood  & \tabularnewline
  & frall  & \tabularnewline
  & coofp  & \tabularnewline
  & ktleem     & \tabularnewline
  & sproke     & \tabularnewline
  & flube      & \tabularnewline
  & sglop &  \tabularnewline
  & blick      & \tabularnewline
  & bnick &  \tabularnewline
  & strock     & \tabularnewline
\end{tabular}

\end{document}

enter image description here

3

I think that, all things considered, the following is a good tradeoff between simplicity and effectiveness:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\newcommand*{\robertitem}[1]{%
    \item\relax % "\relax" not really needed, but I'm neurotic!
    \makebox[.5\linewidth][l]{#1\hfill \framebox(10,10)}%
}



\begin{document}

Some text here, just for the purpose of showing where the prevailing text 
margins lie.
\begin{enumerate}
    \robertitem{Mrs. Dalloway}
    \robertitem{Said}
    \robertitem{She would buy}
    \robertitem{The flowers}
    \robertitem{Herself}
\end{enumerate}
(Please note that I~am quoting from memory.)

\end{document}

Output:

output of the code

  • thank you for reply! although, I get an error: it says there is missing '}' inserted, but I can't figure out why... – RobertP. Jan 16 '17 at 19:49
  • @RobertP.: I cannot reproduce the error. I thought that there could be a typo, but I re-copied the code from the answer back to my editor and it compiles fine. – GuM Jan 16 '17 at 20:36
  • that's weird...I keep getting the same error, I don't know why! XD – RobertP. Jan 16 '17 at 20:43
  • @RobertP.: At which line of the source code does the error occur? (TeX will report this information in the error message.) – GuM Jan 16 '17 at 20:50
  • the errors comes up at the very first \robertitem... – RobertP. Jan 17 '17 at 0:44

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.