![latex 中的页眉](https://linux22.com/image/429845/latex%20%E4%B8%AD%E7%9A%84%E9%A1%B5%E7%9C%89.png)
我想在我的乳胶文档的每一页的顶部创建以下内容。
这是我的 MWE。
\documentclass[12pt,a4paper,twoside,english,pdfprintscaling=none]{article}
\usepackage{color}
\definecolor{shadecolor}{rgb}{0.667969, 0.0234375, 0.496094}
\begin{document}
\begin{flushright}
{\fboxsep 1pt\framebox[1\textwidth][l]{%
\begin{minipage}[b][1\totalheight][c]{4.1cm}%
\begin{shaded}%
\begin{flushright}
\textsf{\textbf{\textcolor{white}{\large{}Year Twelve}}}
\par\end{flushright}\end{shaded}%
\end{minipage}}}
\par\end{flushright}
\end{document}
这是我的输出:
答案1
fancyhrd
在和的帮助下nicematrix
:
\documentclass[12pt,a4paper,twoside]{article}
\usepackage{xcolor}
\definecolor{shadecolor}{rgb}{0.667969, 0.0234375, 0.496094}
\usepackage{fancyhdr}
\usepackage{nicematrix}
\usepackage{cellspace}
\renewcommand{\headrulewidth}{0pt}
\fancyhead{}
\fancyhead{%
\NiceMatrixOptions{cell-space-top-limit = 3pt}
\begin{NiceTabular}[colortbl-like]{wr{4.5cm}m{\dimexpr\textwidth-4.5cm-4\tabcolsep-3\arrayrulewidth}}[hvlines]
\cellcolor{shadecolor}\Large\color{white}\bfseries\sffamily Year Twelve & \\
\end{NiceTabular}
}
\pagestyle{fancy}
\setlength{\headheight}{36pt}
\usepackage{lipsum} % for dummy text. Do not use in real document.
\begin{document}
\lipsum
\end{document}