答案1
这是一个tabular*
基于的版本:
\documentclass{article}
\usepackage{booktabs}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{48.2pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}cr}
\multicolumn{3}{c}{\scshape Department of Mathematics}\\ [5pt]
\toprule
\scshape MATHS 254S2 & Tutorial 1 (Week 2) & July 26/30, 2021 \\
\bottomrule
\end{tabular*}
}
\usepackage{lipsum} % For dummy text. Do not use in actual document.
\begin{document}
\lipsum
\end{document}
答案2
fancyhdr
一种可能的方式是将包和命令结合起来\rule
。
\documentclass{article}
\usepackage{lipsum}%to involke text examples
%%%to set page head and foot%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}%调用宏包
%set new plain style----------------------------
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}}
\renewcommand{\headrulewidth}{0pt}
\title{A Test}
\begin{document}
\maketitle
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{
{\small\scshape Department of Mathematics}
\\[-.2em]\rule{\textwidth}{0.4pt}
\\[-.2em]{\small MATHS 254S2\hfill Tutorial 1 (Week 2)\hfill July 26/30, 2021}
\\[-.7em]\rule{\textwidth}{0.4pt}
}
\fancyfoot[C]{\small\thepage}
\lipsum[1-10]
\end{document}
输出如下: