Document Classes ⇒ "Changing document class" in the middle of a document
"Changing document class" in the middle of a document
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.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
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
Re: "Changing document class" in the middle of a document
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: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
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
"Changing document class" in the middle of a document
Code: Select all
\appendix
\chapter{This is the title}
"Appendix A
This is the title."
The code
Code: Select all
\appendix
\section{This is the title}
".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: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
Code: Select all
\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}
Re: "Changing document class" in the middle of a document
Re: "Changing document class" in the middle of a document
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
"Changing document class" in the middle of a document
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