![页眉中的左侧和右侧文本不带 Fancyhdr](https://linux22.com/image/305118/%E9%A1%B5%E7%9C%89%E4%B8%AD%E7%9A%84%E5%B7%A6%E4%BE%A7%E5%92%8C%E5%8F%B3%E4%BE%A7%E6%96%87%E6%9C%AC%E4%B8%8D%E5%B8%A6%20Fancyhdr.png)
有没有办法在不使用 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}