비머 TOC: 섹션 번호 오른쪽 정렬

비머 TOC: 섹션 번호 오른쪽 정렬

나는 비머 TOC의 각 섹션에 섹션 번호를 표시하기 위해 대문자 로마 숫자(I, II, ...)를 사용하려고 합니다. 다음 MWE는 전체적으로 작동하지만 로마 숫자와 섹션 제목이 정렬되지 않은 것을 볼 수 있습니다. 대신 로마 숫자를 왼쪽 정렬하고 섹션 번호와 제목 사이의 거리를 고정하여 로마 숫자의 너비에 따라 섹션을 오른쪽으로 이동시킵니다.

[이 MWE를 생성하는 동안 XXV가 I(II에 비해)보다 훨씬 넓기 때문에 문제를 더 잘 시각화하기 위해 두 번째 섹션에 숫자 25를 갖고 싶었습니다. 그러나 섹션 카운터를 24로 설정하고 thesection프레임 제목에서 25로 올바르게 설정되었음에도 불구하고 inserttocsectionnumberTOC의 명령은 2대신 25. 그 문제에 대한 해결책도 있다면 좋을 것입니다. 즉, TOC가 자체 개수로 보이는 것 대신 실제 섹션 번호를 취하도록 강제하는 것입니다.]

\documentclass[t, sansserif, onlymath, 10pt]{beamer}%\mode<handout>

\makeatletter
\defbeamertemplate{section in toc}{sections numbered roman}{%
  \@Roman\inserttocsectionnumber.\ %
  \inserttocsection\par}
  \renewcommand*{\numberline}[1]{%
  \hb@xt@\@tempdima{\hfil#1 }%
}
\makeatother

\begin{document}

\setbeamertemplate{section in toc}[sections numbered roman]
\setbeamerfont{section in toc}{size=\normalsize, family = \sffamily}
\setbeamerfont{section in toc}{shape = \normalfont}

\begin{frame}
  \frametitle{Overview}
  \tableofcontents[currentsection]
\end{frame}
\section{section one}
\begin{frame}
  \frametitle{xxx1 \thesection}
\end{frame}

\setcounter{section}{24}

\section{section two/twenty-five}
\begin{frame}
  \frametitle{xxx2 \thesection}
\end{frame}

\setbeamercovered{transparent}
\begin{frame}
\frametitle{{Agenda}}   
\begin{enumerate}[I.]
\item <1|handout: 1> { Overview} \\
\vspace{0.9cm}
\item <0|handout: 1> {sec1}\\
\vspace{0.9cm}
\item <0|handout: 1> {sec 2: }\\
\end{enumerate}
\end{frame}

\end{document}

마지막 슬라이드를 포함하면 결과가 어떻게 보이기를 원하는지 거의 알 수 있습니다(실제로 제가 왔던 곳이지만 자동화가 필요합니다). "열거" 패키지를 사용하면 "열거"가 오른쪽 정렬되고 섹션 제목도 오른쪽 정렬되는 것을 볼 수 있습니다.

문서 서문에서 코드는

  \defbeamertemplate{section in toc}{sections numbered roman}{%
  \@Roman\inserttocsectionnumber.\ %
  \inserttocsection\par}

로마 숫자를 사용하고 섹션 제목 앞에 섹션 번호를 삽입하는 역할을 합니다.

  \renewcommand*{\numberline}[1]{%
  \hb@xt@\@tempdima{\hfil#1 }%
  }

다음에서 가져온 명령을 사용하여 숫자를 오른쪽 정렬하려고 합니다.ToC에서 숫자를 오른쪽 정렬 , 그러나 이는 섹션과 하위 섹션을 서로 상대적으로 정렬하는 것이며 위의 코드는 트릭을 수행하지 않습니다.

답변1

빠른 해결 방법:

너비가 고정된 상자에 로마 숫자를 넣습니다.

\documentclass[t, sansserif, onlymath, 10pt]{beamer}%\mode<handout>

\makeatletter
\defbeamertemplate{section in toc}{sections numbered roman}{%
  \makebox[0.8cm]{\hfill\@Roman\inserttocsectionnumber.}\space%
  \inserttocsection\par
}
\makeatother

\begin{document}

\setbeamertemplate{section in toc}[sections numbered roman]

\begin{frame}
  \frametitle{Overview}
  \tableofcontents
\end{frame}

\section{section one}
\begin{frame}
  \frametitle{xxx1 \thesection}
\end{frame}

\makeatletter
\beamer@tocsectionnumber=24
\makeatother

\section{section two/twenty-five}
\begin{frame}
  \frametitle{xxx2 \thesection}
\end{frame}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보