答案1
这是一种相当粗糙(但足够)的构建阴影框的方法。\headrulewidth
指定更宽/更厚的规则,同时\hrulefill
设置更薄/更规则的规则。
\documentclass[twoside]{article}
\usepackage{fancyhdr,xcolor}
\usepackage{lipsum}
\setlength{\headheight}{20pt}% Adjust based on content
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{2pt}% Thick header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule (default)
\fancyhead[LO]{Some header text \hrulefill\hspace*{4em}}%
\fancyhead[RO]{
\raisebox{\depth}[0pt][0pt]{\makebox[0pt][r]{\colorbox{black}{\makebox[4em]{\phantom{\thepage}}}\hspace*{2pt}}}%
\makebox[0pt][r]{\raisebox{5pt}{\fcolorbox{black}{white}{\makebox[4em]{\thepage}}}}%
}
\fancyhead[RE]{\hspace*{4em}\hrulefill Some header text}%
\fancyhead[LE]{
\raisebox{\depth}[0pt][0pt]{\makebox[0pt][l]{\colorbox{black}{\makebox[4em]{\phantom{\thepage}}}}}%
\makebox[0pt][l]{\hspace*{2pt}\raisebox{5pt}{\fcolorbox{black}{white}{\makebox[4em]{\thepage}}}}%
}
\pagestyle{fancy}
\begin{document}
\sloppy\lipsum[1-50]
\end{document}