由于某种原因,第二页(标题页之后的页面)的页码丢失了。我正在使用两种不同的页面样式。它被计算但没有显示。
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[eng]{diku}
\usepackage{hyperref}
\usepackage{fancyhdr}
\usepackage{extramarks}
%\usepackage[linktoc=all]{hyperref}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{titlesec}
%\usepackage{parskip} % Space between paragraphs
\usepackage{mathtools}
%These two are for linebreak in verbatim
\usepackage{fancyvrb}
\usepackage{fvextra}
\usepackage{xcolor}
%\usepackage[margin=1.3in]{geometry}
\usepackage{listings}
\usepackage{caption}
\usepackage{verbatim}
\usepackage{stmaryrd}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{chngcntr}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage[newfloat]{minted}
\usepackage{fancyvrb}
\newcommand\userinput[1]{\textbf{#1}}
\usepackage{tgcursor}
\fancyhead[R]{\thepage}
\fancyhead[L]{\textsl{\leftmark}}
\fancyfoot[C]{}% Custom footer
\renewcommand{\headrulewidth}{0pt}% Line at the header visible
\renewcommand{\footrulewidth}{0pt}% Line at the footer visible
\counterwithout{equation}{chapter}
\providecommand*{\listingautorefname}{Listing} % For autoref listings
% Redefine the plain page style
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[C]{--~\thepage~--}%
\renewcommand{\headrulewidth}{0pt}% Line at the header invisible
\renewcommand{\footrulewidth}{0pt}% Line at the footer visible
}
\setlength{\headheight}{22.43335pt}
\begin{document}
\renewcommand{\thelstlisting}{\thechapter.\arabic{lstlisting}}
\renewcommand{\thelisting}{\thechapter.\arabic{listing}}
\pagenumbering{roman}
\setcounter{page}{2}
{
\pagestyle{plain}
\clearpage
\maketitle
\section*{\centering Abstract}
...
\newpage
\section*{\centering Acknowledgements}
...
\newpage
\tableofcontents
\cleardoublepage
}
\pagenumbering{arabic}
\setcounter{page}{1}
\pagestyle{fancy}
\chapter{Introduction}
\end{document}
这是diku.sty
,
%See ReadMe.tex
\ProvidesPackage{diku}[15/9/2016 - this version should work for most people]
\RequirePackage{geometry} %Requires the geometry package to change margins on the front page
\RequirePackage{wrapfig} %Requires wrapfig to put logo next to signature
\RequirePackage[utf8]{inputenc}
%%Packages for the background picture
\RequirePackage{graphicx} %Requires the graphicx package to show a logo picture
\RequirePackage{eso-pic} %Requires the eso-pic package to change the background
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package description for n00b options %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\DeclareOption*{\PackageWarning{nbi}{Unknown ‘\CurrentOption’. Please choose either options: 'dan' or 'eng'}}
\DeclareOption*{%
\PackageWarning{diku}{I think you mistyped something in the Packageoption. The options are 'dan' or 'eng'. You typed: '\CurrentOption'}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package description for option: 'eng'(English) %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Declare option: English frontpage (eng)
\DeclareOption{eng}{
%%New commands for filling out the front page with annoying prefilled lines
\title{PREP} %Filling a title, if forgotten
\newcommand*{\authora}[1]{\gdef\@authora{#1}}
\newcommand*{\@authora}{Name}
\newcommand*{\authorb}[1]{\gdef\@authorb{#1}}
\newcommand*{\@authorb}{Name}
\newcommand*{\emailaa}[1]{\gdef\@emaila{#1}}
\newcommand*{\@emaila}{email}
\newcommand*{\emailb}[1]{\gdef\@emailb{#1}}
\newcommand*{\@emailb}{email}
%Provide subtitle
\newcommand*{\subtitle}[1]{\gdef\@subtitle{#1}}
\newcommand*{\@subtitle}{Title}
%Provide title
\newcommand*{\project}[1]{\gdef\@project{#1}}
\newcommand*{\@project}{Masters Thesis}
%Provide supervisor(s)
\newcommand*{\supervisor}[1]{\gdef\@supervisor{#1}}
\newcommand*{\@supervisor}{Supervisor}
%%Commands for registration and cataloguing
%Provide an institute
\newcommand*{\institute}[1]{\gdef\@institute{#1}}
\newcommand*{\@institute}{Institute}
%Provide a department
\newcommand*{\department}[1]{\gdef\@department{#1}}
\newcommand*{\@department}{Program Language T C}
%Provide an email:
\newcommand*{\email}[1]{\gdef\@email{#1}}
\newcommand*{\@email}{email \& email}
%Provide handin date
\newcommand*{\handindate}[1]{\gdef\@handindate{#1}}
\newcommand*{\@handindate}{31.10.2022 \texttt{\handindate}}
%Provide defence date
\newcommand*{\defencedate}[1]{\gdef\@defencedate{#1}}
\newcommand*{\@defencedate}{28.06.2023}
%%Command for background - well, it will become a command when I'm done :-)
%Define frontpage
\newcommand*{\frontpage}[1]{\gdef\@frontpage{#1}}
\newcommand*{\@frontpage}{KuRedCircle}
%Define frontpage
\newcommand*{\secondpage}[1]{\gdef\@secondpage{#1}}
\newcommand*{\@secondpage}{KuRed}
%Command for background (only on one page)
\newcommand*{\background}[1]{\AddToShipoutPicture*{\includegraphics[width=0.9\paperwidth, height=0.9\paperheight]{\@background{#1}}}}
\newcommand*{\@background}{}
\renewcommand*{\maketitle}{%Define the content of the frontpage
\begin{titlepage}
\newgeometry{margin=1.5cm,vmargin=2cm}
% \background{KuRedCircle}
{\scshape\large University\par}
\vspace*{4cm}
\centering
{\Huge\scshape\@title\unskip\strut\par}
{\LARGE \@subtitle\unskip\strut\par}
\vspace{1cm}
%{\Large\scshape \@project\unskip\strut\par}
{\large\@authora\unskip\strut\par}
{\large\texttt{\@emaila}\unskip\strut\par}
\vspace{0.5cm}
{\large\@authorb\unskip\strut\par}
{\large\texttt{\@emailb}\unskip\strut\par}
\vspace{0.5cm}
{\large \@date\par
\vspace{0.5cm}
Supervised by\par
\@supervisor\unskip\strut\par}
\vfill
% \begin{wrapfigure}{r}{6.5cm}
% \vspace{-4cm}
% \includegraphics[width=5cm]{RkuEng}
% \end{wrapfigure}
\restoregeometry
\end{titlepage}
}
}
\ExecuteOptions{\CurrentOption}
\ProcessOptions \relax
\endinput
我希望摘要页为 1,致谢页为 2,目录为 3,页码为罗马字体并位于页面底部。然后页码应使用花式页面样式并\chapter{Introduction}
重置为 1。目前致谢页为 2,但摘要页的页码根本没有显示?
答案1
更新在文件中 diku.sty
使用
\renewcommand*{\maketitle}{%Define the content of the frontpage
\newgeometry{margin=1.5cm}% here <<<<<<<<<<
\begin{titlepage}
...
\end{titlepage}
\restoregeometry %here <<<<<<
}
(页面几何形状的改变是在titlepage
环境之外完成的)
\renewcommand*{\maketitle}{%Define the content of the frontpage
\newgeometry{margin=1.5cm}% here <<<<<<<<<<
\begin{titlepage}
% \background{KuRedCircle}
{\scshape\large University\par}
\vspace*{4cm}
\centering
{\Huge\scshape\@title\unskip\strut\par}
{\LARGE \@subtitle\unskip\strut\par}
\vspace{1cm}
%{\Large\scshape \@project\unskip\strut\par}
{\large\@authora\unskip\strut\par}
{\large\texttt{\@emaila}\unskip\strut\par}
\vspace{0.5cm}
{\large\@authorb\unskip\strut\par}
{\large\texttt{\@emailb}\unskip\strut\par}
\vspace{0.5cm}
{\large \@date\par
\vspace{0.5cm}
Supervised by\par
\@supervisor\unskip\strut\par}
\vfill
% \begin{wrapfigure}{r}{6.5cm}
% \vspace{-4cm}
% \includegraphics[width=5cm]{RkuEng}
% \end{wrapfigure}
%
\end{titlepage}
\restoregeometry%here <<<<<<
}
使用此 MWE 和修改后的diku.sty
% !TeX TS-program = pdflatex
\documentclass{report}
\usepackage[eng]{diku} % uses the modified version <<<
\usepackage{fancyhdr}
\fancypagestyle{fancy}{%
\fancyhead[R]{\thepage}
\fancyhead[L]{\textsl{\leftmark}}
\fancyfoot[C]{}% Custom footer
\renewcommand{\headrulewidth}{0pt}% Line at the header visible
\renewcommand{\footrulewidth}{0pt}% Line at the footer visible
}
% Redefine the plain page style
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[C]{--~\thepage~--}%
\renewcommand{\headrulewidth}{0pt}% Line at the header invisible
\renewcommand{\footrulewidth}{0pt}% Line at the footer visible
}
\setlength{\headheight}{25pt}
%***************** for testing
\usepackage{showframe} %Only to show the margins
\usepackage{kantlipsum}% dummy text
%*****************
\begin{document}
\pagenumbering{roman}
{%
\pagestyle{plain}
\maketitle
\section*{\centering Abstract}
\kant[1]
\newpage
\section*{\centering Acknowledgements}
\kant[2]
\newpage
\tableofcontents
\cleardoublepage
}
\pagenumbering{arabic}
\setcounter{page}{1}
\pagestyle{fancy}
\chapter{Introduction}
\kant[1-5]
\end{document}
结果是