使用 scrpage2 和 lastpage 修改页眉上的页码

使用 scrpage2 和 lastpage 修改页眉上的页码

我正在使用 Plasmati Graduate CV Latex 模板撰写简历。我使用软件包做了一些修改,以便添加页脚和页眉scrpage2最后一页。我对最终的页脚很满意,但对页眉中的页码编号有问题。

在页眉中,页码出现了两次(见图):

  1. 格式为“页数/总页数”(这是我想要的);
  2. 仅右上角有页码。

我想删除简单的页码(即上面列表的元素 2),只保留“页面/总页数”格式。

这可能吗?

我使用的代码是:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plasmati Graduate CV
% LaTeX Template
% Version 1.0 (24/3/13)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Alessandro Plasmati ([email protected])
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
% Important note:
% This template needs to be compiled with XeLaTeX.
% The main document font is called Fontin and can be downloaded for free
% from here: http://www.exljbris.com/fontin.html
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%-----------------------------------------------------------------------

\documentclass[a4paper,12pt]{article} % Default font size and paper size

\usepackage{fontspec} % For loading fonts
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin} % Main document font

\usepackage{xunicode,xltxtra,url,parskip} % Formatting packages

\usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom   colors

\usepackage[big]{layaureo} % Margin formatting of the A4 page, an alternative to layaureo can be \usepackage{fullpage}
% To reduce the height of the top margin uncomment: \addtolength{\voffset}{-1.3cm}

\usepackage{hyperref} % Required for adding links   and customizing them
\definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour}     % Set link colors throughout the document

\usepackage{titlesec} % Used to customize the \section command
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
\titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections
\titleformat{\subsection}{\large\itshape\raggedright}{}{0em}{} % Text formatting of subsections


\newcommand\tab[1][2.58cm]{\hspace*{#1}} % Horizontal space

\usepackage{scrpage2} % Provides headers and footers configuration
\usepackage{marvosym} % Allows the use of symbols
\usepackage{xecolor} %Package for colors
\usepackage{blindtext}

%----------------------------------------------------------------------------------------
% HEADER SECTION
%----------------------------------------------------------------------------------------


\usepackage{lastpage} % To show the page number as "N/TOT"
\chead[\pagemark]{\hfil \thepage/\pageref*{LastPage} \hfil}

%----------------------------------------------------------------------------------------
% FOOTER SECTION
%----------------------------------------------------------------------------------------

\cfoot{
\addfontfeature{LetterSpace=20.0}\fontsize{9.0}{18}\selectfont % Letter spacing and font size

\textcolor{gray}{NNN \textsc{SSS}} \\ % Name and date
\textcolor{gray}{{\Large\Letter} [email protected] \ {\Large\Telefon} (+00)    123456789} \\% Your email address and phone number
}

\begin{document}

\pagestyle{scrheadings} % Removes page numbering

\font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the skills section


%----------------------------------------------------------------------------------------
%   CV
%----------------------------------------------------------------------------------------

\par{\centering{\Huge NNN \textsc{SSS}}\bigskip\par} % Your name

\section{Personal details}

\blinditemize

\section{Business details}

\blinditemize

\section{Education}

\blinditemize

\section{Areas of interest}

\blinditemize

\section{Teaching activity}

\blinditemize

\section{Other activities} 

\blinditemize

\end{document}

这是最终的 pdf:

在此处输入图片描述

谢谢!

答案1

用于\clearscrheadfoot在设置自己的内容之前删除页眉和页脚字段的预定义内容。

\usepackage{scrpage2}
\clearscrheadfoot
\chead{\thepage/\pageref*{LastPage}}
\cfoot{<your footer>}
\pagestyle{scrheadings}

或者您也可以添加\ohead[]{}到您的代码中。

相关内容