2

I want to learn how to align marks (to the right) and start the question always on a new line.

My MWE:

\documentclass[a4paper,12pt]{exam}
\usepackage{amsmath}
\pointsinrightmargin

\renewcommand\choicelabel{(\Alph{choice})} 
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{25mm}% 
    \setlength{\labelwidth}{\labelsep }%
    }

\renewcommand{\questionlabel}{ \textbf{Question \thequestion}:}

\begin{document}
\begin{questions}
    
    \question[1]  Start this line on a new line and align the marks with the rest of the paper.
    \begin{choices} \choice 1 \choice 2 \choice 2 \choice 3 \end{choices}
    
    \question[2]  Drop and align this one too.
    \begin{choices} \choice 6 \choice 3 \choice 2 \choice 0 \end{choices}
    
    \question[3]
    Drop and align this sentence too!
    
    \question Drop and align this sentence one too!
    
    \begin{parts} % Keep this part as it is.
        \part[4] Keep as it is.
        \part[5] Keep as it is.
        \part
        Consider this and that:
        \begin{subparts}
            \subpart[6] This one is aligned with the parts.
            \subpart[7] So is this one.
        \end{subparts}
    \end{parts}
\end{questions}
\end{document}

I tried to use

\setlength{\rightpointsmargin}{15mm}

But it simply shifts all marks, but the one I'm interested in are the ones that have gone over the page.

Ideally, this is what I would like to always happen (regardless if I modify the question/parts/choice labels/shook).

Expected result

EDIT: UPDATED CODE

\documentclass[a4paper,12pt]{exam}
\usepackage{amsmath}
\usepackage[showframe=true]{geometry}
\pointsinrightmargin
\pointname{}
\pointformat{\textbf{\thepoints}}

\qformat{{\textbf{Question \thequestion}}\hfill\textbf{\thepoints}\hspace{-1.5cm}}

\renewcommand\choicelabel{(\Alph{choice})} 
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{25mm}% 
    \setlength{\labelwidth}{\labelsep}%
    }


\begin{document}
\begin{questions}
    
    \question[1]  Start this line on a new line and align the marks with the rest of the paper.
    \begin{choices} \choice 1 \choice 2 \choice 2 \choice 3 \end{choices}
    
    \question[2]  Drop and align this one too.
    \begin{choices} \choice 6 \choice 3 \choice 2 \choice 0 \end{choices}
    
    \question[3]
    Drop and align this sentence too!
    
    \question Drop and align this sentence one too!
    
    \begin{parts} % Keep this part as it is.
        \part[4] Keep as it is.
        \part[5] Keep as it is.
        \part
        Consider this and that:
        \begin{subparts}
            \subpart[6] This one is aligned with the parts.
            \subpart[7] So is this one.
        \end{subparts}
    \end{parts}
\end{questions}
\end{document}
4
  • tex.stackexchange.com/questions/122698/… This is the best example I can find where the question starts directly below the label.
    – Alan Jones
    Commented Jan 15, 2021 at 8:10
  • You hacking solution seems to work quite nicely. Is there anything more that you would like to achieve?
    – Alan Xiang
    Commented Jan 16, 2021 at 21:26
  • I'm not sure what you mean? I still can't get the multiple choice and short answers points to align perfectly in the right margin.
    – Alan Jones
    Commented Jan 17, 2021 at 0:07
  • I've removed the "align" tag; it is specific to math displays. Commented Feb 6 at 3:50

1 Answer 1

0

An ugly patch:

\documentclass[a4paper,12pt]{exam}
\usepackage{amsmath}
\usepackage[showframe=true]{geometry}
\pointsinrightmargin
\pointname{}
\pointformat{\textbf{\thepoints}}

\qformat{{\textbf{Question \thequestion}}\hfill%
\rlap{\hspace*{14.5mm}\textbf{\thepoints}}
}

\renewcommand\choicelabel{(\Alph{choice})} 
\renewcommand{\choiceshook}{%
    \setlength{\leftmargin}{25mm}% 
    \setlength{\labelwidth}{\labelsep}%
    }


\begin{document}
\begin{questions}
    
    \question[1]  Start this line on a new line and align the marks with the rest of the paper.
    \begin{choices} \choice 1 \choice 2 \choice 2 \choice 3 \end{choices}
    
    \question[2]  Drop and align this one too.
    \begin{choices} \choice 6 \choice 3 \choice 2 \choice 0 \end{choices}
    
    \question[3]
    Drop and align this sentence too!
    
    \question Drop and align this sentence one too!
    
    \begin{parts} % Keep this part as it is.
        \part[4] Keep as it is.
        \part[5] Keep as it is.
        \part
        Consider this and that:
        \begin{subparts}
            \subpart[6] This one is aligned with the parts.
            \subpart[7] So is this one.
        \end{subparts}
    \end{parts}
\end{questions}
\end{document}
3
  • Is it possible to do it without the \qformat? because I'm starting to hate it.
    – Alan Jones
    Commented Jan 17, 2021 at 2:13
  • Also the first lines are all indented.
    – Alan Jones
    Commented Jan 17, 2021 at 2:14
  • I am not sure how to do it without \qformat. Also, it is the normal indentation of text lines. The question headings are shifted to the left.
    – Alan Xiang
    Commented Jan 17, 2021 at 2:26

You must log in to answer this question.

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