Beamer: Разделы внутри оглавления без рамок, но со следующим номером раздела оглавления

Beamer: Разделы внутри оглавления без рамок, но со следующим номером раздела оглавления

В частности, это касается следующего вопроса:

tex.stackexchange.com/questions/376836

Я хочу узнать, как получить следующий номер в оглавлении для раздела без рамок?

Чтобы еще больше усложнить задачу: я работаю с индивидуальными квадратами для разделов оглавления, как показано здесь:

tex.stackexchange.com/questions/422192

Лучшее, что я смог сделать на данный момент, это следующее MWE:

\documentclass{beamer}

\defbeamertemplate{section in toc}{my squares toc}
{\leavevmode\leftskip=1.75ex%
    \llap{%
         \usebeamerfont*{section number projected}%
         \usebeamercolor[bg]{section number projected}%
         \vrule width2.9ex height2.32ex depth.78ex%
         \hskip-2.8ex%
         \hbox to2.7ex{\hfil\color{fg}\inserttocsectionnumber\hfil}}%
    \kern1.5ex\inserttocsection\par}
\setbeamertemplate{section in toc}[my squares toc]

\makeatletter
\newcommand\immaddtocontents[1]{{%
        \let\protect\@unexpandable@protect
        \immediate\write\@auxout{\noexpand\@writefile{toc}{#1}}%
}}
\makeatother

\begin{document}

\begin{frame}{TOC}
    \tableofcontents
\end{frame}

\section{The first section}

\begin{frame}
Some text.
\end{frame}

\section{The second section}

\immaddtocontents{\vfill \leavevmode\leftskip=1.75ex \protect\usebeamercolor[fg]{section in toc}
    \kern1.5ex \insertsection \par}

\end{document}

Я был бы рад избежать, если это возможно, любого дополнительного пакета. 1 2

решение1

Я сам нашел решение. В маловероятном случае, если кого-то заинтересует мой вопрос - представляю решение.

Однако он немного неуклюж, и я буду признателен за любые улучшения.

\documentclass{beamer}

\defbeamertemplate{section in toc}{my squares toc}
{\leavevmode\leftskip=1.75ex%
    \llap{%
        \usebeamerfont*{section number projected}%
        \usebeamercolor[bg]{section number projected}%
        \vrule width2.9ex height2.32ex depth.78ex%
        \hskip-2.8ex%
        \hbox to2.7ex{\hfil\color{fg}\inserttocsectionnumber\hfil}}%
    \kern1.5ex\inserttocsection\par}
\setbeamertemplate{section in toc}[my squares toc]

\makeatletter
\newcommand\immaddtocontents[1]{{%
        \let\protect\@unexpandable@protect
        \immediate\write\@auxout{\noexpand\@writefile{toc}{#1}}%
}}
\makeatother

\begin{document}

\begin{frame}{TOC}
    \tableofcontents[pausesections]
\end{frame}

\section{The first section}

\begin{frame}
Some text.
\end{frame}

\section{The second section}

\immaddtocontents{\onslide<2->{\vfill \leavevmode\leftskip=1.75ex \protect\usebeamercolor[fg]{section in toc}
         \llap{%
             \usebeamerfont*{section number projected}%
            %\color{my color background}%       %\usebeamercolor[fg or bg]{beamer-color name} does not work
             \vrule width2.9ex height2.32ex depth.78ex%
             \hskip-2.8ex%
             \hbox to2.7ex{\hfil\color{white}\insertsectionnumber\hfil}}% %color{fg} changed to \color{white}
        \kern1.5ex \insertsection \par}}

\end{document}

Как видно, я изменил только \immaddtocontents{...}после раздела без слайдов и имитировал определенный section in tocшаблон. Я натыкаюсь на проблемы с цветом, которые я исправил определенными способами.

Мне нужно было изменить цветовые команды - \usebeamercolor[bg]{...}и \color[fg]по какой-то причине это не сработало.

Другие отличия кода в вопросе — это [pausesections]опция после \tableofcontentsи \onslide...внутри \immaddtocontents{...}. Эти изменения сделаны только для того, чтобы получить порядок отображения, который я предпочитаю.

ответ1 ответ2 ответ3

Связанный контент