The class exam
has some hooks to insert commands into the lists. Initially defined as \newcommand\questionshook{}
,
\newcommand\partshook{}
and others, can be activated with
\renewcommand\questionshook{<newcomands>}
\renewcommand\partshook{<newcomands>}
, etc.
The only solution I found to change the indentation of "In the following ..." was to insert before a negative space. Hope this is acceptable.
% !TeX TS-program = pdflatex
\documentclass[addpoints]{exam}
\usepackage{showframe} % show margins
\renewcommand{\partshook}{% added <<<<<<<<<<<<
\setlength{\leftmargin}{0pt}
\setlength{\labelwidth}{-\labelsep}%
\def\makelabel##1{\hskip-\leftmargin##1}%
}
\renewcommand{\questionshook}{% added <<<<<<<<<
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}
\firstpageheader{Exam}{}{}
\runningheader{Exam}{}{}
\qformat{%
\parbox{\textwidth}{\large\textbf{Problem \thequestiontitle}\quad (\thepoints)\smallskip \\}% changed <<<<<<<<<
}
\begin{document}
\begin{questions}
\titledquestion{Foo}[10]
\hspace*{-\leftmargin}In the following... % changed <<<<<<<<<<<<<
\begin{parts}
\part What is foo?
\fillwithdottedlines{1cm}
\fillwithdottedlines{1cm}
\part What is bar?
\fillwithdottedlines{1cm}
\fillwithdottedlines{1cm}
\end{parts}
\end{questions}
\begin{questions}
\titledquestion{Bar}[15]
\hspace*{-\leftmargin}In the following...\par
\begin{parts}
\part What is bar?
\fillwithdottedlines{1cm}
\end{parts}
\end{questions}
\begin{questions}
\titledquestion{Baz}[20]
\hspace*{-\leftmargin}In the following...\par
\begin{parts}
\part What is baz?
\fillwithdottedlines{1cm}
\end{parts}
\end{questions}
\end{document}
\qformat{%