0

I use this command in a report to edit the table of contents:

\usepackage{titletoc}
\addto\captionsenglish{
  \renewcommand{\contentsname}
    {Table of Contents}
}
\newcommand{\setupname}[1][\chaptername]{
\titlecontents{chapter}[0pt]{\vspace{4ex}} 
{\bfseries#1~\thecontentslabel:\quad}{}{\bfseries\hfill\contentspage}[]
}

For example in the following:

\documentclass[letterpaper,11pt]{report}
\usepackage[english]{babel}

\usepackage{titletoc}
\addto\captionsenglish{
  \renewcommand{\contentsname}
    {Table of Contents}
}
\newcommand{\setupname}[1][\chaptername]{
\titlecontents{chapter}[0pt]{\vspace{4ex}} 
{\bfseries#1~\thecontentslabel:\quad}{}{\bfseries\hfill\contentspage}[]
}
\title{ minimal working example}
\author{jfeliperq}
\date{November 2019}

\begin{document}
\maketitle
\tableofcontents

\setupname
\chapter{Chapter 1}
Information of the chapter 1
\section{Section important}
Here comes the section
\chapter{Chapter 2}
Information of the chapter 2
\setupname[Appendix]
\appendix
\chapter{An appendix}
Information of the appendix
\end{document}

And I tried to copy and paste it on the beamer document but it gave me errors, first because I can't use chapters in a beamer, and even without that, I dont understand what is going on. Any idea how to do this?

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – dexteritas Nov 6 '19 at 16:26
1

As you have already stated, there is no chapter in the beamer class. That means the highest instance is section.

In the beamer class you use frames to create a slide. This means that the content of a slide lands between:

\begin{frame}{Title of Slide}

and

\end{frame}

To use a table of contents, \tableofcontents is used as usual. It uses the title you have set for the sections, subsections, etc., but not the title of the slide.

So if we use and modify your minimal working example, it would look like this:

\documentclass{beamer}
\usepackage[english]{babel}

\title{ minimal working example}
\author{jfeliperq}
\date{November 2019}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Table of contents}
\tableofcontents
\end{frame}

\section{Section 1}
\begin{frame}{Information 1}
Information of the section 1
\end{frame}

\subsection{Subsection important}
\begin{frame}{Subsection}
Here comes the subsection
\end{frame}

\section{Section 2}
\begin{frame}{Information 2}
Information of the section 2
\end{frame}

\appendix
\section{An appendix}
\begin{frame}{Appendix}
Information of the appendix
\end{frame}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.