비머: 프레임은 없지만 다음 toc섹션 번호가 있는 TOC 내부 섹션

비머: 프레임은 없지만 다음 toc섹션 번호가 있는 TOC 내부 섹션

특히 다음 질문과 관련이 있습니다.

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]after \tableofcontents\onslide...inside 옵션입니다 \immaddtocontents{...}. 이러한 변경은 내가 선호하는 표시 순서를 얻기 위해 이루어졌습니다.

답변 1 답변 2 답변3

관련 정보