1

This is a follow-up of: https://emacs.stackexchange.com/a/73564/2247.

In Org-Mode, I use the following code in Beamer export to create 1) a table of content, and 2) intermediate tables of contents between each section highlighting the current section:

#+LaTeX_HEADER: \hypersetup{pdfauthor={}}
#+TITLE: My awesome title
#+date: February 27^{th}, 2023
#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+OPTIONS: H:2 num:t toc:t author:nil
#+LATEX_COMPILER: lualatex
#+LATEX_HEADER: \usetheme[progressbar=foot, sectionpage=none, numbering=fraction]{metropolis}
#+BEAMER_HEADER: \setbeamercovered{transparent=10}

# Show section number in the table of contents
#+BEAMER_HEADER: \setbeamertemplate{section in toc}[sections numbered]

# Show table of content between each section, do not increment the frame numbering and do not show the footer
#+BEAMER_HEADER: \AtBeginSection[]{\begin{frame}[plain, noframenumbering]{Outline}\setbeamertemplate{section in toc}[sections numbered]\setbeamertemplate{subsection in toc}[subsections numbered]\tableofcontents[currentsection, currentsubsection]\end{frame}}
#+BEAMER_HEADER: \AtBeginSubsection[]{\begin{frame}[plain, noframenumbering]{Outline}\setbeamertemplate{section in toc}[sections numbered]\setbeamertemplate{subsection in toc}[subsections numbered]\tableofcontents[currentsection,currentsubsection]\end{frame}}

# Table of content without slide numbering
# https://emacs.stackexchange.com/q/73562/2247
#+LaTeX_HEADER: \pretocmd{\tableofcontents}{\thispagestyle{empty}}{}{}
#+LaTeX_HEADER: \addtocounter{framenumber}{-1}

  #+BEGIN_SRC emacs-lisp :results output :exports results :eval yes
    (customize-set-value 'org-latex-with-hyperref nil)
  #+END_SRC
* Section 1
** Subsection 1.1
** Subsection 1.2
* Section 2
** Subsection 2.1
** Subsection 2.2

This works great, but the issue is that the second table of content is shifted with respect to the first one, as shown on the screenshot below:

enter image description here

Any idea how I could put both tables of contents at the same level?

Here's the TeX file produced by Org-Mode if that helps:

% Created 2023-02-27 Mon 16:21
% Intended LaTeX compiler: lualatex
\documentclass[bigger]{beamer}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\hypersetup{pdfauthor={}}
\usetheme[progressbar=foot, sectionpage=none, numbering=fraction]{metropolis}
\pretocmd{\tableofcontents}{\thispagestyle{empty}}{}{}
\addtocounter{framenumber}{-1}
\usetheme{default}
\date{February 27\textsuperscript{th}, 2023}
\title{My awesome title}
\setbeamercovered{transparent=10}
\setbeamertemplate{section in toc}[sections numbered]
\AtBeginSection[]{\begin{frame}[plain, noframenumbering]{Outline}\setbeamertemplate{section in toc}[sections numbered]\setbeamertemplate{subsection in toc}[subsections numbered]\tableofcontents[currentsection, currentsubsection]\end{frame}}
\AtBeginSubsection[]{\begin{frame}[plain, noframenumbering]{Outline}\setbeamertemplate{section in toc}[sections numbered]\setbeamertemplate{subsection in toc}[subsections numbered]\tableofcontents[currentsection,currentsubsection]\end{frame}}
\begin{document}

\maketitle
\begin{frame}{Outline}
\tableofcontents
\end{frame}


\section{Section 1}
\label{sec:org99eee65}
\begin{frame}[label={sec:org2ea7719}]{Subsection 1.1}
\end{frame}
\begin{frame}[label={sec:orgdb266d7}]{Subsection 1.2}
\end{frame}
\section{Section 2}
\label{sec:orgd93f92b}
\begin{frame}[label={sec:org05cbbd6}]{Subsection 2.1}
\end{frame}
\begin{frame}[label={sec:orgb32272e}]{Subsection 2.2}
\end{frame}
\end{document}
4
  • 1
    From the TeXnical perspective you can avoid the problem by using \begin{frame}[plain]{Outline} \tableofcontents \end{frame} Feb 27 at 22:27
  • 1
    ... alternatively you could remove plain from your section tocs and also use \thispagestyle{empty} there... Feb 27 at 22:30
  • Is this an Emacs question? Beamer question? LaTeX question?
    – Drew
    Feb 27 at 22:35
  • It's kind of in the middle between LaTeX/Beamer and Org-Mode. Indeed, what @samcarter_is_at_topanswers.xyz suggested solves the Beamer/LaTeX side, then there's also how you make it work from Org-Mode.
    – kir0ul
    Mar 1 at 3:28

1 Answer 1

2

Following @samcarter_is_at_topanswers.xyz suggestion, let's add a plain option to the main outline frame. You can do that by customizing the variable org-beamer-outline-frame-options or by adding a file-local variable to your file:

* COMMENT File-local variables
% Local variables:
% org-beamer-outline-frame-options: "plain"
% End:

We add it in a COMMENT section that will disappear on export, but Emacs will see it when it opens the file and it will set org-beamer-outline-frame-options appropriately. You will be asked whether to accept the setting of the variable: you can either say y or ! - the ! answer will remember that you have said that it's OK to accept the local variable setting in the future. You can learn more about file-local variables in the Emacs manual. Note that you have to close and reopen the file, or restart Emacs, or reinitialize the mode with M-x normal-mode in order for Emacs to see the changed value of the variable.

Or you can customize the variable once and for all.

Either way, the frame gets a [plain] option and there is no jumping up/down when you go from the global outline to the section (or subsection) outlines.

2
  • 1
    This works perfectly! Just a quick comment for anyone like me who's not familiar with file-local variables: it took me a while to understand I had to reload the Org-Mode buffer to get the prompt asking to accept the setting of the variable.
    – kir0ul
    Mar 1 at 3:34
  • There was a hint in "... Emacs will see it when it opens the file..." but I should have made it more explicit. I'll add a note.
    – NickD
    Mar 1 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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