Add "Appendix" before "A" in thesis TOC - latex

I am required to insert the word Appendix before the letter A in my dissertation Table of Contents as follows:
Appendix A (title for appendix A)
but the latex thesis cls file I use generates only the letter A followed by the appendix title:
A (title for appendix A)
The thesis cls file defines a "backmatter" command and the appendix is treated as a chapter.
\newcommand\backmatter{\appendix
\def\chaptermark##1{\markboth{%
\ifnum \c#secnumdepth > \m#ne \#chapapp\ \thechapter: \fi ##1}{%
\ifnum \c#secnumdepth > \m#ne \#chapapp\ \thechapter: \fi ##1}}%
\def\sectionmark##1{\relax}}
Is there a simple fix to the above code that will add the word Appendix before the letter A in the TOC for Appendix A? There is a related question, How to make 'appendix' appear in toc in Latex?, but the answers did not appear to help in this case.

You can easily achieve what you want using the appendix package. Here's a sample file that shows you how. The key is the titletoc option when calling the package. It takes whatever value you've defined in \appendixname and the default value is Appendix.
\documentclass{report}
\usepackage[titletoc]{appendix}
\begin{document}
\tableofcontents
\chapter{Lorem ipsum}
\section{Dolor sit amet}
\begin{appendices}
\chapter{Consectetur adipiscing elit}
\chapter{Mauris euismod}
\end{appendices}
\end{document}
The output looks like

Related

Umlauts in the bibliography file of LaTeX

I use Mendeley to manage my bibliography for my thesis. I add all the papers there and then I have it create a file bibtex to then use in the writing of the thesis.
One of the citation I need is Röthlisberger et al., 2000a, since I knew LaTeX would have freaked out if I dared to simply write the ö in the BibTeX file, I edited (using .tex editor on windows) the entry to be
#article{Roth2000,
author = {Regine R{\"{o}}thlisberger and Manuel A. Hutterli and Stefan Sommer and Eric W. Wolff and Robert Mulvaney},
doi = {10.1029/2000JD900264},
issn = {01480227},
issue = {D16},
journal = {Journal of Geophysical Research: Atmospheres},
month = {8},
title = {Factors controlling nitrate in ice cores: Evidence from the Dome C deep ice core},
volume = {105},
year = {2000},
}
Since I'm using natbib (\usepackage[round]{natbib}), the process of citing should be quite straightforward and in the text I used \citep{Roth2000} to call the citation where I needed and...
It doesn't work.
At all.
I tried all the combination to write the ö in that name, with multiple brackets, without brackets, only on the o, all of them. The result is always an error of
!Missing $ inserted.
<inserted text>
$
l.19 R.~R<?>
<?>thlisberger, U...
?
which makes, to me, no sense. I tried to look around and every guide I've found seems to suggest that... this is how you should write it. Am I missing something?
EDIT:
The file I'm trying to make work is as follows
\documentclass[b5paper,11pt,titlepage]{book}
\usepackage[english]{babel}
\usepackage[round]{natbib}
\bibliographystyle{abbrvnat}
\usepackage[T1]{fontenc}
\usepackage[applemac]{inputenc}
\title{Title}
\author{Raffaello Nardin}
\date {October 2021}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Introduction}
\thispagestyle{empty}
Lorem ipsum dolor sit amet \citep{Roth2000}
\bibliography{Ref}
\end{document}
With Ref being the name of the BibTeX file

Appendix after references not in toc and figure label missing

I am trying to set up my Appendix for my master's thesis which includes basically only figures. These will be referenced at the end of the "List of figures".
My intention is to have figures called "Fig. A.1", "Fig. A.2" etc.
Also, the appendix should be part of the table of contents.
This works fine, as long as it appears before the bibliography.
However, the appendix should appear afterwards, and as soon as I move it there, the Figures are only called "Fig. .1" and it disappears from the TOC. (Note that the figures still show up in the list of figures, however with the wrong names).
How can I reach the same result while having the Appendix BELOW the references?
\documentclass[a4paper, 12pt]{article}
\usepackage{fancyhdr}
\renewcommand{\figurename}{Fig.}
\begin{document}
\tableofcontents
\fancyhead[EC]{\large REFERENCE LIST}% page header is always ``Reference List''
\fancyhead[OC]{\large REFERENCE LIST}%
\section* {Reference List} %removes the section from sections numbers and TOC
\addcontentsline {toc}{section}{Reference List} %adds the section to TOC
\bibliographystyle{THESIS2} %my custom bibliography style
\renewcommand{\section}[2]{} %removes superfluous ``References'' title
\bibliography{Literatur} %calls my .bib file
\newpage
\fancyhead[EC]{\large APPENDIX}
\fancyhead[OC]{\large APPENDIX}
\addcontentsline {toc}{section}{Appendix}
\appendix
\section{Appendix}
\end{document}
Thanks for your help!

part lettering Latex

I am trying to get my document parts to show up as:
A. Narrative % \part{Narrative}
Intro %\section{Intro}
main text...
B. Appendix % \part{Appendix}
Derivations % \section{Derivations}
appendix text...
I have seen others use:
\renewcommand{\thepart}{\Alph{part}}
However this is not working for me for some reason. My parts are showing up as:
Part A
Narrative
Intro
main text...
Part B
Appendix
Derivations
appendix text...
Any ideas anyone?
The minimal example below updates \part to set its numbering differently. More specifically, it removes the \partname - Part - prefix and keeps the title on the same line. Fonts are also updated to set the part using \LARGE\bfseries in both \part and \part*. All of the above updates are done using etoolbox's \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>} macro that performs a <search>-and-<replace> within <cmd>.
\documentclass{article}
\usepackage{lipsum,etoolbox}
\renewcommand{\thepart}{\Alph{part}}
\makeatletter
% Change part display; also uniform size of \LARGE\bfseries
\patchcmd{\#part}% <cmd>
{\Large\bfseries \partname\nobreakspace\thepart \par\nobreak}% <search>
{\LARGE\bfseries \thepart.\quad}% <replace>
{}{}% <success><failure>
\patchcmd{\#part}{\huge}{\LARGE}{}{}
\patchcmd{\#spart}{\huge}{\LARGE}{}{}
\renewcommand{\#seccntformat}[1]{\csname the#1\endcsname.\quad}
% \#addtoreset{section}{part} % Reset section counter with every part
\makeatother
\begin{document}
\part{Narrative}
\section{Intro}
\lipsum[1]
\part{Appendix}
\section{Derivations}
\lipsum[2]
\end{document}
If you wish to have the \section numbers reset with every new \part, uncomment the line referencing that in the preamble.
Your idea is right, but you also redefine the titleformat.
From the following link:
\usepackage{titlesec}
\renewcommand{\thepart}{\Alph{part}}
\makeatletter
\titleformat{\part}[display]
{\Huge\scshape\filright}
{\thepart~\partname}
{20pt}
{\thispagestyle{plain}}
\makeatother

Remove section numbers latex

I have a problem with section numbering in latex. I want to remove the section numbers from headings and contents but I want the numbers to be there for lemmas, theorems etc. I want it to look like:
Section Whatever
Some unimportant text.
Section Whatever else
Another unimportant text.
Lemma 2.1
Theorem 2.2
Section Whatever again
Theorem 3.1
How can I do it? I tried
\renewcommand\thesection{}
but it removes the numbers even from lemmas and theorems. Thank you very much :)
Under the default article class we can merely remove the formatting applied to the section counter by adding
\makeatletter
\renewcommand{\#seccntformat}[1]{}
\makeatother
to the preamble. This will remove all sectional title numbering (\sections, \subsections, \subsubsections, ...), yet keep them where they are references or whenever \thesection is used.
\documentclass{article}
\newtheorem{theorem}{Theorem}[section]% Theorems numbered by section
\newtheorem{lemma}[theorem]{Lemma}% Lemma uses theorem's counter
\makeatletter
\renewcommand{\#seccntformat}[1]{}
\makeatother
\begin{document}
\section{Section whatever}
Some uninportant text.
\section{Section whatever else}
Another uninportant text.
\begin{lemma}
Some lemma.
\end{lemma}
\begin{theorem}
Some theorem.
\end{theorem}
\section{Section whatever again}
\begin{theorem}
Another theorem.
\end{theorem}
\end{document}

How to make 'appendix' appear in toc in Latex?

How to make word 'appendix' appear in the table of contents? Right now toc looks like this:
1 ......
2 ......
.
.
A .....
B .....
I would like it to be:
1 ......
2 ......
.
.
Appendix A .....
Appendix B .....
My latex source file structure is like this:
\begin{document}
\tableofcontents
\include{...}
\include{...}
\appendix
\include{...}
\include{...}
\end{document}
There's a couple of ways to solve this problem; unfortunately, I've only got a hack for you at this stage. One problem is that if we redefine the section number "A" to include the word "Appendix", it messes up the formatting of the table of contents. So instead, I've just defined a new sectioning command that prints the section without a number and inserts "Appendix X" manually.
Kind of ugly, but at least it works without having to change any markup :)
\documentclass{article}
\makeatletter
\newcommand\appendix#section[1]{%
\refstepcounter{section}%
\orig#section*{Appendix \#Alph\c#section: #1}%
\addcontentsline{toc}{section}{Appendix \#Alph\c#section: #1}%
}
\let\orig#section\section
\g#addto#macro\appendix{\let\section\appendix#section}
\makeatother
\begin{document}
\tableofcontents
\section{goo}
\label{a}
This is sec~\ref{a}
\section{har}
\label{b}
This is sec~\ref{b}
\appendix
\section{ji}
\label{c}
This is app~\ref{c}
\subsection{me}
does this look right?
\end{document}
For my thesis, I did the following:
\appendix
\addcontentsline{toc}{section}{Appendix~\ref{app:scripts}: Training Scripts}
\section*{Sample Training Scripts}
\label{app:scripts}
Blah blah appendix content blah blah blah.
Explanation: I manually added a line to the TOC so I would have "Appendix X:..." show up in my TOC. Then I excluded the actual section command from the TOC by using an asterisk.
This is probably most easily achieved by using the appendix
package, or the memoir class.
If you don't want to use a prepackaged solution, you'll have to
hack the sectioning commands. When I needed to do this for my
dissertation, I cloned the report class, and edited until I made
the margins lady happy. What you're looking for is the
definition of the \addcontentsline macro.
The appendix package is really good and simple solution. My answer can be helpful for who wants to change chapters numbering style, for example, with using cyrillic alphabet or roman digits. The appendices numbering style is hardcoded in the \#resets#pp command (I looked in sources here http://hal.in2p3.fr/docs/00/31/90/21/TEX/appendix.sty). I solved it by simple redefining this command to my own. Just add this code into your preamble:
\makeatletter
\renewcommand{\#resets#pp}{\par
\#ppsavesec
\stepcounter{#pps}
\setcounter{section}{0}
\if#chapter#pp
\setcounter{chapter}{0}
\renewcommand\#chapapp{\appendixname}
\gdef\thechapter{\Asbuk{chapter}} % changed
\else
\setcounter{subsection}{0}
\gdef\thechapter{\Asbuk{section}} % changed
\fi
\if#pphyper
\if#chapter#pp
\renewcommand{\theHchapter}{\theH#pps.\Asbuk{chapter}} % changed
\else
\renewcommand{\theHsection}{\theH#pps.\Asbuk{section}} % changed
\fi
\def\Hy#chapapp{\appendixname}%
\fi
\restoreapp
}
\makeatother
As a result,
Appendix A
Appendix B
Appendix C
...
will change to
Appendix A
Appendix Б
Appendix В
... etc
I'm not a latex expert, and I can't guarantee this code won't break something else.
Based on #Will Robertson's answer, the code below defines the same thing but for chapter and also fixes the fact that chapter* does not add to the header when using the fancyhdr package.
With this in the preable all issues are resolved.
\makeatletter
\newcommand\appendix#chapter[1]{%
\refstepcounter{chapter}%
\def\app#ct{Appendix \#Alph\c#chapter: #1}
\orig#chapter*{\app#ct}%
\markboth{\MakeUppercase{\app#ct}}{\MakeUppercase{\app#ct}}
\addcontentsline{toc}{chapter}{\app#ct}%
}
\let\orig#chapter\chapter
\g#addto#macro\appendix{\let\chapter\appendix#chapter}
\makeatother

Resources