编辑

编辑

我正在尝试用 Latex 编写我的试卷。我从在网站上找到的模板开始,并做了一些更改。实际上,我使用的代码如下:

\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}

我得到的结果已附上。在此处输入图片描述

我对结果非常满意,尽管有一些事情我无法解决:

1) 如何在“Domanda 1”行和问题开头之间添加一些垂直空间?我尝试了 \bigskip 或 \vspace{2ex},但没有任何变化。

2) 我是否可以自动设置右侧线条的长度,使其与文档长度对齐?我尝试使用 \makebox[.4\textwidth]{\hrulefill} 甚至 \makebox[2ex]{\hrulefill} 执行此操作,但没有任何变化。

有人能帮我吗?

跟进

我对我的 LaTeX 代码做了一些更改。新的代码是:

\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}

附上(第二页)结果:

在此处输入图片描述

我是否可以增加标题和问题开头之间的空间(红线表示我想增加垂直空间的地方)。

在此先感谢您的帮助。

答案1

只有当您能输入段落分隔符时,添加垂直跳跃才会产生影响,但此处不允许这样做。但是,如果您使用\parbox,则可以确定大于文本的高度。

删除\makebox并只使用\dotfill避免了指定宽度的需要。

请注意,\bf和朋友不应该在过去几十年编写的任何 LaTeX 代码中使用,因为 2e 的发布使得这些命令对于这种格式来说已经过时。

\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}

考试,修改

编辑

回应评论中的后续问题,你想要这样的东西吗?

长对齐线

如果是这样,同样不要设置宽度,\hrulefill而只是让它填充可用空间。

\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}

相关内容