2

I'm working in the mcexam package and want to take the output of \mctheversion and change it to an letter value. That is "Version 1" is changed to "A" or "Form A", "Version 2" to "B" or "Form B", etc. Thank you

\documentclass{exam}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{pifont}
\graphicspath{{./images/}}
\usepackage[output=exam, numberofversions=3, seed=6, randomizeanswers=false, randomizequestions=true, version=1]{mcexam}
\usepackage{xkeyval, etoolbox, xstring, environ, pgf, enumitem, longtable, newfile}

\newcommand\mcversionlabelfmt[1]{\Alph{#1}}

\begin{document}
    
    \begin{coverpages}

        
        \begin{center}
            \begin{LARGE}
                AP Statistics\\
                Unit \# Test - Unit Name\\
                Form \mctheversion \\
            \end{LARGE}
            
        \end{center}
        
    \end{coverpages}
\end{document}
3
  • 1
    Isn't the default “Version I” (with Roman numbers)? Redefine \mc@babel@version (after \begin{document}) and \mcversionlabelfmt (see section 5.2 of the user manual). If this does not help, show a minimal working example of what you've tried.
    – cabohah
    Commented Jun 5 at 12:50
  • 3
    Welcome to TeX.SE! Please show us a short compilable TeX code. Then we do not have to guess what you are doing ...
    – Mensch
    Commented Jun 5 at 12:59
  • Thank you for your quick response. I have uploaded an MWE. I can't figure out how to call the new command. Commented Jun 5 at 14:03

1 Answer 1

1

To change “Version” into “Form” you need to redefine \mc@babel@Version. If you are using package babel with one of the language supported by mcexam, this has to be done after \begin{document} or using \AtBeginDocument, because depending on the detected language mcexam.sty also defines it using \AtBeginDocument.

To change the format of the counter you have to redefine \mcversionlabelfmt. The original definition as shown in section 5.2 of the mcexam user manual is:

\newcommand\mcversionlabelfmt[1]{\Roman{#1}}

So the default is a (uppercase) Roman number.

To redefine it to show a uppercase letter, you have to replace \newcommand by \renewcommand and \Roman by \Alph.

So a minimized version of your code but with “Form A” instead of “Version I” would be:

\documentclass{exam}
\usepackage[output=exam, numberofversions=3, seed=6, randomizeanswers=false, randomizequestions=true, version=1]{mcexam}

\renewcommand{\mcversionlabelfmt}[1]{\Alph{#1}}
\makeatletter
\AtBeginDocument{%
  \renewcommand{\mc@babel@Version}{Form}%
}
\makeatother

\begin{document}
    
    \begin{coverpages}

        
        \begin{center}
            \begin{LARGE}
                AP Statistics\\
                Unit \# Test - Unit Name\\
                \mctheversion \\
            \end{LARGE}
            
        \end{center}
        
    \end{coverpages}
\end{document}

Form A

Note: If you use mcexam without babel (or currently also with babel, but without option dutch) you don't need \AtBeginDocument in the example above:

\documentclass{exam}
\usepackage[output=exam, numberofversions=3, seed=6, randomizeanswers=false,
randomizequestions=true, version=1]{mcexam}

\usepackage[english]{babel}% added

\renewcommand{\mcversionlabelfmt}[1]{\Alph{#1}}
\makeatletter
\renewcommand{\mc@babel@Version}{Form}% does not work, if you change babel
                                % option `english` into `dutch`
\makeatother

\begin{document}
    
    \begin{coverpages}

        
        \begin{center}
            \begin{LARGE}
                AP Statistics\\
                Unit \# Test - Unit Name\\
                \mctheversion \\
            \end{LARGE}
            
        \end{center}
        
    \end{coverpages}
\end{document}

But, because this could change, e.g., if mcexam supports more languages, I would recommend to nevertheless use the solution with \AtBeginDocument. As explained, this would also work with language dutch:

\documentclass{exam}
\usepackage[output=exam, numberofversions=3, seed=6, randomizeanswers=false,
randomizequestions=true, version=1]{mcexam}

\usepackage[dutch]{babel}% added to show the problem

\renewcommand{\mcversionlabelfmt}[1]{\Alph{#1}}
\makeatletter
\AtBeginDocument{% needed because of \usepackage[dutch]{babel}
  \renewcommand{\mc@babel@Version}{Form}
}
\makeatother

\begin{document}
    
    \begin{coverpages}

        
        \begin{center}
            \begin{LARGE}
                AP Statistics\\
                Unit \# Test - Unit Name\\
                \mctheversion \\
            \end{LARGE}
            
        \end{center}
        
    \end{coverpages}
\end{document}

If you'd remove the \AtBeginDocumet{% and the corresponding } in this example, you would not get “Form” but “Versie” (Dutch for “Version”).

1
  • This worked perfectly. Thank you so so much. the [english] is sufficient for me, but i appreciate the deeper dive with it. i've used LaTeX off and on for years, and this was one of the more technical difficulties i've had. Commented Jun 5 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .