
我正在嘗試使用大寫羅馬數字(I,II,...)來顯示我的投影機目錄中的每個部分及其部分編號。以下 MWE 總體有效,但可以看出羅馬數字以及部分標題未對齊。相反,羅馬數字是左對齊的,並且章節編號和標題之間的距離是固定的,因此根據羅馬數字的寬度將章節向右移動。
[在創建此 MWE 期間,我希望第二部分的數字為 25,以便更好地可視化問題,因為 XXV 比 I 寬得多(與 II 相比)。然而,儘管將節計數器設置為 24 並thesection
在幀標題中正確設置為 25,inserttocsectionnumber
TOC 中的命令僅生成 a2
而不是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}
包括最後一張投影片幾乎給出了我想要的結果的樣子(事實上,這就是我來自的地方,但我需要自動化)。您可以看到,使用“enumerate”包,“枚舉”是右對齊的,節標題也是如此。
在文件序言中,程式碼
\defbeamertemplate{section in toc}{sections numbered roman}{%
\@Roman\inserttocsectionnumber.\ %
\inserttocsection\par}
用於使用羅馬數字並在章節標題之前插入章節編號,以及
\renewcommand*{\numberline}[1]{%
\hb@xt@\@tempdima{\hfil#1 }%
}
嘗試使用來自的命令右對齊數字目錄中的數字右對齊 ,但這只是部分和子部分之間相對於彼此的對齊,上面的程式碼被剪斷並不能解決問題。
答案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}