Excluding a chapter from TOC - latex

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*.

Related

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}

Use fancyhdr in Lyx to position page number

I am trying to customise the position of the page number to make them all appear at the bottom centre in Lyx. I plan to use the fancyhdr package in the preamble section of the document, but I get the following error msg:
'LaTex Error: Command /footruleskip already defined'
I guess it has something to do with me forcing a footnote formatting which may already be defined by fancyhdr package, as i have the following in my preamble:
\setlength{\skip\footins}{0.8cm}
Any suggestion how I get around this problem and set the page number position together with the footnote setting? Many thanks.
This link should help: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Customising_with_fancyhdr. You can use the lhead, chead, rhead, lfoot, cfoot and rfoot commands to tell it what you what where (section names, page numbers, custom text, etc). I think you still need to specify them even if they are empty. For only a page number at the bottom center, that would be:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
Perhaps your error could be fixed by using \renewcommand instead of trying to define an already existing value.
I'm trying to do my thesis with LyX and small problems like this are killing me because of having to adhere to the strict format of my school. Anyhow, this page came up as I searched for over an hour for the answer to your question. I'm using the memoir layout (kind of, I've already had to edit it) because my school's latex .cls file is supposedly based on memoir.cls (which I couldn't get to work correctly with LyX despite hours of persistence). I ended up putting this code into my preamble and it displayed the page numbers in the bottom-center per my formatting requirements.
\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
\makeevenhead{headings}{}{}{}
\makeoddhead{headings}{}{}{}
Hope this helps anyone else that finds this page. Now if I can just figure out how to tell LyX that I have no chapters and I want sections to be 1 instead of 0.1. I'll probably just use section* and call my sections "Section" #. Anyway, I hope this helps someone who is as close to punching themselves in the face for using LyX as I am.

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.

Parts in pdflatex Table of Contents

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.

Resources