Skip to content

Commit

Permalink
Make --number-sections work with beamer (#10245)
Browse files Browse the repository at this point in the history
+ Remove section numbering code from common.latex
+ Add section numbering to default.latex
+ Add logic for numbering sections in default.beamer. I moved the template setting
   code to where other beamer templates are set. This makes the section-titles and
   numbersections variables independent.

This should make --number-sections work with beamer.
  • Loading branch information
twsh authored Oct 1, 2024
1 parent e583ab7 commit f2b1de5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
8 changes: 0 additions & 8 deletions data/templates/common.latex
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ $--
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
$--
$-- section numbering
$--
$if(numbersections)$
\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
$else$
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
$endif$
$--
$-- subfigure support
$--
$if(subfigure)$
Expand Down
43 changes: 25 additions & 18 deletions data/templates/default.beamer
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@ $endif$
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
$--
$-- section numbering
$--
$if(numbersections)$
$else$
% remove section numbering
\setbeamertemplate{part page}{
\centering
\begin{beamercolorbox}[sep=16pt,center]{part title}
\usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{section title}
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{subsection title}
\usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
}
$endif$
$for(beameroption)$
\setbeameroption{$beameroption$}
$endfor$
Expand All @@ -60,24 +85,6 @@ $endif$
\widowpenalties 1 10000
\raggedbottom
$if(section-titles)$
\setbeamertemplate{part page}{
\centering
\begin{beamercolorbox}[sep=16pt,center]{part title}
\usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{section title}
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{subsection title}
\usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
}
\AtBeginPart{
\frame{\partpage}
}
Expand Down
8 changes: 8 additions & 0 deletions data/templates/default.latex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ $if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$
\usepackage{amsmath,amssymb}
$--
$-- section numbering
$--
$if(numbersections)$
\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
$else$
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
$endif$
$fonts.latex()$
$common.latex()$
$for(header-includes)$
Expand Down
2 changes: 1 addition & 1 deletion test/command/9472.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ More text in English. ['Zitat auf Deutsch.']{lang=de}
]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
Expand Down Expand Up @@ -61,7 +62,6 @@ More text in English. ['Zitat auf Deutsch.']{lang=de}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
Expand Down
2 changes: 1 addition & 1 deletion test/writer.latex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
Expand Down Expand Up @@ -60,7 +61,6 @@
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
Expand Down
2 changes: 1 addition & 1 deletion test/writers-lang-and-dir.latex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
]{article}
\usepackage{xcolor}
\usepackage{amsmath,amssymb}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
Expand Down Expand Up @@ -55,7 +56,6 @@
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifPDFTeX
\TeXXeTstate=1
\newcommand{\RL}[1]{\beginR #1\endR}
Expand Down

0 comments on commit f2b1de5

Please sign in to comment.