5

I am trying to compile my exam paper in latex. I started from a template I found on the website and I made some changes. Actually, the code I am using is the following:

\documentclass[11pt,paper=a4,answers, addpoints]{exam}
\usepackage{graphicx,lastpage}
\usepackage{upgreek}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\hyphenpenalty 10000
\usepackage[paperheight=10.5in,paperwidth=8.27in,bindingoffset=0in,left=0.8in,right=1in,
top=0.7in,bottom=1in,headsep=.5\baselineskip]{geometry}
\flushbottom
\usepackage[normalem]{ulem}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\renewcommand\ULthickness{2pt} %%---> For changing thickness of underline
\setlength\ULdepth{1.5ex}%\maxdimen ---> For changing depth of underline
\renewcommand{\baselinestretch}{1}
\pagestyle{empty}

\pagestyle{headandfoot}
\headrule
\newcommand{\continuedmessage}{%
\ifcontinuation{\footnotesize Question \ContinuedQuestion\ continues\ldots}{}%
}
\runningheader{\footnotesize Dipartimento of Economics}
{\footnotesize Name of the course -- Code}
{\footnotesize Page \thepage\ of \numpages}
\footrule
\footer{\footnotesize Student's name:}
{}
{\ifincomplete{\footnotesize Question \IncompleteQuestion\ continues
on the next page\ldots}{\iflastpage{\footnotesize End of exam}{\footnotesize Please go on to the next page\ldots}}}

\usepackage{cleveref}
\crefname{figure}{figure}{figures}
\crefname{question}{question}{questions}
\renewcommand\thequestion{\arabic{question}}
\renewcommand{\questionlabel}{\thequestion)}
\renewcommand{\questionshook}{%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}

\nopointsinmargin 
\pointpoints{Punto}{Punti}

\marginpointname{\points}
\pointformat{\boldmath\themarginpoints}
\bracketedpoints

\begin{document}

\thispagestyle{empty}

\noindent
\begin{minipage}[t]{\textwidth}%
\centering
\includegraphics[width=1.5cm]{logo} \par
\textit{\textbf{University of XXXX}}\par
\textit{\textbf{Dipartiment of XXXX}} \par
\textit{\textbf{Summer Session}} 
\end{minipage}
\par
\bigskip\bigskip
\begin{minipage}[t]{.5\textwidth}%
{\bf Corso di Studio}: Whatever\par
\vspace{1ex}
{\bf BA course code}: LM77\par
\vspace{1ex}
{\bf Subject}: Name of the course\par
\vspace{1ex}
{\bf Data}: 23 Maggio 2016 \par
\vspace{1ex}
{\bf Docente}: My Name
\end{minipage}%
\hfill
\begin{minipage}[t]{.4\textwidth}%
{\bf Nome}: \makebox[.4\textwidth]{\hrulefill} \par
\vspace{1ex} 
{\bf Matricola}: \makebox[.4\textwidth]{\hrulefill} \par
\vspace{1ex}
{\bf Documento}: \makebox[.4\textwidth]{\hrulefill} \par
\vspace{1ex}
{\bf Durata}: 1.5 h + 10 minuti di lettura\par
\vspace{1ex}
{\bf Firma}:\makebox[.4\textwidth]{\hrulefill} 
\end{minipage}
\par
\bigskip
\begin{center}
\rule{\textwidth}{1pt}
\end{center}
\bigskip
\qformat{\textbf{Domanda \thequestion:} \thequestiontitle  \makebox[.4\textwidth]{\dotfill}
\emph{\totalpoints\ punti}\hfill}
\begin{questions}
\titledquestion{\textit{\textbf{Istituzioni e crescita economica}}}
For a surface $\vec{r}= \vec{r} (u \cos v, u \sin v, f(u))$. Write down the first fundamental form of the surface. Show that the parametric curves are orthogonal.
\begin{parts}
\part[10]
Explain what happens
\part[10]
Say if you agree
\end{parts}

\end{questions}
\begin{center}
\rule{\textwidth}{1pt}
\end{center}
\end{document}

The result I get is attached. enter image description here

I am pretty satisfied with the result, although there are few things that I am not able to fix:

1) How can I add some vertical space between the line "Domanda 1" and the starting of the question? I tried \bigskip or \vspace{2ex} but nothing changes.

2) Is there any chance I can automatically set the length of the lines on the right hand side such that they are aligned to the document length? I tried to do this using \makebox[.4\textwidth]{\hrulefill} or even \makebox[2ex]{\hrulefill} but nothing changed.

Can someone help me on this?

FOLLOW-UP

I made some changes to my LaTeX code. The new one is:

\documentclass[12pt,paper=a4,answers, addpoints]{exam}
\usepackage{graphicx,lastpage}
\usepackage{upgreek}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\hyphenpenalty 10000
\usepackage[paperheight=10.5in,paperwidth=8.27in,bindingoffset=0in,left=0.8in,right=1in,
top=0.7in,bottom=1in,headsep=.5\baselineskip]{geometry}
\flushbottom
\usepackage[normalem]{ulem}
\usepackage[utf8]{inputenc}
\renewcommand\ULthickness{2pt} %%---> For changing thickness of underline
\setlength\ULdepth{1.5ex}%\maxdimen ---> For changing depth of underline
\renewcommand{\baselinestretch}{1}
\pagestyle{empty}

\pagestyle{headandfoot}
\headrule
\newcommand{\continuedmessage}{%
\ifcontinuation{\footnotesize Question \ContinuedQuestion\ continues\ldots}{}%
}
\runningheader{\footnotesize Dipartimento di Economia}
{\footnotesize Analisi delle Politiche Pubbliche -- LM77}
{\footnotesize Pagina \thepage\ di \numpages}
\footrule
\footer{\footnotesize}
{}
{\ifincomplete{\footnotesize Question \IncompleteQuestion\ Continua nella pagina successiva \ldots}{\iflastpage{\footnotesize Fine paper di esame}{\footnotesize Please go on to the next page\ldots}}}

\usepackage{cleveref}
\crefname{figure}{figure}{figures}
\crefname{question}{question}{questions}
\renewcommand\thequestion{\arabic{question}}
\renewcommand{\questionlabel}{\thequestion)}
\renewcommand{\questionshook}{%
\setlength{\leftmargin}{0pt}%
\setlength{\labelwidth}{-\labelsep}%
}

\nopointsinmargin 
\pointpoints{Punto}{Punti}

\marginpointname{\points}
\pointformat{\boldmath\themarginpoints}
\bracketedpoints

\begin{document}

\thispagestyle{empty}

\noindent
\begin{minipage}[t]{\textwidth}%
\centering
\includegraphics[width=1.5cm]{logo} \par
\textit{\textbf{My University}}\par
\textit{\textbf{Dipartimento mine}} \par
\smallskip
\textit{\textbf{New one \\ Old one}} 
\end{minipage}
\par
\bigskip\bigskip
\begin{minipage}[t]{.5\textwidth}%
{\bfseries Corso di Studio}: XXX \par
\vspace{1ex}
{\bfseries Codice del corso di laurea}: XXX\par
\vspace{1ex}
{\bfseries Materia}: XXX \par
\vspace{1ex}
{\bfseries Data}: 23 Maggio 2016 \par
\vspace{1ex}
{\bfseries Docente}: XXX
\end{minipage}%
\hfill
\begin{minipage}[t]{.4\textwidth}%
{\bfseries Nome}: {\hrulefill} \par
\vspace{1ex} 
{\bfseries Matricola}: {\hrulefill} \par
\vspace{1ex}
{\bfseries Documento}: {\hrulefill} \par
\vspace{1ex}
{\bfseries Durata}: 1.5 h + 10 minuti di lettura\par
\vspace{1ex}
{\bfseries Firma}:{\hrulefill} 
\end{minipage}
\par
\bigskip
\begin{center}
\rule{\textwidth}{1pt}
\end{center}
\bigskip

\noindent\fbox{\parbox{\textwidth}{{\bfseries {Istruzioni}}: Something.}}
\begin{center}
\rule{\textwidth}{1pt}
\end{center}

\pagebreak
\qformat{\parbox[t][4ex]{\linewidth}{\textbf{Domanda \thequestion:} \thequestiontitle \dotfill \emph{\totalpoints~punti}}}

\begin{questions}
\titledquestion{\textit{\textbf{Istituzioni Politiche ed Economiche}}}
TBW
\medskip
\begin{parts}
\part[5]
Do this. \smallskip
\part[10]
Do that. \smallskip
\part[10]
Consider this.\bigskip
\end{parts}

\titledquestion{\textit{\textbf{Politiche di Liberalizzazione e Crescita Economica}}}
something
\begin{parts}
\part[10]
something
\part[10]
something
\end{parts}
\end{questions}
\end{document}

The result (of the second page) is attached:

enter image description here

Is there any chance I can increase the space between the header and the beginning of the question (the red line indicates where I would like to increase the vertical space).

Thanks in advance for your help.

4

Adding vertical skips will only make a difference if you can enter a paragraph break, which isn't permitted here. However, if you use a \parbox, you can determine a height greater than that of the text.

Droppint the \makebox and just using \dotfill avoids the need to specify the width.

Note that \bf and friends ought not be used in any LaTeX code written in the last couple of decades, since the release of 2e rendered those commands obsolete for this format.

\documentclass[11pt,paper=a4,answers, addpoints]{exam}
\usepackage{graphicx,lastpage}
\usepackage{upgreek}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\hyphenpenalty 10000
\usepackage[paperheight=10.5in,paperwidth=8.27in,bindingoffset=0in,left=0.8in,right=1in, top=0.7in,bottom=1in,headsep=.5\baselineskip]{geometry}
\flushbottom
\usepackage[normalem]{ulem}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\renewcommand\ULthickness{2pt} %%---> For changing thickness of underline
\setlength\ULdepth{1.5ex}%\maxdimen ---> For changing depth of underline
\renewcommand{\baselinestretch}{1}
\pagestyle{empty}

\pagestyle{headandfoot}
\headrule
\newcommand{\continuedmessage}{%
  \ifcontinuation{\footnotesize Question \ContinuedQuestion\ continues\ldots}{}%
}
\runningheader{\footnotesize Dipartimento of Economics}
{\footnotesize Name of the course -- Code}
{\footnotesize Page \thepage\ of \numpages}
\footrule
\footer{\footnotesize Student's name:}
{}
{\ifincomplete{\footnotesize Question \IncompleteQuestion\ continues on the next page\ldots}
  {\iflastpage{\footnotesize End of exam}{\footnotesize Please go on to the next page\ldots}}}

\usepackage{cleveref}
\crefname{figure}{figure}{figures}
\crefname{question}{question}{questions}
\renewcommand\thequestion{\arabic{question}}
\renewcommand{\questionlabel}{\thequestion)}
\renewcommand{\questionshook}{%
  \setlength{\leftmargin}{0pt}%
  \setlength{\labelwidth}{-\labelsep}%
}

\nopointsinmargin
\pointpoints{Punto}{Punti}

\marginpointname{\points}
\pointformat{\boldmath\themarginpoints}
\bracketedpoints

\begin{document}

\thispagestyle{empty}

\noindent
\begin{minipage}[t]{\textwidth}%
\centering
\includegraphics[width=1.5cm]{tiger} \par
\textit{\textbf{University of XXXX}}\par
\textit{\textbf{Dipartiment of XXXX}} \par
\textit{\textbf{Summer Session}}
\end{minipage}
\par
\bigskip\bigskip
\begin{minipage}[t]{.5\textwidth}%
  {\bfseries Corso di Studio}: Whatever\par
  \vspace{1ex}
  {\bfseries BA course code}: LM77\par
  \vspace{1ex}
  {\bfseries Subject}: Name of the course\par
  \vspace{1ex}
  {\bfseries Data}: 23 Maggio 2016 \par
  \vspace{1ex}
  {\bfseries Docente}: My Name
\end{minipage}%
\hfill
\begin{minipage}[t]{.4\textwidth}%
  {\bfseries Nome}: \makebox[.4\textwidth]{\hrulefill} \par
  \vspace{1ex}
  {\bfseries Matricola}: \makebox[.4\textwidth]{\hrulefill} \par
  \vspace{1ex}
  {\bfseries Documento}: \makebox[.4\textwidth]{\hrulefill} \par
  \vspace{1ex}
  {\bfseries Durata}: 1.5 h + 10 minuti di lettura\par
  \vspace{1ex}
  {\bfseries Firma}:\makebox[.4\textwidth]{\hrulefill}
\end{minipage}
\par
\bigskip
\begin{center}
  \rule{\textwidth}{1pt}
\end{center}
\bigskip
\qformat{%
  \parbox[t][3.5ex]{\linewidth}{%
    \textbf{Domanda \thequestion:} \thequestiontitle  \dotfill
    \emph{\totalpoints~punti}
  }%
}
\begin{questions}
  \titledquestion{\textit{\textbf{Istituzioni e crescita economica}}}
  For a surface $\vec{r}= \vec{r} (u \cos v, u \sin v, f(u))$. Write down the first fundamental form of the surface. Show that the parametric curves are orthogonal.
  \begin{parts}
    \part[10]
    Explain what happens
    \part[10]
    Say if you agree
\end{parts}

\end{questions}
\begin{center}
  \rule{\textwidth}{1pt}
\end{center}
\end{document}

exam, modified

EDIT

Responding to the follow-up in comments, do you want something like this?

long aligned lines

If so, again, don't set the width of the \hrulefill but just let it fill the space available.

\begin{minipage}[t]{.4\textwidth}%
  {\bfseries Nome}: \hrulefill \par
  \vspace{1ex}
  {\bfseries Matricola}: \hrulefill \par
  \vspace{1ex}
  {\bfseries Documento}: \hrulefill \par
  \vspace{1ex}
  {\bfseries Durata}: 1.5 h + 10 minuti di lettura\par
  \vspace{1ex}
  {\bfseries Firma}: \hrulefill
\end{minipage}
  • Thank you for your answer. Point 1 seems to be solved. I apologize for not making clear my second question. I was referring to the lines after "Nome", "Matricola", "documento" and "firma". Is there any chance I can make them automatically long and aligned to the other lines (the once before and after the question). I hope I made my point clearer than before. – Dario May 18 '16 at 1:10
  • @Dario Please see edit above. Is this what you mean? – cfr May 18 '16 at 1:18
  • By the way, you should definitely use my logo ;). – cfr May 18 '16 at 1:18
  • Indeed!!! Thank you very much! I will think of using your logo. My only concern is that my university might not like this. But I could still make a trial :) – Dario May 18 '16 at 5:59
  • @Dario Actually, it is part of the standard installation of TeX Live. Universities can be picky, though, I agree. You could always persuade them to adopt the tiger as their logo first :-). – cfr May 18 '16 at 13:11

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.