10 如何将beamer目录放置在指定位置? 6天19时20分14秒

发布于 2025-08-23 18:16:02
  1. 在位置方面,我希望目录能够被放置在cyan色的框框里。red框左边界往左,准备布置一些装饰物,因此视觉上的可用版面是red框左边界到red框右边界(tips:默认情况下beamer页边距为1厘米),因此将目录放在red框的中心是个不错的选择。
  2. 在对齐方面,我希望目录能够悬挂缩进,突出序号。(已实现)
  3. 在大小方面,我希望cyan框的大小能够根据目录的实际内容自动变化。这样的话,就可以兼顾这个目录整体上的位置居于red框中心和序号后悬挂对齐。

image.png

我自己进行了一个尝试。我将元素section in toc的模板fancytoc的内容改写为一个tblr环境,如果这样行得通的话,那真的能在大体上实现需求,但是,这样会得到一个不允许在 LR mode 中使用的错误。

最小工作示例:

\documentclass[aspectratio=169]{beamer}
%%------------------------------------
%%------------------------------------
\usepackage{varwidth}
\defbeamertemplate{section in toc}{fancytoc}{%
    \leavevmode\leftskip=4mm%
    \llap{\hbox to 4mm{\inserttocsectionnumber.\hfil}}%
    \begin{varwidth}[t]{20em}\inserttocsection\end{varwidth}\par%
}
\setbeamertemplate{section in toc}[fancytoc]
%%------------------------------------
%%------------------------------------
\usepackage{tikz}
\usetikzlibrary{calc}
\NewDocumentCommand{\drawmwehelplines}{}{%
    \tikz[remember picture,overlay]{
        \draw ([shift={(1cm,-1cm)}]current page.north west) -| 
              ([shift={(-1cm,1cm)}]current page.south east) -| 
              ([shift={(1cm,-1cm)}]current page.north west) -- cycle;
        \coordinate (toccenter) at ($([shift={(2.8cm,1cm)}]current page.south west)!.5!([shift={(-1cm,-1cm)}]current page.north east)$);
        \fill [red] 
              (toccenter) circle (2pt);
        \draw [cyan]
              ($(-2cm,-1.5cm)+(toccenter)$) rectangle 
              ($(2cm,1.5cm)+(toccenter)$);
        \draw [dashed,red,very thick]
              ($(-6.1cm,-3.5cm)+(toccenter)$) rectangle
              ($(6.1cm,3.5cm)+(toccenter)$);
    }%
}
%%------------------------------------
%%------------------------------------
\begin{document}

\frame{
    \drawmwehelplines
    \contentsname
    \tableofcontents
}

\section{section section section section section section section section section section one}
\frame{\frametitle{section one}some text}

\section{section two}
\frame{\frametitle{section two}some text}

\end{document}

查看更多

关注者
0
被浏览
52
0 个回答
暂无答案,快来添加答案吧

撰写答案 当前问题悬赏金额为¥10 元,被提问者采纳后将获得赏金

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览