使用特定的 LaTeX 模板来包裹页脚的文本

使用特定的 LaTeX 模板来包裹页脚的文本

我是 LaTeX 新手(使用经验不到 48 小时),目前正在使用 TeXnicCenter 提供的“技术报告”模板撰写白皮书(代码可在http://pastebin.com/mku5maC6

我想添加两个句子的披露页脚,但我的文本溢出了页面,并且我收到了“溢出”错误。 两者都没有\sloppy解决\usepackage{microtype}问题。

有问题的代码是:

% ********* Header and Footer **********
% This is something to play with forever. I use here the advanced settings of the KOMA script

\usepackage{scrpage2} %header and footer using the options for the KOMA script
\renewcommand{\headfont}{\footnotesize\sffamily} % font for the header
\renewcommand{\pnumfont}{\footnotesize\sffamily} % font for the pagenumbers

%the following lines define the pagestyle for the main document
\defpagestyle{cb}{%
(\textwidth,0pt)% sets the border line above the header
{\pagemark\hfill\headmark\hfill}% doublesided, left page
{\hfill\headmark\hfill\pagemark}% doublesided, right page
{\hfill\headmark\hfill\pagemark}%  onesided
(\textwidth,1pt)}% sets the border line below the header
%
{(\textwidth,1pt)% sets the border line above the footer
{{\it Federation Confidential}\hfill Chief O'Brian}% doublesided, left page
{Chief O'Brian\hfill{\it Federation Confidential}}% doublesided, right page
{Chief O'Brian\hfill{\it Federation Confidential}} % one sided printing
(\textwidth,0pt)% sets the border line below the footer
}

我的尝试:

% ********* Header and Footer **********
% This is something to play with forever. I use here the advanced settings of the KOMA     script

\usepackage{scrpage2} %header and footer using the options for the KOMA script
\renewcommand{\headfont}{\footnotesize\sffamily} % font for the header
\renewcommand{\pnumfont}{\footnotesize\sffamily} % font for the pagenumbers

%%the following lines define the pagestyle for the main document
\defpagestyle{cb}{%
(\textwidth,0pt)% sets the border line above the header
{\pagemark\hfill\headmark\ Company X, LLC}% doublesided, left page
{Company X, LLC\headmark\hfill\pagemark}% doublesided, right page
{Company X, LLC\headmark\hfill\pagemark}%  onesided
(\textwidth,1pt)}% sets the border line below the header
%
{(\textwidth,1pt)% sets the border line above the footer
{\it This document contains unpublished confidential and proprietary information of      Company X. No disclosure or use of
any portion of these materials may be made without the express written consent of   Company X.}% doublesided, left page
{\it This document contains unpublished confidential and proprietary information of   Company X. No disclosure or use of
any portion of these materials may be made without the express written consent of  Company X.}% doublesided, right page
{\it This document contains unpublished confidential and proprietary information of Company X. No disclosure or use of
any portion of these materials may be made without the express written consent of Company     X.} % one sided printing
(\textwidth,0pt)% sets the border line below the footer
}

任何帮助或指导都将不胜感激。

答案1

页脚的参考点位于固定位置,因此需要使用\parbox[t]{...}{...};这是一个例子:

\documentclass[a4paper]{scrreprt}

\usepackage{scrpage2} %header and footer using the options for the KOMA script
\renewcommand{\headfont}{\footnotesize\sffamily} % font for the header
\renewcommand{\pnumfont}{\footnotesize\sffamily} % font for the pagenumbers

\newcommand{\confidentialtext}{\parbox[t]{\textwidth}{This document contains unpublished
  confidential and proprietary information of Company X. No disclosure or use of any
  portion of these materials may be made without the express written consent of Company X.}}

%%the following lines define the pagestyle for the main document
\defpagestyle{cb}{%
  (\textwidth,0pt)% sets the border line above the header
  {\pagemark\hfill\headmark\ Company X, LLC}% doublesided, left page
  {Company X, LLC\headmark\hfill\pagemark}% doublesided, right page
  {Company X, LLC\headmark\hfill\pagemark}%  onesided
  (\textwidth,1pt)}% sets the border line below the header
%
  {(\textwidth,1pt)% sets the border line above the footer
  {\slshape\confidentialtext}% doublesided, left 
  {\slshape\confidentialtext}% doublesided, right page
  {\slshape\confidentialtext}% one sided printing
  (\textwidth,0pt)% sets the border line below the footer
}

\usepackage{kantlipsum} % for the mock text

\begin{document}
\pagestyle{cb}
\kant
\end{document}

请注意,我已将页脚文本设置为更方便的形式:使用宏,您无需反复编辑相同的文本。由于它是无衬线字体,因此\slshape更适合。

在此处输入图片描述

相关内容