Forums » Using AMC (english) »
hhead in \AMCnumericChoice, help student understand which line is which digit
Added by Charlie M 3 months ago
Replies (4)
RE: hhead in \AMCnumericChoice, help student understand which line is which digit - Added by Charlie M 3 months ago
Formatting has done something weird. I'll put it in multiple message then :
Hi, Most of my students struggle with multi digits number when given an \AMCnumericChoice answer. When there are some 0 in the first digit(s), most of the time they write in the first available row. For example, they need to write 42 in a 3 rows answer, they write [4] [2] [ ] instead of [0] [4] [2] (or [ ] [4] [2] with `strict=false`). When the answers is asked in vertical mode, there is a `vhead` option, originally design for bit weight, but useful for writing "100, 10, 1" in my case. There is no such option for horizontal answers. Thus, I made something to fit my need, but it's a dirty hack that would probably break things elsewhere.
RE: hhead in \AMCnumericChoice, help student understand which line is which digit - Added by Charlie M 3 months ago
File AMCnumericChoice.tex
\RequirePackage{fp, tikz, vwcol} \makeatletter \def\setinsidebox{\AMC@inside@boxtrue} \makeatother \let\oldAMCnumericChoices\AMCnumericChoices \makeatletter % ========= KEY DEFINITIONS ========= \define@key{AMCNumeric}{base}[0]{} \define@key{AMCNumeric}{sign}[0]{} \define@key{AMCNumeric}{strict}[0]{} \define@key{AMCNumeric}{scoring}[0]{} \define@key{AMCNumeric}{vertical}[0]{} \define@key{AMCNumeric}{reverse}[0]{} \define@key{AMCNumeric}{vhead}[0]{} \define@key{AMCNumeric}{scoreexact}[0]{} \define@key{AMCNumeric}{scoreapprox}[0]{} \define@key{AMCNumeric}{exact}[0]{} \define@key{AMCNumeric}{nozero}[0]{} \define@key{AMCNumeric}{approx}[0]{} \define@key{AMCNumeric}{significant}[0]{} \define@key{AMCNumeric}{borderwidth}[0]{} \define@key{AMCNumeric}{backgroundcol}[0]{} \define@key{AMCNumeric}{digits}[3]{\def\mm@first{#1}} \define@key{AMCNumeric}{decimals}[0]{\def\mm@second{#1}} \DeclareDocumentCommand{\myMacro}{m}{ \begingroup% % ========= KEY DEFAULTS + new ones ========= \setkeys{AMCNumeric}{digits,decimals,base,sign,strict,scoring,vertical,reverse,vhead,scoreexact,scoreapprox,exact,approx,nozero,significant} \setkeys{AMCNumeric}{#1} \FPeval\varNat{clip(\mm@first - \mm@second)} \FPeval\varDec{clip(\mm@second)} \ifthenelse{\varNat > 1 \OR \varDec > 0}{ %nat : \varNat \vspace{2.6ex} \color{lightgray} \foreach \digit in {\varNat,...,1}{ % \FPeval\head{clip(round(pow(\digit-1,10),0))} % %\nbzero:1 % \num{\head} % ~% \raisebox{.5ex}{\rule{5cm}{0.4pt}} \\[1ex] % } \ifthenelse{\varDec > 0}{ ~\\[0ex] \foreach \digit in {1,...,\varDec}{ \FPeval\head{clip(round(1/pow(\digit,10),\digit))} \num{\head}% ~% \raisebox{.5ex}{\rule{5cm}{0.4pt}} \\[1ex]% } } {}% do nothing } % {}% do nothing \endgroup } \makeatother \renewcommand{\AMCnumericChoices}[2]{ \begin{minipage}[t]{1cm} \myMacro{#2} \end{minipage} \begin{minipage}[t]{\linewidth-1cm} \setinsidebox \oldAMCnumericChoices{#1}{#2} \end{minipage} }
(I had to remove a lot of trailing `%` for the formatting not to go crazy, some unwanted spaces might appears?)
Quote from source.tex
\documentclass{article} \usepackage[bloc]{automultiplechoice} \usepackage{fp,siunitx} \input{../../../Template/AMCnumericChoices} \begin{document} \begin{copieexamen}[1] \FPeval\varV{clip(10 + round(20*random, 0))} \FPeval\varT{clip(3 + round(7*random, 0))} \FPeval\varD{clip(\varV * \varT)} \FPeval\varTT{clip(2)} \FPeval\varDD{clip(\varV * \varTT)} \begin{questionmult}{proportionalite.calculer.2-velo} Un cycliste roule à vitesse constante sur une véloroute. Au bout de \SI{\varT}{\hour}, il a parcouru \SI{\varD}{\kilo\meter}. Quelle distance (en kilomètre) aura-t-il parcouru au bout de \SI{\varTT}{\hour} ? \AMCnumericChoices{\varDD}{digits=5,decimals=02,sign=false,borderwidth=0pt,backgroundcol=lightgray,exact=1,approx=5} \end{questionmult} \end{copieexamen} \end{document}
RE: hhead in \AMCnumericChoice, help student understand which line is which digit - Added by Alexis Bienvenüe 3 months ago
Maybe the option ignoreblank=true
is for you? This works only in decimal mode (not binary).
You can use it for all questions with \AMCnumericOpts{ignoreblank=true}
at the beginning of the source file.
RE: hhead in \AMCnumericChoice, help student understand which line is which digit - Added by Charlie M 3 months ago
Sounds very good!
I can't find it in the manual to understand what it does, but it might be exactly what I need.
I'll do some tests!
Thanks.
(1-4/4)