[Tex/LaTex] How to change position of marks in a question paper template

exam

I am using {exam} document class for question paper setting. In the generated pdf marks are almost on the right boundary as I take printout. Can I shift it slightly left or at least at right-aligned with the text? MWE is given as:

\documentclass[12pt]{exam}
\usepackage[margin = 2.2cm]{geometry}
\linespread{1}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumerate}
\begin{document}
\begin{center}
\textbf{Name of Institution}\newline
\textbf{Name of Department}\newline
\textbf{Name of Examination}\newline
\end{center}
\textbf{Course Code:XXX (YYYYYY) }  \hspace{1cm} \textbf{Semester: 4th} \newline
\textbf{Time: 2 Hrs \hspace{3cm}  \hspace{7cm} \ \  Max. Marks: 50}\newline

\begin{questions}
\pointsdroppedatright
\question
\begin{parts}
\part[3] Type question here. Type question here Type question here Type question here Type question here Type question here Type question here  \textbf{\droppoints}
\part[7] Type part 2 of question here. Type question here Type question here Type question here Type question here Type question here Type question here 
\begin{enumerate}[i.]
        \item Type question here  XXXXXXX.
    \item YYYYYY.
    \item Type question here Type question here Type question here Type question here Type question here Type question here Type question here Type question here 
\end{enumerate}
\textbf{\droppoints}
\end{parts}
\question 
\begin{parts}
    \part[5] Type question here. Type question here Type question here Type question here Type question here Type question here Type question here  \textbf{\droppoints}
    \part[5] Type part 2 of question here. Type question here Type question here Type question here Type question here Type question here Type question here 
    \textbf{\droppoints}
    \end{parts}
\end {questions}
\end{document}

Best Answer

a variation of nice Jesse op den Brouw's answer (+1):

  • different position of \droppoints
  • some off-topic changes of code

    \documentclass[12pt]{exam}
    \usepackage[showframe,   % in real document remove this option
                margin=22mm]{geometry}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage{enumitem}
    \setlist[enumerate]{label=\roman*.,after=\vspace{-0.5\baselineskip}}
    \makeatletter
    \def\droppoints{%
      \leavevmode\unskip\nobreak\hfill
            \rlap{\hskip\marginparsep\padded@point@block}%
                    }
    \makeatother
    
    \begin{document}
    \begin{center}\bfseries
    Name of Institution\\
    Name of Department\\
    Name of Examination
    \end{center}
    \textbf{Course Code:XXX (YYYYYY) }  \hfill\textbf{Semester: 4th}    \\
    \textbf{Time: 2 Hrs                 \hfill  Max. Marks: 50}         \\
    
    \begin{questions}
    \pointsdroppedatright
    \question
    \begin{parts}
    \part[3] Type question here. Type question here Type question here Type question here Type question here Type question here Type question here
    \textbf{\droppoints}
    \part[7] Type part 2 of question here. Type question here Type question here Type question here Type question here Type question here Type question here
    \begin{enumerate}
        \item Type question here  XXXXXXX.
        \item YYYYYY.
        \item Type question here Type question here Type question here Type question here Type question here Type question here Type question here Type question here
    \end{enumerate}
    \textbf{\droppoints}
    \end{parts}
    \question
    \begin{parts}
        \part[5] Type question here. Type question here Type question here Type question here Type question here Type question here Type question here
        \textbf{\droppoints}
        \part[5] Type part 2 of question here. Type question here Type question here Type question here Type question here Type question here Type question here
        \textbf{\droppoints}
        \end{parts}
    \end {questions}
    

enter image description here

Related Question