# New chapter after Appendix in LyX

Is it possible in LyX to start a new chapter after Appendix??? seems like no matter if I start a new chapter or paragraph, it continues writing in Appendix.

• Welcome to TeX.SX! It is easier to help you if you add a minimal working example that takes the form \documentclass{...}\usepackage{....}\begin{document}...\end{document}. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. The idea is to make it easier for people to troubleshoot your problem - and doing this makes it much more likely that some one will! – user30471 Jul 23 '15 at 11:41
• You could use the appendix package. Then use ERT to insert \begin{subappendices} and \end{subappendices}. – scottkosty Jul 23 '15 at 23:24

## 2 Answers

This probably should be a duplicate but I couldn't find it. I also don't have lyx installed but I imagine that the solution should be the same (so this is a latex solution). Apologies if lyx is honestly different.

The problem is that \appendix redefines how chapters are printed. It also resets the chapter counter. You have not said how the next chapter should be numbered but it seems reasonable to keep the same numbering which means that we need to save the current chapter number when \appendix is called (I do this using \preto from the etoolbox package) and then we need to restore the value of the chapter counter when we switch back to chapters.

Below I define a \resumechapters command that does these things. Here is the output (with the page breaks suppressed):

and here is the code:

\documentclass[a4paper,12pt]{book}
\makeatletter
\usepackage{etoolbox}
\newcounter{savedchapter}% for remembering the last chapter number
\preto\appendix{\setcounter{savedchapter}{\arabic{chapter}}}% remembering!
\newcommand\resumechapters{% the \appendix command with some tweaks
\setcounter{chapter}{\arabic{savedchapter}}% restore chapter number
\setcounter{section}{0}% reset section counter
\gdef\@chapapp{\chaptername}% reset chapter name
\gdef\thechapter{\@arabic\c@chapter}% make chapter numbers arabic
}
\makeatother

\let\cleardoublepage\relax% compressed output of MWE

\begin{document}
\chapter{A chapter}
\appendix
\chapter{An appendix}
\resumechapters
\chapter{Another chapter}
\end{document}


There is an environment called subappendices in the package appendix specifically for this. E.g.

\documentclass{book}
\usepackage{appendix}

\begin{document}

\chapter{thesis article one}

\section{introduction}

\begin{subappendices}
\section{extra info}
\end{subappendices}

\chapter{thesis article two}

\end{document}


This gives:

Note that:

Within the subappendices environment, an appendix is introduced by a \section command in chaptered documents, otherwise it is introduced by a \subsection command. Effectively, this provides for appendices at the end of a main document division, as an integral part of the division. The subappendices environment supports only the title and titletoc options.

See:

http://mirror.hmc.edu/ctan/macros/latex/contrib/appendix/appendix.pdf