平均能量损失

平均能量损失

背景:我正在设计自己的beamer模板,并且我已经阅读如何从头开始设计自定义 Beamer 主题如何创建 Beamer 模板我还读到beamer 如何构建框架

我注意到,在上述问题中发现的每个示例中,框架都是使用多个环境构建的(每个环境内都创建beamercolorbox一个)。 我知道 LaTeX 可以使用框,但是...tikzpicture
我想在创建 TikZ 图片时定义我的模板,即使用相对定位的节点,并用诸如\insertframenumber\inserttitle、 之类的宏填充\insertcontent

我已经成功实现了我的愿望titleframe(见下文)。
在此处输入图片描述

但是,我无法在常规幻灯片上实现相同的效果。事实上,当我无法叠加通过 定义的 TikZ 图片\frametitle\framesubtitle幻灯片内容时,也无法subtitle相对于 进行定位title。另外,我没有使用方形文本区域 - 如下例所示(手动完成):

在此处输入图片描述

请注意,我不太可能使用块(例如definitiontheorem等)。段落的梯形形式将使用以下方式定义shapepar包定义(参见示例示例)在 TikZ 中将文本调整到形状创建自定义梯形文本框)。

笔记:我并不是要求你为我编写这个模板,而是如何使用 TikZ 节点定义整个框架的布局?(即定位每个组件,例如frametitleslidenumber等) - 包括其内容。


平均能量损失

  • main.tex

(根文件)

\documentclass[aspectratio=1610]{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}

    \usepackage[babel=true,kerning=true]{microtype}

    \usepackage{roboto}

    \title{The title}
    \subtitle{Here comes the subtitle\\that can be pretty long}
    \date[Short date]{Long date\\ Where the talk is given}
    \author[email]{John Doe}
    \institute{Institute}

    \newcommand{\verticalshift}{.5}
    \newcommand{\horizontalshift}{1}

    \usetheme{mytheme}

\begin{document}

\begin{frame}
    \titlepage
\end{frame}


\begin{frame}%
    \frametitle{There Is No Largest Prime Number} 
    \framesubtitle{The proof uses \textit{reductio ad absurdum}.} 

    There is no largest prime number.

    \begin{enumerate} 
        \item<1-| alert@1> Suppose $p$ were the largest prime number. 
        \item<2-> Let $q$ be the product of the first $p$ numbers. 
        \item<3-> Then $q+1$ is not divisible by any of them. 
        \item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime
        number not in the first $p$ numbers.
    \end{enumerate}
\end{frame}

\begin{frame}{A longer title}
    \begin{itemize}
        \item one
        \item two
    \end{itemize}
\end{frame}

\end{document}
  • beamerthememytheme.tex

(所有主题定义。我在这里合并了outerthemeinnertheme文件)

\RequirePackage{tikz}
    \usetikzlibrary{calc}
    \usetikzlibrary{intersections}
    \usetikzlibrary{positioning}

\defbeamertemplate*{title page}{mytheme}%[1][]
{%\leavemode%
    \begin{beamercolorbox}[wd=\the\paperwidth, ht=\the\paperheight,ignorebg,center]{}
        \begin{tikzpicture}[%
            inner sep=0pt,
        ]

        %= defining coordinate
            \coordinate (SE') at (\the\paperwidth,0);
            \coordinate (SE) at (\the\paperwidth,1);
            \coordinate (NE) at (\the\paperwidth,\the\paperheight);
            \coordinate (SW) at (0,1);
            \coordinate (SW') at (0,0);
            \coordinate (NW) at (0,\the\paperheight);


            \clip (SW') rectangle (NE);


            \coordinate (M) at (9.89, {10-5.56});
            \node (Mbis) [above right=210 and 30 of M] {};
            \node (Mter) [below left=210 and 30 of M] {};

            \path [name path=top] (NW) -- (NE);
            \path [name path=bottom] (SW) -- (SE);
            \path [name path=left] (SW) -- (NW);
            \path [name path=right] (SE) -- (NE);
            \path [name path=oblique] (Mbis) -- (Mter);

            \coordinate (L) at ($(NW)!(M)!(SW)$);
            \coordinate (R) at ($(NE)!(M)!(SE)$);
            \path [name intersections={of = oblique and top}] (intersection-1) coordinate (T);
            \path [name intersections={of = oblique and bottom}] (intersection-1) coordinate (B);

        %= Footer
            \fill[black,opacity=1] (0,0) rectangle (\the\paperwidth,1cm);


        %= Upper left corner
            \fill [color=white] (L) -- (M) -- (T) -- (NW) -- cycle;

            \node [%
                anchor=base west,
                above right= \verticalshift and \horizontalshift of L, 
                inner sep=0pt, 
                align=left,
                font={\Large},
                text = white!30!black,
            ] (subtitle) {%
                \insertsubtitle
            };  

            \node [%
                above = .25  of subtitle.north west,
                anchor=south west, 
                inner sep=0pt,
                font = {\robotoslab\huge\bfseries}
            ] (title) {%
                \inserttitle
            };

        %= lower right corner
            \fill [color=white] (R) -- (M) -- (B) -- (SE) -- cycle;

            \node [%
                anchor=base east,
                below left= \verticalshift and {.618*\horizontalshift} of R, 
                inner sep=0pt, 
                align=right,
                font={\robotoslab\bfseries},
            ] (author) {%
                \strut%
                \insertauthor
            };

            \node [
                below = {.5*\verticalshift}  of author.base east,
                anchor=north east, 
                inner sep=0pt,
                align=right, 
                text=white!30!black,
            font={\scriptsize}          
            ] (institution) {%
                \strut%
                \insertinstitute\\
                \insertshortauthor% (= email)
            };

        %= lower left corner
            \fill [color=orange] (B) -- (M) -- (L) -- (SW) -- cycle;

            \node [%
                anchor=base west,
                below right= .5 and 1 of L, 
                inner sep=0pt, 
                align=left,
                text=orange!13!white,
                font={},
            ] (event) {%
                \strut%
                \insertshortdate% = event 
            };

            \node [
                below = {.5*\verticalshift}  of event.base west,
                anchor=north west, 
                inner sep=0pt,
                align=left, 
                text=white!42!orange,
                font={\scriptsize}
            ] (date_n_location) {%
                \strut%
                \insertdate
            };

        %= upper right corner
            \fill [color=orange] (T) -- (M) -- (R) -- (NE) -- cycle;

        \end{tikzpicture}
    \end{beamercolorbox}%
}

\defbeamertemplate*{frametitle}{mytheme}[1][]
{%
    \begin{beamercolorbox}[wd=\paperwidth, ht=\paperheight]{frametitle}%
        \leavevmode
        \begin{tikzpicture}
            \coordinate (SE') at (\the\paperwidth,0);
            \coordinate (SE) at (\the\paperwidth,1);
            \coordinate (NE) at (\the\paperwidth,\the\paperheight);
            \coordinate (SW) at (0,1);
            \coordinate (SW') at (0,0);
            \coordinate (NW) at (0,\the\paperheight);

            \node at (NW) {$\bullet$};% in order to see box boundaries
            \node at (NE) {$\bullet$};
            \node at (SW) {$\bullet$};
            \node at (SE) {$\bullet$};

            \node[%
                below right = \verticalshift and \horizontalshift of NW,
                anchor = north west,
                text = black,
                font={\Large},
            ] (title) 
            {%
                \strut\insertframetitle
            };
        \end{tikzpicture}
    \end{beamercolorbox}
}

答案1

[以下内容不包含 parshape 内容(我想你可以从你提供的链接中复制代码)]

为什么要花功夫用 tikz 来定位 frametitle 等?我认为您的设计可以用经典的 beamer 工具来完成:

\documentclass[aspectratio=1610,t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel=true,kerning=true]{microtype}

\usepackage{roboto}

\title{The title}
\subtitle{Here comes the subtitle\\that can be pretty long}
\date[Short date]{Long date\\ Where the talk is given}
\author[email]{John Doe}
\institute{Institute}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usetikzlibrary{positioning}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% footline
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{author in head/foot}{fg=gray, bg=black}
\setbeamerfont{author in head/foot}{size=\large}
\setbeamertemplate{footline}{%
    \leavevmode%
    \hbox{\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,dp=1.125ex,leftskip=.3cm,rightskip=.3cm]{author in head/foot}%
        \usebeamerfont{author in head/foot}
        \insertslidenavigationsymbol
        \insertframenavigationsymbol
        \insertsubsectionnavigationsymbol
        \insertsectionnavigationsymbol
        \insertdocnavigationsymbol
        \insertbackfindforwardnavigationsymbol
        \hfill
        \insertframenumber
    \end{beamercolorbox}}%
    \vskip0pt%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% background
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{background canvas}{%
    \begin{tikzpicture}[overlay, remember picture]
        \fill [color=orange] (current page.north east) -- (current page.south east) -- ($(current page.south east)+(-5, 0)$) -- ($(current page.north east)+(-3, 0)$);
  \end{tikzpicture}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% frametitle
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamercolor{frametitle}{fg=black}
\setbeamerfont{frametitle}{size=\LARGE}
\setbeamerfont{framesubtitle}{size=\large}

\makeatletter
\setbeamertemplate{frametitle}{%
    \vbox{}\vskip-0.5em%
    \begin{beamercolorbox}[wd=.7\paperwidth]{frametitle}
        \usebeamerfont{frametitle}%
        \strut\insertframetitle\strut\par%
    \end{beamercolorbox}
    \ifx\insertframesubtitle\@empty%
  \else%
      \vskip-0.3em
    \begin{beamercolorbox}[wd=.68\paperwidth]{frametitle}
        \usebeamerfont{framesubtitle}%
        \strut\insertframesubtitle\strut\par%
    \end{beamercolorbox}    
  \fi
}
\makeatother

\begin{document}

\begin{frame}%
    \frametitle{There Is No Largest Prime Number} 
    \framesubtitle{The proof uses \textit{reductio ad absurdum}.} 
        some text
\end{frame}

\begin{frame}%
    \frametitle{There Is No Largest Prime Number}  
        some text
\end{frame}

\begin{frame}%
    \frametitle{There Is No Largest Prime NumberThere Is No Largest Prime Number} 
    \framesubtitle{The proof uses \textit{reductio ad absurdum}.} 
        some text
\end{frame}

\end{document}

在此处输入图片描述

相关内容