如何刪除附錄和下一章後的空白頁?

如何刪除附錄和下一章後的空白頁?

我在論文中使用 LaTeX,但在附錄和下一章之後出現了空白頁。我的文檔類別是book

\documentclass[a4paper,oneside,12pt]{book}

我嘗試在序言中插入以下命令,但它似乎不起作用:

\makeatletter\@openrightfalse\makeatother

{\let\cleardoublepage\clearpage 
\input{appendix}
}

\csname @openrightfalse\endcsname

有人可以幫我解決這個問題嗎?

答案1

如果您不希望整個文件的章節之後有空白頁,則應該使用openany文件類的選項。下面給了一個沒有空白頁的兩頁文檔

\documentclass[openany]{book}

\begin{document}
\chapter{A Chapter}
\appendix
\chapter{Appendix}
\end{document}

當使用該oneside選項時,這種情況已經發生,相反的選項openright沒有效果。原因是該openright選項要求章節和其他指令使用\cleardoublepage,但\cleardoublepage作用\clearpageoneside文件相同。

如果您希望文件正文中的章節後面有空白頁,但附錄中不存在,那麼最簡單的方法如下:使用標準雙面格式並切換openright附錄中的選項值:

\documentclass{book}

\begin{document}
\chapter{A Chapter}
\chapter{Another Chapter}
\cleardoublepage\makeatletter\@openrightfalse\makeatother
\appendix
\chapter{Appendix}
\chapter{Another Appendix}

\end{document}

但是,您說您正在使用該oneside選項,也許是為了其他格式效果。如果您希望保留它,那麼我們需要重新定義,\cleardoublepage以免測試該twoside選項:

\documentclass[oneside]{book}

\makeatletter
\renewcommand{\cleardoublepage}{\clearpage \ifodd\c@page\else
    \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi}
\makeatother

\begin{document}
\chapter{A Chapter}
\chapter{Another Chapter}
\cleardoublepage\makeatletter\@openrightfalse\makeatother
\appendix
\chapter{Appendix}
\chapter{Another Appendix}

\end{document}

將附錄資料移至外部文件並使用\input將產生相同的結果。

相關內容