在LaTeX中,如何使用信函文档类创建文档,但使用定制的页眉和页脚?
通常我会使用:
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\footnotesize \parbox{11cm}{Custom left-head-note} }
\lfoot{\footnotesize \parbox{11cm}{\textit{#2}}}
\rfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}
\renewcommand\headheight{24pt}
\renewcommand\footrulewidth{0.4pt}但是,对于\documentclass{信函},这一点都不起作用。建议得到应有的赞赏。
编辑:这里的是不工作的示例代码(出于任何明显的原因):
\documentclass[12pt]{letter}
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{xltxtra} % some fixes/extras
% page counting, header/footer
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\lhead{\footnotesize \parbox{11cm}{Draft 1} }
\lfoot{\footnotesize \parbox{11cm}{\textit{2}}}
\cfoot{}
\rhead{\footnotesize 3}
\rfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headheight}{24pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\name{ Joe Laroo }
\signature{ Joe Laroo }
\begin{letter}{ To-Address }
\renewcommand{\today}{ February 16, 2009 }
\opening{ Opening }
Content of the letter.
\closing{ Yours truly, }
\end{letter}
\end{document}发布于 2009-02-18 16:06:41
就在“信函内容”行的前面,添加\thispagestyle{fancy},它应该显示您定义的标题。(对我来说很管用。)
下面是我用来测试的完整文档:
\documentclass[12pt]{letter}
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{xltxtra} % some fixes/extras
% page counting, header/footer
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\lhead{\footnotesize \parbox{11cm}{Draft 1} }
\lfoot{\footnotesize \parbox{11cm}{\textit{2}}}
\cfoot{}
\rhead{\footnotesize 3}
\rfoot{\footnotesize Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headheight}{24pt}
\renewcommand{\footrulewidth}{0.4pt}
\usepackage{lipsum}% provides filler text
\begin{document}
\name{ Joe Laroo }
\signature{ Joe Laroo }
\begin{letter}{ To-Address }
\renewcommand{\today}{ February 16, 2009 }
\opening{ Opening }
\thispagestyle{fancy}% sets the current page style to 'fancy' -- must occur *after* \opening
\lipsum[1-10]% just dumps ten paragraphs of filler text
\closing{ Yours truly, }
\end{letter}
\end{document}\opening命令将页面样式设置为firstpage或empty,因此必须在该命令之后使用\thispagestyle。
发布于 2009-02-18 14:16:46
在我移除之后
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{xltxtra} % some fixes/extras 它似乎“正确地”起了作用。
值得注意的是,页眉和页脚仅从第2页开始出现。虽然我已经尝试了fancyhdr文档中给出的修复方法,但我也无法让它工作。
MikTeX 2.7在Vista下
发布于 2009-02-18 15:05:43
关于Brent.Longborough的答案(只在第2页继续),也许您需要在\begin{document}.之后设置\begin{document}.我不知道信函类是否将第一页样式设置为空。
https://stackoverflow.com/questions/559938
复制相似问题