Tikz 和 Beamer 中幻灯片布局的锚定框

Tikz 和 Beamer 中幻灯片布局的锚定框

我一直在阅读 tikz 手册,并且能够生成这个 MWE:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, intersections,through,backgrounds,positioning}
\usepackage{pgfpages,ifthen}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage{amsmath,amssymb,amsthm,mathrsfs,bbm,bm}
\usepackage{graphicx,subcaption,float,enumerate}
\usetheme[progressbar=frametitle]{metropolis}
\setbeamertemplate{frame numbering}[none]
\metroset{block=fill}
\setbeamercovered{transparent=15}

\title{Test Presentation}
\subtitle{a quick one}
\date{}
\author{}
\institute{}

\begin{document}
\maketitle

\begin{frame}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,red] (current page.west) rectangle (current
    page.south) ;
    \draw[very thick,blue] (current page.north west) rectangle (current
    page.center);
    \end{tikzpicture}
\end{frame}

\begin{frame}{A frame title}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,red] (current page.west) rectangle (current
    page.south) ;
    \draw[very thick,blue] (current page.north west) rectangle (current
    page.center);
    \end{tikzpicture}
\end{frame}


\end{document}

我需要以下方面的帮助:

  1. 我怎么能够姓名蓝色和红色节点,以便我现在可以将事物锚定到它们上?
  2. 我如何将这些节点锚定到标题的底部?我知道我需要做一些计算,我正在阅读 Tikz 手册的第 13.5 节来弄清楚。我需要做的是锚定到诸如(current page.west - headerwidth)等之类的东西。
  3. 我想生成几个带有“示例幻灯片布局”的框架,例如左侧有两个垂直面板,右侧有一个长面板等。现在,我想手动执行此操作,并sample_slides.tex在计算机上保存一个文件,其中包含所有这些布局的代码,然后我可以将新内容锚定到这些代码上。这种事情有意义吗?

笔记:我还标记了 beamer,因为我特别想问的是 beamer 幻灯片标题

答案1

对于问题 1 和 2:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, intersections,through,backgrounds,positioning}
\usepackage{pgfpages,ifthen}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage{amsmath,amssymb,amsthm,mathrsfs,bbm,bm}
\usepackage{subcaption}
\usetheme[progressbar=frametitle]{metropolis}
\setbeamertemplate{frame numbering}[none]
\metroset{block=fill}
\setbeamercovered{transparent=15}

\title{Test Presentation}
\subtitle{a quick one}
\date{}
\author{}
\institute{}

\newlength{\test}
\makeatletter
\setlength{\test}{\totalheightof{%
  \begin{beamercolorbox}[%
      wd=\paperwidth,%
      sep=0pt,%
      leftskip=\metropolis@frametitle@padding,%
      rightskip=\metropolis@frametitle@padding,%
    ]{frametitle}%
  \metropolis@frametitlestrut@start%
  TJ%
  \nolinebreak%
  \metropolis@frametitlestrut@end%
  \end{beamercolorbox}%
}}
\addtolength{\test}{\metropolis@progressinheadfoot@linewidth}
 \makeatother

\begin{document}
\maketitle

\begin{frame}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,red] (current page.west) rectangle (current
    page.south) node (rednode) {};
        \node [above of = rednode] {test};
    \draw[very thick,blue] (current page.north west) rectangle (current
    page.center);
    \end{tikzpicture}
\end{frame}

\begin{frame}{A frame title}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,blue] (current page.north west)++(0,-\test) rectangle (current page.center);
    \end{tikzpicture}
\end{frame}


\end{document}

我不确定我是否理解了你的第三个问题,但也许https://ctan.org/pkg/gridslides是你在找什么?


我感觉你在问一个 XY 问题。如果你的最终目标是用文本填充这些矩形,我会说:不要这样做 - 让 beamer 为你完成工作,你将获得通常完美对齐的幻灯片,并且很少需要手动干预。例如,如果你想要在左侧网站的顶部和底部放置文本块,则可以使用列:

\documentclass{beamer}
\usetheme[progressbar=frametitle]{metropolis}

\begin{document}

\begin{frame}
    \frametitle{title}
    \begin{columns}[t]
        \begin{column}{.48\textwidth}
                Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, 
        \end{column}
        \begin{column}{.48\textwidth}
                whatever should be on the right
        \end{column}        
    \end{columns}
    \vfill
    \begin{columns}[t]
        \begin{column}{.48\textwidth}
                Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, 
        \end{column}
        \begin{column}{.48\textwidth}

        \end{column}        
    \end{columns}   
\end{frame}


\end{document}

在此处输入图片描述

相关内容