报告中的全局页码

报告中的全局页码

如果想要覆盖不在摘要中添加页码的设置,则会遇到一些复杂情况report

我在摘要中引入了页码,按照在摘要中包含页码

但是,我需要手动引入\addtocounter{page}{}以便对齐报告不同部分的页码,如下例所示:

\documentclass{report}
\title{some title}
\usepackage{lipsum}
\begin{document}
\setcounter{page}{2}
some introduction
\begin{abstract}
\addtocounter{page}{2}
  \thispagestyle{plain}
  \lipsum[1]
\end{abstract}
\addtocounter{page}{3}
\lipsum[2]
\end{document}

有没有办法强制报告中的不同部分继承上一节的页数?

答案1

使用更好的类:

\documentclass[abstract=on]{scrreprt}

\title{some title}
\usepackage{lipsum}
\begin{document}
\setcounter{page}{2}
some introduction

\begin{abstract}
\thispagestyle{plain}
\lipsum[1]
\end{abstract}
\lipsum[2]
\end{document}

答案2

由于我不清楚的原因,report封闭abstract在一个titlepage环境中。

只需修补它即可避免这种情况。

\documentclass{report}
\usepackage{etoolbox}

\usepackage{lipsum}

\patchcmd{\abstract}{\titlepage}{\cleardoublepage}{}{}
\patchcmd{\endabstract}{\endtitlepage}{\clearpage}{}{}

\begin{document}

\title{some title}

some introduction

\begin{abstract}
  \lipsum[1]
\end{abstract}

\lipsum[2]

\end{document}

控制台输出显示页码是连续的。

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./vies.tex
LaTeX2e <2018-12-01>
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/report.cls
Document Class: report 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex))
(./vies.aux) [1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdfte
x.map}] [2] [3] (./vies.aux) )</usr/local/texlive/2018/texmf-dist/fonts/type1/p
ublic/amsfonts/cm/cmbx10.pfb></usr/local/texlive/2018/texmf-dist/fonts/type1/pu
blic/amsfonts/cm/cmr10.pfb>
Output written on vies.pdf (3 pages, 29462 bytes).
Transcript written on vies.log.

相关内容