Beamer - 叠加使 tikzpicture 动起来

Beamer - 叠加使 tikzpicture 动起来

以下代码使第一层相对于第二层和第三层定位不同(具有水平偏差)。

如果去掉colums和环境,这三个图形就处于相同的位置。columns

\documentclass[aspectratio=169]{beamer}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multimedia}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{listings}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{siunitx}
\DeclareSIUnit\sloc{\text{lines of code}}
\usepackage{xcolor}
\usepackage[outline]{contour}
\usepackage[super]{nth}
\usepackage{bm}

\usepackage{tikz}
\tikzset{external/export next=false}
\usetikzlibrary{external, calc, fixedpointarithmetic, decorations.pathmorphing, shapes.misc}
\usepackage{tikzscale}


\usetheme{AnnArbor}
\useoutertheme[right]{sidebar}
\useinnertheme{rounded}
\usecolortheme{dove}
\setbeamercovered{dynamic}
\setbeamercolor{alerted text}{fg=red}


\begin{document}

    \begin{frame}{uffaaa}
        \begin{columns}
            \begin{column}{0.7\textwidth}
            \end{column}
            \begin{column}{0.3\textwidth}
                \tikzsetnextfilename{figures/externalized/matCred}
                \includegraphics<1>[height=.8\textwidth]{figures/tikz/matrix/matCcirculdetailxox-red.tikz}
                \tikzsetnextfilename{figures/externalized/matCtrunc}
                \includegraphics<2>[height=.8\textwidth]{figures/tikz/matrix/matCcirculdetailxx.tikz}
                \tikzsetnextfilename{figures/externalized/matCtrunc-part}
                \includegraphics<3>[height=.8\textwidth]{figures/tikz/matrix/matCcirculdetailxx-partitioned.tikz}
            \end{column}
        \end{columns}
    \end{frame}


\end{document}

您可以使用代码

\begin{tikzpicture}
    \draw (0,0) rectangle (1,1);
\end{tikzpicture}

这三个*.tikz文件。

答案1

您必须注释掉后面的行\tikzsetnextfilename以避免插入虚假空格,例如

\tikzsetnextfilename{figures/externalized/matCred}%

在此处输入图片描述

代码:

\begin{filecontents*}{pic1.tikz}
\begin{tikzpicture}
    \draw[orange] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{filecontents*}
\begin{filecontents*}{pic2.tikz}
\begin{tikzpicture}
    \draw[red] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{filecontents*}
\begin{filecontents*}{pic3.tikz}
\begin{tikzpicture}
    \draw[red!50!blue] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{filecontents*}

\documentclass[aspectratio=169]{beamer}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}% loads also xcolor
\usetikzlibrary{external}
\tikzset{external/export next=false}
\usepackage{tikzscale,showframe}
\usetheme{AnnArbor}
\useoutertheme[right]{sidebar}
\useinnertheme{rounded}
\usecolortheme{dove}
\setbeamercovered{dynamic}
\setbeamercolor{alerted text}{fg=red}
\begin{document}
    \begin{frame}{uffaaa}
        \begin{columns}
            \begin{column}{0.7\textwidth}
            \end{column}
            \begin{column}{0.3\textwidth}
                \tikzsetnextfilename{figures/externalized/matCred}%
                \includegraphics<1>[height=.5\textwidth]{pic1.tikz}
                \tikzsetnextfilename{figures/externalized/matCtrunc}%
                \includegraphics<2>[height=.5\textwidth]{pic2.tikz}
                \tikzsetnextfilename{figures/externalized/matCtrunc-part}%
                \includegraphics<3>[height=.5\textwidth]{pic3.tikz}
            \end{column}
        \end{columns}
    \end{frame}
\end{document}

相关内容