11

Since 2005, I have generally used this model to create multiple-choice tests for my students. I kindly ask you if there are packages or macros, or particular strategies to have squares with the letters A, B, C, D inside. I created the letter E with the underline (tabular) if, for pure typing error or distraction, I had not put the correct answer.

As you can see with the red arrows I do not have perfect squares and I think that all this depends on the letter used. But is it possible to find a solution to not use tabular? There is also another problem. Should I use aligned or other strategies to get a perfect alignment in mathematical mode? In which way could I have an optimal result? enter image description here

Here there is my MWE:

\documentclass[leqno,11pt,landscape,a3paper]{extarticle}
\usepackage{graphicx,multicol,mathtools}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}



\begin{multicols}{1}
\begin{enumerate}


\item La velocità di 1,00$\cdot 10^2$ m/s espressa in km/h è:

$\fbox{A}$  36 km/h.\\
$\fbox{B}$    360 km/h.\\
$\fbox{C}$  27,8 km/h.\\
$\fbox{D}$    $3,\!60\cdot 10^{8}$ km/h.\\
$\fbox{E}$ \begin{tabular}{lllllllllllll}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{6}{c}{} \\
\hline
\end{tabular}

\item In fisica nucleare si usa l'angstrom (simbolo: 1\AA=$10^{-10}$ m) e il fermi o femtometro (1 fm= $10^{-15}$ m). Qual è la relazione tra queste due unità di misura?

$\fbox{A}$  1 \AA = $10^5$ fm.\\
$\fbox{B}$    1 \AA = $10^{-5}$ fm.\\
$\fbox{C}$    1 \AA = $10^{-15}$ fm.\\
$\fbox{D}$    1 \AA = $10^{3}$ fm.\\
$\fbox{E}$ \begin{tabular}{lllllllllllll}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{6}{c}{} \\
\hline
\end{tabular}

\end{enumerate}
\end{multicols}

\clearpage
\end{document}
Sebastiano
  • 54,118
  • 4
    unrelated but Underfull \hbox (badness 10000) in paragraph at lines 54--55 Underfull \hbox (badness 10000) in paragraph at lines 54--55 is warning you about the misuse of \\ – David Carlisle Nov 25 '18 at 20:20
  • @DavidCarlisle Dear David, this error happened to me when the question and the answers are empty. Any suggestions you have for fixing it are very welcome. +1 for your warning. – Sebastiano Nov 25 '18 at 20:22
  • 5
    never use \\ at the end of a paragraph, simply delete the \\ – David Carlisle Nov 25 '18 at 20:25
  • 4
    These are way too many choices. Just give them one choice, and you will surprised how good their scores will become. ;-) –  Nov 25 '18 at 20:26
  • List of all typographical mistakes: https://i.stack.imgur.com/SwDQ6.png You should correct the spacing. – daniel Nov 25 '18 at 20:44
  • 2
    There is a package called alterqcm that I use to do MCQs, its documentation is in French. https://www.ctan.org/pkg/alterqcm – AndréC Nov 25 '18 at 20:58
  • @AndréC Wonderful. Unfortunately, I don't even have a little relaxation. I'm preparing my homework for my students and I don't think I can create a new model following the guide I didn't know about. I have 6 classes: 4 courses in Mathematics and 4 courses in Physics. Consider that I have to create two different files and in the meantime I should also devote myself to my book. – Sebastiano Nov 25 '18 at 21:05
  • I downvoted because the MWE is all but not minimal. After years of experience on this site you should know better than to dump your complete preamble which is totally irrelevant to the question. Also changing a question to invalidate an existing answer is bad behaviour. – aloneprism Nov 25 '18 at 21:13
  • @Sebastiano If you are interested, I can write your Minimum Complete Example with alterqcm and a minimum of explanations. – AndréC Nov 25 '18 at 21:48
  • 1
    Only 1 downvote so far... :-) – Mico Nov 25 '18 at 22:39
  • @Mico Hi, dear friend :-) my huge greetings. – Sebastiano Nov 25 '18 at 23:41
  • You may like the exam class It doesn't solve your problem directly, but it gives a nice framework to make all kinds of tests/exams (including multiple choice tests, and "leave blank" questions, answers), and the documentation is superb with examples for all the features. See section 5 on page 41. If you do not like the design of the choice labels, you can customize according to section 4.9 – Máté Wierdl Nov 27 '18 at 20:15
  • 1
    I see a second downvoter has seen fit to enter the fray. Haters of the world, unite! – Mico Nov 27 '18 at 20:55
  • @Mico Dear friend, the computer system has eliminated the two serial votes that were in my question. Now everything is regular. As already written in different circumstances, it is right that my questions should contain negative votes, but that they should be objective and not with bad intentions. – Sebastiano Nov 29 '18 at 19:50
  • 1
    @Sebastiano - Glad to see that the system manages to go after the worst forms of abuse and misuse, at least from time to time. :-) – Mico Nov 29 '18 at 21:10

3 Answers3

10

The obvious problem is that D is wider than A.

We can get a true square around capital letters by using the height as width:

\documentclass{article}

\newcommand{\squarecap}[1]{\fbox{\makebox[\height]{#1}}}

\begin{document}

\squarecap{A}\par
\squarecap{B}\par
\squarecap{C}\par
\squarecap{D}\par
\squarecap{E}\par
\squarecap{M}\par

\end{document}

enter image description here

The question about the angstrom is of a different kind: \AA=$1$ has no space; if you don't want to use siunitx (which is however recommended), type in

$1\,\textup{\AA} = 10^5\,\textup{fm}$
egreg
  • 1,121,712
  • Egreg : what does [\height] when used as the length parameter in the makebox command? – pzorba75 Nov 26 '18 at 05:07
  • @pzorba75 In that position it refers to the natural height of the box being built. There are also \width, \depth and \totalheight – egreg Nov 26 '18 at 08:28
9

You can use \eqmakebox[<tag>][<align>]{<stuff>} to have all <stuff> with the same <tag> be set <align>ed in a box of maximum width. Below I've played around with those so you can see what the effect is:

enter image description here

\documentclass{extarticle}

\usepackage[UTF8]{inputenc}

\usepackage{siunitx,eqparbox}

% https://tex.stackexchange.com/a/34412/5764
\makeatletter
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%
  \IfValueTF{#1}
    {\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}}
    {\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}}
  \mathpalette\eqmathbox@{#3}
}
\makeatother

\sisetup{
  per-mode = symbol
}

\newcommand{\makeoption}[2][default]{\fbox{\eqmakebox[#1]{#2}}}
\newcommand{\genericoption}{\rule[-.2\baselineskip]{100pt}{.4pt}}

\begin{document}

\begin{enumerate}
  \item La velocità di \SI{1e2}{\metre\per\second} espressa in \si{\kilo\metre\per\hour} è:

    \makeoption{A} \eqmakebox[first][r]{\SI{36}{km/h}}.     \\
    \makeoption{B} \eqmakebox[first][r]{\SI{360}{km/h}}.    \\
    \makeoption{C} \eqmakebox[first][r]{\SI{27.8}{km/h}}.   \\
    \makeoption{D} \eqmakebox[first][r]{\SI{3.60e8}{km/h}}. \\
    \makeoption{E} \genericoption

  \item In fisica nucleare si usa l'angstrom (simbolo: $\SI{1}{\AA} = \SI{1e-9}{m}$) e il fermi o femtometro ($\SI{1}{fm} = \SI{1e-14}{m}$). 
    Qual è la relazione tra queste due unità di misura?

    \makeoption{A} $\SI{1}{\AA} = \eqmathbox[second][r]{\SI{d5}{fm}}$.   \\
    \makeoption{B} $\SI{1}{\AA} = \eqmathbox[second][r]{\SI{d-5}{fm}}$.  \\
    \makeoption{C} $\SI{1}{\AA} = \eqmathbox[second][r]{\SI{d-15}{fm}}$. \\
    \makeoption{D} $\SI{1}{\AA} = \eqmathbox[second][r]{\SI{d{3}}{fm}}$. \\
    \makeoption{E} \genericoption

\end{enumerate}

\end{document}

I'd suggest using siunitx to set content that has units.

Werner
  • 603,163
6

Make the content of all your boxes the same width and don't set your units incorrectly, the spacing and font types are all wrong.

\documentclass{extarticle}

\usepackage{siunitx}

\begin{document}

\fbox{\makebox[0.9em]{A}} $\SI{1}{\angstrom} = \SI{e5}{fm}$.

\fbox{\makebox[0.9em]{B}} $\SI{1}{\angstrom} = \SI{e-5}{fm}$.

\fbox{\makebox[0.9em]{C}} $\SI{1}{\angstrom} = \SI{e-5}{fm}$.

\fbox{\makebox[0.9em]{D}} $\SI{1}{\angstrom} = \SI{e-5}{fm}$.

\fbox{\makebox[0.9em]{E}} \rule{2.2cm}{0.5pt}

\end{document}

enter image description here

daniel
  • 1