Parts in pdflatex Table of Contents - latex

I have a thesis in which I want to group some chapters together, using the \part command.
What I would like is to have the following:
Chapter 1
Part I
Chapter 2
Chapter 3
Part II
Chapter 4
Chapter 5
Chapter 6
So the last chapter should again be on the same level as the parts. In the table of contents of the text you can't really detect it, because Parts are on the same level anyway.
The problem is that in the PDF, the chapter 6 is added under Part II.
Does anyone know of a way to change that?

The bookmark package can do this quite nicely, among other things. It also only uses a single pass to embed PDF bookmarks into the document.
\part{...}
\chapter{...}
\bookmarksetup{startatroot}
\chapter{...}

The fact that LaTeX does it wrong probably means that something is wrong with the structure of your document: \part is not meant to group chapters, but to devide the document in parts. The difference is that every chapter should be in a part.
Try 'introduction' or 'preliminaries' as a name for the part containing chapter 1.
It might be possible to work around, but you'd have to redefine command throughout the document. It might be worthwhile to use \chapter* for chapters not in a pat, step the chapter-counter manually, and manually call \addcontentsline with the right argument. However, this is IMHO bad use of LaTeX: for well-structured documents, the standard LaTeX commands should suffice.

Related

How to combine some journal papers latex files and make a single file which includes all with their own format?

I am writing my PhD thesis as a combination of my papers. First I wrote an "introduction" chapter, then chapter 2, 3 and 4 are my papers and the chapter 5 is "conclusion". All of these 5 chapters have been written in separate latex files. Now, I was wondering how can I put all of them in a single file so that I can produce outlines of materials and figures?
I know how to combine simple files, but in this case, 3 of them are journal papers with different formatting (e.g. one of them is 1 column and the other is two columns). According to my university rules I should add the journal paper chapters in their own format (the format which they were published) and not a unify format similar to the others.
Now, I was wondering how can I do this?
I got errors when I compiled which says the formatting is defined in the main latex file which has link to the others and you can not define separate documents, or I have used "\maketitle" for writing the title of each paper but I got error that this instruction is only for the main file and so on...
how can I manage this? thanks

Suppress chapter numbers & \renewcommand{\chaptername}

I am writing a amsbook document in Latex. The \chapter{On Banach Spaces} command produces something like this:
CHAPTER 1
On Banach Spaces
I would like it to say
CHAPTER
On Banach Spaces
instead. (No trailing chapter number.)
Why do I want this? I like the layout of amsbook and for the very first chapter I want the leading text to say "INTRODUCTION" then in a next line the title of the introduction. After this introduction I want normal chapter numbering.
This somehow works when I use
\renewcommand{\chaptername}{Introduction}
before the introduction chapter, then
\setcounter{chapter}{0}
\renewcommand\chaptername{Chapter}
just before the second chapter.
Unfortunately this gives me a "INTRODUCTION 1", however I want "INTRODUCTION". So basically, I like to suppress the chapter number.
(Edited.)
I'm not sure I understand your problem 100%, but here are two things to try.
First, I don't know from amsbook, but the regular old book class defines three very-high-level sectioning commands, \frontmatter, \mainmatter, and \backmatter. If you put \frontmatter immediately after \begin{document}, and \mainmatter immediately before the \chapter command for the first chapter that should have a number, then that might well do what you want. However, it may have other effects that you don't want, like changing page breaks or taking things out of the table of contents. (I can't find any online reference for these commands, say sorry.)
A more low-level approach is to use secnumdepth to suppress section numbers. Try something like this:
\setcounter{secnumdepth}{-1}
\chapter{Introduction}
...
\setcounter{secnumdepth}{1} % or 2 for numbered sections, or whatever
\setcounter{chapter}{0}
\chapter{The first chapter}
...
Just type
\chapter*{Introduction}
Then, from the next chapter,
\chapter{The Title of The First Chapter}

Smart page breaks to make chapters print modularly

I'm writing a booklet for my debate club in LyX, and it is a collection of Prep Cases - each prep case is a chapter. Currently I have a "new page" after every chapter, but I want something more - I want to make sure chapters begin in odd numbered pages, so that when I print the whole booklet in duplex - each prep case will be a standalone, separable unit. Is that possible in LyX or plain LaTeX?
Edit: silly me. I meant to say sections and not chapters. Is this possible with sections?
I'm not sure how to do this in Lyx, but if it will let you slip in some raw LaTeX, put this in your preamble:
\let\originalsection=\section
\renewcommand\section{\par\cleardoublepage\originalsection}
Normally, this is done using the openright option on the document class. This causes \chapter to use \cleardoublepage internally, thus starting on an odd page.
You can also use \cleardoublepage manually instead but just using the option is more convenient.
I am using the Exam class (based on Article) and I got this to work in LyX 2.2 with the following:
Document>Document Settings>Page Layout>Two-sided document
Insert>Formatting>Clear Double Page whenever you want to force a part of your document to start on an odd-numbered page.

LaTex table numbering

How could I number the tables in my article chapter based ? So I want all the tables in the fifth section to be numbered like "Table 5.1", ..., "Table 5.n".
I tried
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}
but I am having some problems (missing package I guess).
However, I need a simpler solution, without the need to use such packages.
The article class doesn't have chapters. Try the book or report classes - you'll find that the tables and figures are automatically numbered according to chapter.
Here is a solution without the use of any package (courtesy of "The Latex Companion", A1.4):
\makeatletter
\renewcommand{\thetable}{\thesection.\#arabic\c#table}
\#addtoreset{table}{section}
\makeatother
This resets the table counter whenever a new section is started, and formats it as sectionno.tableno instead of just tableno. You can change the figure and equation counters similarly.
If you are using the amsmath package (or an AMS class like amsart that loads it automatically), you can use
\numberwithin{table}{section}
This was created for equations, but works for any pair of counters though supposedly there might be tricky situations that it does not handle well.

Excluding a chapter from TOC

In my LaTeX document I've got a table of contents that is automatically generated by collecting everything that is of the form \chapter.
However, I've got an acknowledgements chapter before the table of contents and I don't want it to be automatically labelled "Chapter 1" or captured in the table of contents. Should I be avoiding \chapter altogether and use \section instead? I want to keep the font/formatting that other chapters have though.
The usual way to handle that kind of thing is with the \frontmatter command. Put it after the \begin{document}, and then put \mainmatter right before the \chapter you want to correspond to chapter 1. This may only work in the book class. If you're using \chapter in a report, then \chapter* should also create a chapter that has no number and won't show up in the table of contents.
Indeed, as unknown (google) mentioned, using \frontmatter and \mainmatter is the best solution. This will also adjust your page numbering to lowercase roman numerals for the front matter. However, it works only on book and similar document classes.
In case you're using report, try \chapter*. This will create a chapter without a number that does not appear in the table of contents.
For articles \chapter* does not appear to work. Instead use \section*.

Resources