I'm writing a thesis which is an aggregate of separate articles. I have the source code for the articles and I'm using \include to include them in the main document of the thesis. So in my main.tex (thesis document), I have

some pages in between the two articles

The problem that I'm getting is with the Appendix sections. In article 1, I have at the end:

\subsection{Good coefficients}
then comes the first line of appendix

This gives in article 1 (when compiled separately with the article class):

A. Coefficients

A.1. Good coefficients

and equation numbers in the Appendix A as (A.1), (A.2)

which is ok and what is expected.

When I put article 1 within main.tex, I use \include command. Also, I removed the document class for article 1 and put \chapter instead.

But when I compile main.tex (the thesis document), I get the appendix sections as:

.1 Coefficients

.1.1 Good coefficients

and the equation numbers in the appendix A as (.1.1), (.1.2) etc

My article 1 is treated as a chapter in the main thesis document (main.tex) and the title and section numbers, equation numbers are preceded by A in main.tex. This is what I want.

Maybe it would be ok to get the appendix in my main.tex as

A.A. Coefficients

A.A.1 Good coefficients

and the equation numbers in the Appendix as (A.A.1), (A.A.2) etc

to denote that it refers to appendix A of paper A. First A is for the first article and second A is for first appendix. How to get this?

  • What document class are you using?
    – Seamus
    Commented Oct 23, 2010 at 12:42
  • Thanks. I'm using book for main.tex . I don't have any class for article 1. I start it with \chapter{title of article} Commented Oct 23, 2010 at 12:47
  • 1
    I think the problem is that \appendix typesets the appendix title with \section* so it doesn't get a number. Maybe using \begin{appendix} and `\end{appendix} would work? otherwise, you'll have to redfine the section command yourself.
    – Seamus
    Commented Oct 23, 2010 at 15:04

1 Answer 1


Preliminary remark: If an article includes an appendix (which is numbered as section A, subsection A.1, ...), and the article as a whole becomes chapter 1 of a book, the appendix in fact becomes a "subappendix" (which should be numbered as section 1.A, subsection 1.A.1, ...).

The \appendix command is defined by the document class - basically, it resets the counter of the "top section" level (\chapter in book, \section in article) and switches to Alphabetic numbering. So an \appendix command that is part of an "included" file will produce wrong results - it will redefine chapters instead of sections and in the process interfere with the numbering of subsequent chapters.

Solution: Change the definition of \appendix as to produce the desired formatting of "subappendices". (This way, you don't have to change your "included" files.) Keep the redefinition inside a group in order to allow for (main) appendix chapters.





Some text.



\subsection{Good coefficients}

The first line of the appendix to article1.

a^2 + b^2 = c^2




\chapter{Title of article1}




\chapter{Title of (main) appendix}

Some text.


P.S.: I'd rather use \input instead of \include - you probably don't want a page break after the chapter title.

  • Thanks. The problem that I see with your method is that I'll have to include the text of article 1 in main.tex and the latter can become too lengthy if I have several articles. Am I understanding right here that with your method I can't have a separate file article1.tex? Please let me know. Commented Oct 23, 2010 at 16:56
  • @yCalleecharan: You CAN have separate files article1.tex, ... - I only used the filecontents package (which actually produces the file "article1") in order to produce a working minimal example (which compiles after copying and pasting the code).
    – lockstep
    Commented Oct 23, 2010 at 17:02
  • Where did you get that idea? The important part of the solution is after the \begin{document} in Lockstep's answer. The part before is actually so the answer will compile. Commented Oct 23, 2010 at 17:02
  • @lockstep: it seems that filecontents will need to be explained, along with lipsum and friends when an answer is written... Commented Oct 23, 2010 at 17:03
  • 1
    @Willie Wong: In the LateX section of the (German-speaking) forum mrunix.de, theres a topped thread about "error diagnostics" that, among other things, tells you everything about filecontents` & Co. Perhaps we need something similar for tex.stackexchange.
    – lockstep
    Commented Oct 23, 2010 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .