更改页面格式后分页问题

更改页面格式后分页问题

我遇到了以下问题。我正在写论文,需要将页面格式从 A4 改为 A3 以包含图表。之后,我想恢复到原始格式。

但是格式更改后,第一页末尾总是会出现不想要的分页符。我不知道如何消除它,也不知道为什么会出现这个问题。

希望您能帮助我。提前谢谢您。

\documentclass[listof=flat,a4paper,12pt,headsepline,bibliography=totoc,listof=totoc,index=totoc,cleardoublepage=empty,numbers=noenddot,headings=normal]{scrreprt}

% hack for KOMA package
\usepackage{scrhack}

% allow sophisticated control structures
\usepackage{ifthen}

% languages
\usepackage[ngerman,english]{babel}
\selectlanguage{english} % change to ngerman for a German thesis

% character encoding
\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}

% page layout
\usepackage[paper=a4paper,left=50mm,right=20mm,top=20mm,bottom=20mm]{geometry}

% page header layout
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\renewcommand{\partpagestyle}{empty}
\renewcommand{\chapterpagestyle}{scrheadings}
\setkomafont{pagenumber}{\slshape}
\ihead[]{\headmark}
\chead{}
\ohead[]{\emph{\pagemark}}
\ifoot{}
\cfoot[]{}
\ofoot{}
\automark[section]{chapter}
\renewcommand{\sectfont}{\normalfont \bfseries} % header font

% paragraph formatting
\setlength{\parindent}{0cm}
\setlength{\parskip}{6pt plus 2pt minus 2pt}

% fonts
\usepackage{times} % use times as default font
\usepackage{pifont} % enable special PostScript fonts

% use colors
\usepackage{color}

% linespacing
\usepackage{setspace}

%possible penalties for layouting
%\binoppenalty=10000
%\relpenalty=10000
%\interfootnotelinepenalty=10000
%\brokenpenalty=10000
%\clubpenalty=10000
%\widowpenalty=10000
%\hyphenpenalty=5000
%\tolerance=3000

% numbering
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\usepackage{chngcntr}
\counterwithout{footnote}{chapter} % footnotes are numbered throughout the text

% fancy math
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}

% sophisticated enumerations
\usepackage{enumerate}

% fancy tables
\usepackage{booktabs}

% algorithms & code listings
\usepackage[english,vlined,algoruled]{algorithm2e}
\usepackage{listings}

% graphics & charts
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

% Load float package, for enabling floating extensions
\usepackage{float}

% allow rotations
\usepackage{rotating}

% hyperlinks in PDF-document
\usepackage[colorlinks=true,linkcolor=black,citecolor=black,anchorcolor=black,urlcolor=black,pdftex]{hyperref}

% set the bibliography style
\usepackage[round]{natbib}
\bibliographystyle{bibliography/biblio_style}


\usepackage{tabularx}
\usepackage{multirow}
\usepackage{enumitem} 
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{ltxtable}
\usepackage{amsmath}
\usepackage{afterpage}
\usepackage{lipsum}

\begin{document}

\lipsum[7-15]

Figure \ref{Big figure}.

\afterpage{
\clearpage
\KOMAoptions{paper=A3, paper=landscape, pagesize}
\addtolength{\hoffset}{-3.5cm}
\recalctypearea
\begin{figure}[h]
   \includegraphics[height=1.25\textheight,width=1.25\textwidth,keepaspectratio]{images/leon.JPEG}
   \caption{Big picture}
     \label{Big picture}
\end{figure}
\clearpage
\KOMAoptions{paper=A4, paper=portrait, pagesize}
\recalctypearea
}

\lipsum[1-15]

\end{document}

这就是我的意思:
在此处输入图片描述

答案1

您的 MWE 无法编译。您看到软件包的警告了吗typearea

包 typearea 警告:\typearea 在组级别 3 中使用。在任何组(例如环境、数学模式、框等)内使用 \typearea 可能会导致许多排版问题。您应该将命令 \typearea 移到输入行 130 上的所有组之外。

您可以在固定位置的所有组外插入图片。要保存页面布局,请使用类似\storeareas\savedlayout。然后,您可以使用 恢复页面布局\savedlayout

\documentclass[12pt,
    parskip=half-% do not set parskip manually
]{scrreprt}
% page layout
\usepackage[left=50mm,right=20mm,top=20mm,bottom=20mm]{geometry}
% page header layout
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\ohead{\pagemark}
\cfoot{to show the footer position}
\renewcommand{\partpagestyle}{empty}
\renewcommand{\chapterpagestyle}{scrheadings}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\lipsum[7-15]
Figure \ref{Big picture}.

\clearpage
\storeareas\savedlayout
\KOMAoptions{paper=a3, paper=landscape, DIV=25}
\includegraphics[height=.95\textheight,width=\linewidth]{example-image}
\captionof{figure}{Big picture}
\label{Big picture}
\clearpage
\savedlayout

\lipsum[1-15]
\end{document}

另一种可能性是使用虚拟页面和虚拟标题作为文档中的占位符:

\documentclass[12pt,
parskip=half-% do not set parskip manually
]{scrreprt}
 %page layout
\usepackage[left=50mm,right=20mm,top=20mm,bottom=20mm]{geometry}
 %page header layout
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\ohead{\pagemark}
\cfoot{to show the footer position}
\renewcommand{\partpagestyle}{empty}
\renewcommand{\chapterpagestyle}{scrheadings}
\usepackage{afterpage}
\usepackage{lipsum}
\begin{document}
\captionof{figure}{picture}
\captionof{figure}{picture}
\captionof{figure}{picture}
\lipsum[7-15]
Figure \ref{Big picture}

\afterpage{
\clearpage
This page should be replaced in a second step.
\captionof{figure}{Big picture}\label{Big picture}
\clearpage
}

\lipsum[1-15]
\end{document}

第二步,替换占位符:

\documentclass{scrreprt}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=1-2]{mydoc.pdf}% pages before dummy page
%
\storeareas\savedlayout
\clearpage
\setcounter{figure}{3}% set the figure number
\KOMAoptions{paper=a3,paper=landscape,DIV=20}
\centering
\includegraphics[height=.95\textheight,width=\linewidth]{example-image}
\captionof{figure}{Big picture}
\clearpage
\savedlayout
%
\includepdf[pages=4-]{mydoc.pdf}% pages after the dummy page
\end{document}

相关内容