Document Classes ⇒ "Changing document class" in the middle of a document
"Changing document class" in the middle of a document
Hi. I'm writing a document using the 'report' class and I'm very happy with it. However I would like to add an appendix which is not very long so it looks silly to have the huge chapter headings for each part of the appendix. In short, I would like the appendix to be formatted as 'article' with sections being designated 1, 2 etc. instead of .1, .2 etc. when the chapter is not specified. Is there a way to do it?
Also, while I'm at it, how do I link to chapters, sections and appendices with hyperref?
Thanks.
Also, while I'm at it, how do I link to chapters, sections and appendices with hyperref?
Thanks.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
Hi,
perhaps let the appendix be one chapter consisting of sections.
Or modify the headings.
Mixing of classes is not so straightforward, but a simple way would be to create 2 separate documents with different classes and merge the pdf files afterwards.
Concerning hyperref - just load it by
and the chapters and sections will be linked from the toc and by bookmarks.
Stefan
perhaps let the appendix be one chapter consisting of sections.
Or modify the headings.
Mixing of classes is not so straightforward, but a simple way would be to create 2 separate documents with different classes and merge the pdf files afterwards.
Concerning hyperref - just load it by
Code: Select all
\usepackage{hyperref}
Stefan
LaTeX.org admin
Re: "Changing document class" in the middle of a document
Thanks for your reply. The problem with doing it as one chapter is that then it says 'Appendix A' which carries the implication that there is a 'B' which at least to me is aesthetically unappealing. Making a separate document for the appendix is an option, but I would like to have links to previous equations (it's a physics report), bibliography etc. and I would like to link to the appendix itself from the main text. I don't mean to be picky, it's not a big deal. I was just wondering if there was an easy way of doing it.
In regards to hyperref, I already have it loaded and I use it to reference equations (with eqref) and for the table of contents. In addition I would like to link to chapters or sections in the text. Like putting "see Chapter 2" and it would take you to Chapter 2, or "see Appendix B" and it takes you to the Appendix B. It's not very clear to me how to do that. Perhaps that can be accomplished with the bookmarks you mentioned, could you be more specific?
Anyway, these are just minor cosmetic changes so it doesn't matter that much even if it can't be done. I just thought I'd ask.
In regards to hyperref, I already have it loaded and I use it to reference equations (with eqref) and for the table of contents. In addition I would like to link to chapters or sections in the text. Like putting "see Chapter 2" and it would take you to Chapter 2, or "see Appendix B" and it takes you to the Appendix B. It's not very clear to me how to do that. Perhaps that can be accomplished with the bookmarks you mentioned, could you be more specific?
Anyway, these are just minor cosmetic changes so it doesn't matter that much even if it can't be done. I just thought I'd ask.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
Hi,
regarding switching from chapter to section - did you ever see this in a book? I guess it's very uncommon for a book or report, which uses chapters and sections, to continue just with sections hanging around without a chapter above. Logically, they would belong to the chapter before the appendix. A structure is more than cosmetic - the structure would be damaged in my opionon.
I've seen two ways:
Concerning hyperref: the package offers an extensive manual where this linking is described. You can open it by typing
or just
at the command prompt on your computer or here on CTAN.
Stefan
regarding switching from chapter to section - did you ever see this in a book? I guess it's very uncommon for a book or report, which uses chapters and sections, to continue just with sections hanging around without a chapter above. Logically, they would belong to the chapter before the appendix. A structure is more than cosmetic - the structure would be damaged in my opionon.
I've seen two ways:
- appendix consisting of chapters, especially if they are not short
- or an appendix chapter, consisting of sections.
Concerning hyperref: the package offers an extensive manual where this linking is described. You can open it by typing
Code: Select all
texdoc hyperref/manual
Code: Select all
texdoc hyperref
Stefan
LaTeX.org admin
"Changing document class" in the middle of a document
The code
produces a new chapter saying:
"Appendix A
This is the title."
The code
produces something that looks like a section saying:
".1 This is the title."
I would like to have the layout of the second example but with proper numbering so that it would be "A. This is the title" or something like that. Alternatively, I could have the whole appendix as a single chapter with sections but in that case I would like it to just say "Appendix" instead of "Appendix A". Come to think of it, the second way would probably be more consistent as you say.
Also, by cosmetic changes I meant that the exact layout of the document is not that big of a deal to me and I can make due with the default structure.
Thanks for the hyperref manual, I'll have a look at it when I have time.
produces a new chapter saying:
"Appendix A
This is the title."
The code
produces something that looks like a section saying:
".1 This is the title."
I would like to have the layout of the second example but with proper numbering so that it would be "A. This is the title" or something like that. Alternatively, I could have the whole appendix as a single chapter with sections but in that case I would like it to just say "Appendix" instead of "Appendix A". Come to think of it, the second way would probably be more consistent as you say.
Also, by cosmetic changes I meant that the exact layout of the document is not that big of a deal to me and I can make due with the default structure.
Thanks for the hyperref manual, I'll have a look at it when I have time.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
Here's an example:
The appendix is an unnumbered chapter. The structure, seen in the TOC:
Stefan
Code: Select all
Code, edit and compile here:
\documentclass{report}\begin{document}\tableofcontents\chapter{First chapter}\chapter{Second chapter}\section{A section}\appendix\chapter*{Appendix}\addcontentsline{toc}{chapter}{Appendix}\renewcommand*{\thesection}{\Alph{section}}\section{First title}\section{Second title}\end{document}
LaTeX.org admin
Re: "Changing document class" in the middle of a document
That's perfect, thanks a lot.
Re: "Changing document class" in the middle of a document
Actually, one more thing. Now the labeling of equations has gone from (A1), (A2), (B1), (B2) etc. to (1), (2), (3), (4). Is there any way to change them back?
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
How did you produce the numbering before? Do you really mean (A1) or perhaps (A.1)?
The latter can be done by
if you use amsmath, or by \counterwithin of the chngcntr package. Otherwise additionally redefine \theequation.
Since the numbering is originally per chapter, you have to change it to be per section. That would be necessary for tables, figures etc. as well - that's a result of diverging from the class' chapter style.
Stefan
The latter can be done by
Code: Select all
\numberwithin{equation}{section}
Since the numbering is originally per chapter, you have to change it to be per section. That would be necessary for tables, figures etc. as well - that's a result of diverging from the class' chapter style.
Stefan
LaTeX.org admin
Re: "Changing document class" in the middle of a document
Yeah, I meant (A.1) etc. and that works. Thanks again for your help.