Beamer+Tikz 无法编译

Beamer+Tikz 无法编译

我曾尝试在自己的 MAC 机器上通过文本编辑器和 latexit 应用程序以及 sharelatex 编译以下内容。在我的计算机上,我必须在很长时间后退出,并且 sharelatex 超时。我不确定为什么它没有因错误或其他原因而退出。我从 tikz 文档中复制并粘贴了一个示例,并将其放在示例 beamer 幻灯片中。

\documentclass{beamer}

% Note - to make this an article/handout we would use:
% \documentclass{article} 
% \usepackage{beamerarticle}

\usepackage{pgfpages}
\usepackage{blindtext}
\usepackage{tikz}
\blindmathtrue
\usepackage{multicol}
% \setbeameroption{show notes on second screen}
\usetheme[progressbar=frametitle]{metropolis}           % Use metropolis theme
% \setbeamertemplate{frame numbering}[none]
\metroset{block=fill}
\setbeamercovered{transparent=15}

\usepackage{amsmath,amssymb,amsthm,mathrsfs,bbm,bm}
\usepackage{graphicx,subcaption,float,enumerate}


\title[short title]{Functions Testing}
\subtitle{Lecture 1}
\date{}
\author{}
\institute{School}


\begin{document}
\maketitle
% \setbeameroption{show notes on second screen}



\begin{frame}[Tea]

\begin{tikzpicture}[thick,help lines/.style={thin,draw=black!50}]

\def\A{\textcolor{input}{$A$}} \def\C{\textcolor{output}{$C$}} \def\E{$E$}

\colorlet{input}{blue!80!black} \colorlet{triangle}{orange}

\def\B{\textcolor{input}{$B$}} \def\D{$D$}

\colorlet{output}{red!70!black}

\coordinate [label=left:\A]

(A) at ($ (0,0) + .1*(rand,rand) $); \coordinate [label=right:\B] (B) at ($ (1.25,0.25) + .1*(rand,rand) $);

\draw [input] (A) -- (B);

\node [name path=D,help lines,draw,label=left:\D]

\node [name path=E,help lines,draw,label=right:\E]

(D) at (A) [circle through=(B)] {};

(E) at (B) [circle through=(A)] {};

\path [name intersections={of=D and E,by={[label=above:\C]C}}];

\draw [output] (A) -- (C) -- (B);

\foreach \point in {A,B,C} \fill [black,opacity=.5] (\point) circle (2pt);

\begin{pgfonlayer}{background} \fill[triangle!80] (A) -- (C) -- (B) -- cycle;

\end{pgfonlayer}

\node [below right, text width=10cm,align=justify] at (4,3) { \small\textbf{Proposition I}\par \emph{To construct an \textcolor{triangle}{equilateral triangle} on a given \textcolor{input}{finite straight line}.} \par\vskip1em Let \A\B\ be the given \textcolor{input}{finite straight line}.

}; \end{tikzpicture}

\end{frame}

\end{document}

答案1

许多错误是由于缺少 TikZ 及其库造成的,但最初的无休止循环来自于复制/粘贴错误

\node [name path=D,help lines,draw,label=left:\D]

\node [name path=E,help lines,draw,label=right:\E]

(D) at (A) [circle through=(B)] {};

(E) at (B) [circle through=(A)] {};

这里 TikZ 从未停止寻找节点的内容,但遇到了另一个节点命令,一切都变得不可预测。这也可能是一个错误,但由于行为定义不明确,任何事情都可能发生。清理代码并使用 Lua|XeLaTeX 运行,结果如下:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, intersections,through,backgrounds}
\usetheme[progressbar=frametitle]{metropolis}
\metroset{block=fill}
\setbeamercovered{transparent=15}

\title[short title]{Functions Testing}
\subtitle{Lecture 1}
\date{}
\author{}
\institute{School}

\begin{document}
\maketitle

\begin{frame}{Tea}
\begin{tikzpicture}[thick,help lines/.style={thin,draw=black!50}]
\def\A{\textcolor{input}{$A$}} \def\C{\textcolor{output}{$C$}} \def\E{$E$}
\colorlet{input}{blue!80!black} \colorlet{triangle}{orange}
\def\B{\textcolor{input}{$B$}} \def\D{$D$}
\colorlet{output}{red!70!black}

\coordinate [label=left:\A] (A) at ($ (0,0) + .1*(rand,rand) $); 
\coordinate [label=right:\B] (B) at ($ (1.25,0.25) + .1*(rand,rand) $);
\draw [input] (A) -- (B);
\node [name path=D,help lines,draw,label=left:\D](D) at (A) [circle through=(B)] {};
\node [name path=E,help lines,draw,label=right:\E](E) at (B) [circle through=(A)] {};
\path [name intersections={of=D and E,by={[label=above:\C]C}}];
\draw [output] (A) -- (C) -- (B);
\foreach \point in {A,B,C}{\fill [black,opacity=.5] (\point) circle (2pt);}
\begin{pgfonlayer}{background}
\fill[triangle!80] (A) -- (C) -- (B) -- cycle;
\end{pgfonlayer}

\node [below right, text width=5.2cm,align=justify] at (4,3) 
  { \small\textbf{Proposition I}\\\emph{To construct an 
    \textcolor{triangle}{equilateral triangle} 
  on a given \textcolor{input}{finite straight line}.} \\[1em] Let \A\B\ be the 
  given \textcolor{input}{finite straight line}.
  };
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

相关内容