我有一个类似的问题这个,但那里提出的解决方案对我来说不起作用。我想在有页眉(章节标题)和页脚(页码)的文档中插入一个大图形。由于图形及其标题的大小,它不能很好地适合页眉/页脚所限定的区域,所以我想删除它们并将图像放在干净的页面上。
我见过一些涉及该afterpage
包的解决方案,但我从来没有让它按预期工作;我总是最终得到一个干净的页面后图形(见下面的示例)。另外,有人建议使用fancyhdr
的\iffloatpage
功能,但我只想将此页面样式应用于某些具有该[p]
位置的图形,而不是全部。
\documentclass[twoside]{book}
% Import some packages
\usepackage{afterpage}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage[font={small}]{caption} % Figure/table caption style
% Desired page dimensions
\usepackage{geometry}
\geometry{paperwidth=170mm,paperheight=240mm, headsep=30pt, footskip=40pt, inner=70pt, outer=40pt, bottom=100pt, top=80pt}
% Set-up header/footers
\usepackage{fancyhdr} % Headers/footers (load after geometry
\pagestyle{fancy} % Set fancy header/footer style
\fancyhf{} % Clear header/footer
\fancyfoot[RO, LE]{\thepage} % Page numbers outside of page
\makeatletter
\fancyhead[LE]{\textsc{\nouppercase{\leftmark}}} % Chapter title on even pages
\fancyhead[RO]{\textsc{\nouppercase{\rightmark}}} % Section title on odd pages
\begin{document}
\chapter{Very Important Chapter}
\section{Section with big figure}
\blindtext[3]
% The figure below needs to be on a blank page, with no header/footer
\afterpage{\thispagestyle{empty}}
\begin{figure}[p]
\begin{center}
\includegraphics[width=0.9\textwidth, height=16cm]{example-image-c}
\caption{\blindtext[1]}
\end{center}
\end{figure}
\blindtext[12]
\end{document}
答案1
我不认为\afterpage
它会在由 [p] 浮点数生成的页面上运行,因为不允许文本。如果您\thispagestyle{empty}
使用 everypage 进行设置,则它直到下一页才会应用。
\documentclass[twoside,a4paper]{book}
% Import some packages
\usepackage{afterpage}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage[font={small}]{caption} % Figure/table caption style
% Desired page dimensions
\usepackage{geometry}
\geometry{paperwidth=170mm,paperheight=240mm, headsep=30pt, footskip=40pt, inner=70pt, outer=40pt, bottom=100pt, top=80pt}
% Set-up header/footers
\usepackage{fancyhdr} % Headers/footers (load after geometry
\pagestyle{fancy} % Set fancy header/footer style
\fancyhf{} % Clear header/footer
\fancyfoot[RO, LE]{\thepage} % Page numbers outside of page
\makeatletter
\fancyhead[LE]{\textsc{\nouppercase{\leftmark}}} % Chapter title on even pages
\fancyhead[RO]{\textsc{\nouppercase{\rightmark}}} % Section title on odd pages
\usepackage{everypage}
\begin{document}
\chapter{Very Important Chapter}
\section{Section with big figure}
\blindtext[3]
\afterpage{\clearpage}% force [p] figure to next page (probably not needed)
\AddThispageHook{\thispagestyle{empty}}%
% The figure below needs to be on a blank page, with no header/footer
\begin{figure}[p]
\begin{center}
\includegraphics[width=0.9\textwidth, height=16cm]{example-image-c}
\caption{\blindtext[1]}\label{here}
\end{center}
\end{figure}
\blindtext[12]
\end{document}