使用以下代码
\documentclass[12pt,a4paper,english]{article}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{latexsym}
%\usepackage{fancyhdr}
\addtolength{\textheight}{4cm}
\addtolength{\textwidth}{2.4cm}
\addtolength{\topmargin}{-2cm}
\addtolength{\hoffset}{-1.2cm}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\DeclareMathOperator{\sen}{sen}
\DeclareMathOperator{\arcsen}{arcsen}
\DeclareMathOperator{\tg}{tg}
\DeclareMathOperator{\arctg}{arctg}
\frenchspacing
\begin{document}
\pagestyle{empty}
%-----------------------------------------------------
%-----------------------------------------------------
%-----------------------------------------------------
% AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
\begin{center}
\large{{\bf Written examination}}
\vspace{0.2cm}
%{\bf 04/02/2019 }\\[.2cm]
{\bf 31 January 2020 }\\[.2cm]
Prof. XX and Prof. YY \\[1ex]
\vspace{0.3cm}
Surname, Name, student ID ...............................................................
\end{center}
%\noindent\large{Matricola ............................................. %Anno di corso ................................}
\vspace{0.5cm}
\noindent{\bf Solve the following exercises in full, adequately justifying the procedures followed.}
\vspace{0.3cm}
\normalsize
\end{document}
此页应包含一些在粗体部分之后立即编写的练习。
我的问题是这样的。我想在同一个文档中写多个作业模板(例如 10 个),所以我需要为每个新页面重复标题(从“笔试”到以“解决以下问题”开头的句子的部分)。我该如何在 TeX 中做到这一点?
答案1
改编
- 使用包
fancyhdr
定义你的标题\fancyhead[C]{...}
- 替换了弃用的命令,
\bf
例如\textbf{...}
- 使用包
geometry
定义页边距和页眉大小- 您可以取消注释该选项
%showframe
以查看边框 - 这也取代了那些 hacky
\addtolength
命令
- 您可以取消注释该选项
- 添加
lipsum
测试包 - 删除了不必要的包和命令
代码
\documentclass[12pt,a4paper,english]{article}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[
%showframe,
headsep=10mm,
headheight=50mm,
left=20mm,
right=25mm,
top=70mm,
bottom=30mm,
]{geometry}
\frenchspacing
\fancyhead[C]{
{
\large
\textbf{Written examination}\\[2mm]
\textbf{31 January 2020}\\[2mm]
Prof. XX and Prof. YY \\[5mm]
Surname, Name, student ID ...............................................................\\[4mm]
}
\raggedright\noindent\textbf{Solve the following exercises in full, adequately justifying the procedures followed.}
\vspace{3mm}
}
\begin{document}
\pagestyle{fancy}
\lipsum[1-10]
\end{document}