1

I have a simple multiple choice question, I would like to ensure that the question and all choices appear on the same page. I have seen previous suggestions that you should embed the question in a minipage, but that affects the spacing between questions. Is there any other ideas that could accomplish this?

    1. What is the time?

    A) 1o'clock
    B) 1o'clock
    C) 1o'clock
    D) 1o'clock

Here is an example of a fix with minipage that requires vspace to fix vertical spacing issues.

\documentclass[a4paper,12pt,addpoints]{exam} 
\usepackage{graphicx}
\usepackage{anyfontsize}

\makeatother

\graphicspath{{\subfix{../images/}}}

\begin{document}


\sffamily
\newpage
{\Large\textbf{Section I - Multiple Choice}}

\textbf{Total Marks}

\textbf{Attempt All Questions}

\textbf{Allow About 12 Minutes for these questions}

Use the multiple choice answer sheet

Select the alternative A, B, C or D that best answers the question.
\vspace{0.4cm}\hrule\vspace{1cm}
\begin{questions}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \vspace*{0.5cm}
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
        \vspace*{0.5cm}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \question What time is it?\hfill
        \begin{choices}
            \CorrectChoice 1 o'clock
            \choice 2 o'clock
            \choice 3 o'clock 
            \choice 4 o'clock
        \end{choices}
    \end{minipage}
    
    


\end{questions}
\end{document}
3
  • Add some vertical space between the minipages? Without a MWE showing the issue is not possible be more concrete, but you should think in two minipages just like two big characters. If you are to able to add some vertical space between "A" and "B", you can do the same with the minipages.
    – Fran
    Nov 17, 2022 at 2:15
  • @Fran, yes I can fix it with minipage and vspace (see moded question) but it means even more lines of code, I was wondering if there was a setting or some tidier way of doing it.
    – Gary Horan
    Nov 17, 2022 at 3:32
  • Yes, remove all the \vspaces, add \usepackage{parskip} in the preamble, but mainly, add blank lines between the minipages. You put all In your questions in the same paragraph!. It is like type a really with a huge font the paragraph "A B C D ..." so that only one letter fits per line (i.e., the break lines between minipages are only horizontal spaces por LaTeX, it should be blank lines, or alternatively, add \par to see more clearly the paragraph breaks).
    – Fran
    Nov 17, 2022 at 9:08

1 Answer 1

0

This code adds the minipages to the choices environment. It also adds some (optional) space (with \vspace{0.5cm}) before and after the choices.

It will keep the question and all of its choices on the same page.

a

\documentclass[a4paper,12pt,addpoints]{exam} 
\usepackage{graphicx}
\usepackage{anyfontsize}    

\graphicspath{{\subfix{../images/}}}

% From https://tex.stackexchange.com/a/224654/161015 ***************<<<<<<<<<<<<<<<<<<<
\usepackage{etoolbox}
\BeforeBeginEnvironment{choices}{\vspace*{0.5cm}\par\nopagebreak\minipage{\linewidth}}
\AfterEndEnvironment{choices}{\vspace*{0.5cm}\endminipage}
%*******************************************************

\begin{document}
    
    \sffamily
    \newpage
    {\Large\textbf{Section I - Multiple Choice}}
    
    \textbf{Total Marks}
    
    \textbf{Attempt All Questions}
    
    \textbf{Allow About 12 Minutes for these questions}
    
    Use the multiple choice answer sheet
    
    Select the alternative A, B, C or D that best answers the question.
    \vspace{0.4cm}\hrule\vspace{1cm}
    
    %\vspace*{1.3cm} % USE to test.     \vspace*{1.4cm} will make question 4 go tho the next page

\begin{questions}
    \question What time is it?\hfill
    \begin{choices}
        \CorrectChoice 1 o'clock
        \choice 2 o'clock
        \choice 3 o'clock 
        \choice 4 o'clock
    \end{choices}
    \question What time is it?\hfill
    \begin{choices}
        \CorrectChoice 1 o'clock
        \choice 2 o'clock
        \choice 3 o'clock 
        \choice 4 o'clock
    \end{choices}
    \question What time is it?\hfill
    \begin{choices}
        \CorrectChoice 1 o'clock
        \choice 2 o'clock
        \choice 3 o'clock 
        \choice 4 o'clock
    \end{choices}
    \question What time is it?\hfill
    \begin{choices}
        \CorrectChoice 1 o'clock
        \choice 2 o'clock
        \choice 3 o'clock 
        \choice 4 o'clock
    \end{choices}
    \question What time is it?\hfill
    \begin{choices}
        \CorrectChoice 1 o'clock
        \choice 2 o'clock
        \choice 3 o'clock 
        \choice 4 o'clock
    \end{choices}
    \question What time is it?\hfill
    \begin{choices}
        \CorrectChoice 1 o'clock
        \choice 2 o'clock
        \choice 3 o'clock 
        \choice 4 o'clock
    \end{choices}
\end{questions}
\end{document}

It can be tested adding some vertical space after the rule and before the question. For example \vspace*{1.4cm} will make question #4 and its choices go to the next page.

1
  • Thanks @simon-dispa, your solution works well. I had actually seen the thread tex.stackexchange.com/a/224654/161015 but I assumed that the solution there didn't work because of a comment below it saying that it didn't include the question (only the choices). Anyway, this does seem to work - thanks again.
    – Gary Horan
    Nov 18, 2022 at 0:13

You must log in to answer this question.

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