每页页数(共 ## 页)

每页页数(共 ## 页)

我正在编写我的课程

\documentclass[11pt]{scrartcl}

\usepackage[english]{babel}

\usepackage{currvita}

\usepackage{fancyhdr}

\usepackage{graphicx}

\usepackage{multicol}

\usepackage{makecell}

\usepackage{lastpage}

\usepackage{hyperref}


\tolerance=600 

\setlength{\textheight}{235mm}

\raggedright

\begin{document}

\setlength{\cvlabelwidth}{40mm}

\sffamily

\pagestyle{fancy}

\lhead[\sffamily Curriculum Vitae]{\sffamily Curriculum Vitae}

\rhead[\sffamily Name]{\sffamily Name}

\thispagestyle{empty}

\cfoot{\thepage\ of \pageref{LastPage}}

\date{}

\end{document}

除了第一页以外,我每页的页码都正确,第一页没有页码。如果我删除,\thispagestyle{empty}我也会在第一页上获得页码,但我也会获得页眉

\lhead[\sffamily Curriculum Vitae]{\sffamily Curriculum Vitae}

\rhead[\sffamily Name]{\sffamily Name}

我不希望它出现在第一页。您知道我怎样才能在第一页上放置编号而不删除吗\thispagestyle{empty}

答案1

firstpage创建与常规页面样式不同的单独页面样式fancy

在此处输入图片描述

\documentclass{article}

\usepackage{fancyhdr,lastpage,lipsum}
\usepackage{hyperref}

\pagestyle{fancy}% The default page style
\fancyhf{}% Clear header/footer
\lhead[\sffamily Curriculum Vitae]{\sffamily Curriculum Vitae}
\rhead[\sffamily Name]{\sffamily Name}
\cfoot{\thepage\ of \pageref*{LastPage}}
\renewcommand{\headrulewidth}{0pt}% No header rule

\fancypagestyle{firstpage}{
  \fancyhf{}% Clear header/footer
  \cfoot{\thepage\ of \pageref*{LastPage}}
  \renewcommand{\headrulewidth}{0pt}% No header rule
}
\begin{document}

\thispagestyle{firstpage}% Only this page should have the firstpage style
                         % All other pages will have fancy

\lipsum

\end{document}

相关内容