3

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}
1
  • To get correct centering in a center environment you shouldn't use \newline but \\ to terminate lines (I haven't done this in my answer as I focussed only on the placement of the positioning of \droppoints).
    – Skillmon
    Sep 29, 2018 at 8:52

3 Answers 3

4

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

5

Just a minor improvement over @JesseopdenBrouw's answer (seriously if anyone upvotes this answer, consider upvoting his as well, all the work is done by him, I only included a feasible break point).

The following does jump to the next line and print the points there if in the last line of the question is not enough space (2em plus the space taken by the points). Also I included the \textbf into the definition of \droppoints. In the following MWE one can see the effects of this changes in question 1.a.

\documentclass[12pt]{exam}
\usepackage[margin = 2.2cm]{geometry}
\linespread{1}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumerate}

\makeatletter
\def\droppoints{%
  \leavevmode\unskip\nobreak\hfill\penalty50\hskip2em
  \null\nobreak\hfill
  \textbf{\padded@point@block}%
  \par
}
\makeatother


\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 Type question here
Type quest\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}
\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  \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 
    \droppoints
    \end{parts}
\end {questions}
\end{document}

enter image description here

4

Just redefine \droppoints.

\documentclass[12pt]{exam}
\usepackage[margin = 2.2cm]{geometry}
\linespread{1}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumerate}

\makeatletter
\def\droppoints{%
  \leavevmode\unskip\nobreak\hfill
  \rlap{\hskip\rightmargin  % Defined by the list environment
        \llap{\padded@point@block}%
  }% rlap
  \par
}
\makeatother


\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}
1
  • 1
    Just a tip for the future: It is usually a good idea to include an image of the new output. This way any future visitors (and the OP of the question) can quickly verify that this is what they wanted/were looking for. On Linux you can convert a PDF to an image with pdftocairo or imagemagick's convert.
    – Skillmon
    Sep 29, 2018 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.