Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The command --toc-depth doesn't change the depth (md->pdf) #9861

Closed
Thanatos0173 opened this issue Jun 8, 2024 · 10 comments
Closed

The command --toc-depth doesn't change the depth (md->pdf) #9861

Thanatos0173 opened this issue Jun 8, 2024 · 10 comments
Labels

Comments

@Thanatos0173
Copy link

Thanatos0173 commented Jun 8, 2024

Reproducible steps :

  1. Create a file with the content:
---
title: Title
subtitle: Subtitle
lang: fr-FR
author: "Author"
theme: "Boadilla"
colortheme: "dolphin"
fonttheme: "structurebold"
aspectratio: 43
fontsize: 14pt
linkstyle: bold
---

# Section One

## Subsection One

Content

## Subsection Two

Content

# Section Two

## Subsection One

Content

## Subsection Two

Content

Compile using :

pandoc -t beamer --toc-depth=5 --toc  <file.md> -o <file.pdf>

Output:
The toc slide is :

  1. Section One
  2. Section Two

Expected:
The toc slide should be:

  1. Section One
    1.1. Subsection One
    1.2. Subsection Two
  2. Section Two
    1.1. Subsection One
    1.2. Subsection Two

Version :

pandoc 3.2
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/thanatos/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. 
Web: https://pandoc.orgThis is free software; see the source for copying conditions. There is nowarranty, not even for merchantability or fitness for a particular purpose.

OS :
Linux, Archcraft

@jgm
Copy link
Owner

jgm commented Jun 8, 2024

default latex template has:

$if(beamer)$
\begin{frame}[allowframebreaks]
$if(toc-title)$
  \frametitle{$toc-title$}
$endif$
  \tableofcontents[hideallsubsections]
\end{frame}
$else$
{
$if(colorlinks)$
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
$endif$
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$

So, the \setcounter{tocdepth}{$toc-depth$} is only set for latex output, not for beamer.
For beamer, we have the [hideallsubsections] option hard-coded.

I can't remember the rationale, if any, for these decisions.

@jgm
Copy link
Owner

jgm commented Jun 8, 2024

One important thing to note: in your example, slide level = 2 (see the manual for this concept). That means that the level-2 headings do not create subsections; they create slides. So, even remove [hideallsubsections], you'd only get the top level in your toc.

@jgm
Copy link
Owner

jgm commented Jun 8, 2024

Perhaps a better test case is

---
title: Title
subtitle: Subtitle
lang: fr-FR
author: "Author"
theme: "Boadilla"
colortheme: "dolphin"
fonttheme: "structurebold"
aspectratio: 43
fontsize: 14pt
linkstyle: bold
---

# Section One

## Subsection One

### Slide

Content

## Subsection Two


### Another slide

Content

# Section Two

## Subsection One

### Slide title

Content

## Subsection Two

### Another slide title

Content

@jgm
Copy link
Owner

jgm commented Jun 9, 2024

I think I'll change this so it uses toc-depth like the regular LaTeX template.

@jgm jgm closed this as completed in 684668d Jun 9, 2024
@Thanatos0173
Copy link
Author

So, just to be sure, I can't change the way the toc is generated because I'm using beamer ? Or do I need to change the default latex template to be able to show more information in the toc ?

@jgm
Copy link
Owner

jgm commented Jun 9, 2024

You'd have to change the latex template, yes. The commit noted above does this, so you can just grab the new template from there.

@Thanatos0173
Copy link
Author

Ok, thank you very much !

@NMarkgraf
Copy link

Bad fix! This breaks all my coding, because I do not want subsections in toc. Beamer does not care about toc-dept. - So this might be a bad solution.

@jgm
Copy link
Owner

jgm commented Aug 5, 2024

@NMarkgraf can you elaborate? Setting toc-depth has no effect in beamer?

@jgm
Copy link
Owner

jgm commented Aug 5, 2024

@NMarkgraf In my tests, --toc-depth seems to work properly with beamer. If you think this is not the case, please give full instructions for reproducing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants