[Tex/LaTex] How to remove empty page after appendix and the next chapter

appendicesblank-page

I am using LaTeX for my thesis and I am getting a blank page after Appendix and the next chapter. My document class is book:

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

I have tried inserting the following commands in my preamble but it does not seem to work:

\makeatletter\@openrightfalse\makeatother

and

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

and

\csname @openrightfalse\endcsname

could someone help me out with this?

Best Answer

If you do not wish to have blank pages after chapters throughout the document, you should be using the openany option for the documentclass. The following gives a two page document with no blank pages

\documentclass[openany]{book}

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

When using the oneside option this happens already, and the opposite option openright has no effect. The reason for this is that the openright option asks the chapter and other commands to use \cleardoublepage, but \cleardoublepage acts as \clearpage for oneside documents.

If you wish to have blank pages after chapters in the body of the document, but not in the appendices, then the simplest way is as follows: use standard two side formatting and switch the value of the openright option at the appendix:

\documentclass{book}

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

\end{document}

However, you say you are using the oneside option, perhaps for other formatting effects. Should you wish to keep that, then we need to redefine \cleardoublepage so as not to test for the twoside option:

\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}

Moving appendix material to an external file and using \input will lead to the same results.