有没有办法在不使用 Fancyhdr 包的情况下编写带有左对齐和右对齐文本的标题?
答案1
我定义了一些宏以便于访问标题。您必须使用twoside
documentclass 的选项来实际区分奇数页和偶数页(并非所有页面都被视为奇数页)。
\documentclass[twoside]{article}
% Use some ridicolouosly small paper for demonstration
\usepackage[a6paper]{geometry}
\makeatletter
\newcommand\oddhead[1]{\gdef\@oddhead{\reset@font#1}}
\newcommand\evenhead[1]{\gdef\@evenhead{\reset@font#1}}
\newcommand\oddfoot[1]{\gdef\@oddfoot{\reset@font#1}}
\newcommand\evenfoot[1]{\gdef\@evenfoot{\reset@font#1}}
\makeatother
\oddhead{\hfil Some header on odd pages\hfil}
\evenhead{\hfil Some header on even pages\hfil}
\oddfoot{\hfil Some footer on odd pages\hfil}
\evenfoot{\hfil Some footer on even pages\hfil}
\begin{document}
Odd page
\clearpage
Even page
\end{document}