2

I'm using the exam.cls and after \question, i have some description before going into \part.

How do i add an indent for the first line of the question? I've tried indentfirst package, \hspace{}, \itemindent, \parindent and these didnt work.

enter image description here

\documentclass[addpoints, a4paper, 12pt]{exam}
\usepackage{setspace, amsmath, pdfpages, mathtools}
\usepackage{times}
\pagestyle{headandfoot}
\setstretch{1.3} 

\setlength{\rightpointsmargin}{2.5cm}
\cfoot[\thepage]{\thepage} % page numbering
\qformat  % Format for question
{
    \textbf{QUESTION \thequestion{} (\pointsofquestion{\thequestion} marks)} 
    \hfill
    \vrule depth 1.7em width 0pt
}

\pointsdroppedatright % enable points at the right margin
\marksnotpoints
\marginpointname{ \points}


% To adjust questions margins
\renewcommand{\questionshook}{%
  \setlength{\leftmargin}{0pt}%
    \setlength{\labelwidth}{-\labelsep}%
  \setlength{\itemsep}{1em}
}

% To adjust parts margins
\renewcommand{\partshook}{%
  \setlength{\leftmargin}{1.4cm}%
  \setlength{\labelsep}{1cm}
  \setlength{\labelwidth}{0cm}%
  \setlength{\itemsep}{1em}

}

\begin{document}

\begin{questions}

\question
bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla 

\begin{parts}

    \part[5]
    bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla 
    
    \droppoints 
    
    \part[4]
    bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla 
    
    \droppoints 

\end{parts}

\end{questions}

\end{document}

Thanks in advance.

1
  • Since the (empty) label is the first thing after \par (in \item), the code goes to great lengths to prevent paragraph indentation (including setting \parindent=0pt). You could put the text into a \parbox and reset \parindent inside. Commented Jun 16, 2021 at 18:58

1 Answer 1

2

Below I patch \question (defined within the environment questions) by appending an \hspace*{1.5em}\ignorespaces to it. That inserts the starting space.

enter image description here

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

\setlength{\rightpointsmargin}{2.5cm}
\cfoot[\thepage]{\thepage} % page numbering
\qformat  % Format for question
{%
    \textbf{QUESTION \thequestion{} (\pointsofquestion{\thequestion} marks)} 
    \hfill
    \vrule depth 1.7em width 0pt
}

\pointsdroppedatright % enable points at the right margin
\marksnotpoints
\marginpointname{ \points}


% To adjust questions margins
\renewcommand{\questionshook}{%
  \setlength{\leftmargin}{0pt}%
    \setlength{\labelwidth}{-\labelsep}%
  \setlength{\itemsep}{1em}%
  \let\oldquestion\question% Copy \question into \oldquestion
  \renewcommand{\question}{%
    \oldquestion% Default question style
    \hspace*{1.5em}\ignorespaces% Insert paragraph indent/space
  }%
}

% To adjust parts margins
\renewcommand{\partshook}{%
  \setlength{\leftmargin}{1.4cm}%
  \setlength{\labelsep}{1cm}
  \setlength{\labelwidth}{0cm}%
  \setlength{\itemsep}{1em}

}

\begin{document}

\begin{questions}

  \question
  bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla 

  \begin{parts}

    \part[5]
    bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla 
    
    \droppoints 
    
    \part[4]
    bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla bla bla bla bla blab bla 
    
    \droppoints 

  \end{parts}

\end{questions}

\end{document}
2
  • that works! and I learnt something new as well. thank you very very much.
    – yungszen
    Commented Jun 16, 2021 at 18:02
  • @yungszen: If this answered your question, consider accepting it as such. See How do you accept an answer?
    – Werner
    Commented Jun 16, 2021 at 18:04

You must log in to answer this question.

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