我正在努力将较旧的 Beamer 演示文稿的 TeX 代码插入到我目前使用 Lyx 整理的演示文稿中。问题似乎是 Lyx 无法识别包导入:
\usepackage{pgf,pgfarrows,pgfnodes}
我想要做的是使用 TeX 代码插入(Ctrl+L)插入几张幻灯片,其中使用 PGF 完成了一些绘图。
以下是其中一张幻灯片的示例:
\frame
{
\frametitle{Building things up}
\begin{pgfpicture}{0cm}{0cm}{5cm}{5cm}
\pgfnodebox{Node1}[stroke]{\pgfxy(1.2,5)}{Item 1}{2pt}{2pt}
\pgfnodebox{Node2}[stroke]{\pgfxy(8.2,5)}{Item 2}{2pt}{2pt}
\pgfnodebox{Node3}[stroke]{\pgfxy(3,2)}{a}{2pt}{2pt}
\pgfnodebox{Node4}[stroke]{\pgfxy(4.7,2)}{blue}{2pt}{2pt}
\pgfnodebox{Node5}[stroke]{\pgfxy(6.4,2)}{sky}{2pt}{2pt}
\pgfnodeconncurve{Node3}{Node4}{-20}{260}{1cm}{1cm}
\pgfnodeconncurve{Node3}{Node4}{-25}{270}{1cm}{1.5cm}
\pgfnodeconncurve{Node3}{Node4}{-30}{280}{1cm}{2cm}
\pgfnodeconncurve{Node3}{Node4}{-35}{290}{1cm}{2.5cm}
\pgfnodeconncurve{Node4}{Node5}{-5}{260}{.7cm}{.6cm}
\pgfnodeconncurve{Node4}{Node5}{-8}{270}{.8cm}{.8cm}
\pgfnodeconncurve{Node4}{Node5}{-11}{280}{.9cm}{1cm}
\pgfnodeconncurve{Node4}{Node5}{-13}{290}{1cm}{1.2cm}
\end{pgfpicture}
}
答案1
问题是#1
您的节点中有一个 ,而它应该是\#1
。以下内容为我编译。(但我没有使用 LyX)。
\documentclass{beamer}
\usepackage{pgf,pgfarrows,pgfnodes}
\begin{document}
\begin{frame}
\frametitle{Building things up}
\begin{pgfpicture}{0cm}{0cm}{5cm}{5cm}
\pgfnodebox{Node1}[stroke]{\pgfxy(1.2,5)}{Item \#1}{2pt}{2pt}
\pgfnodebox{Node2}[stroke]{\pgfxy(8.2,5)}{Item \#2}{2pt}{2pt}
\pgfnodebox{Node3}[stroke]{\pgfxy(3,2)}{a}{2pt}{2pt}
\pgfnodebox{Node4}[stroke]{\pgfxy(4.7,2)}{blue}{2pt}{2pt}
\pgfnodebox{Node5}[stroke]{\pgfxy(6.4,2)}{sky}{2pt}{2pt}
\pgfnodeconncurve{Node3}{Node4}{-20}{260}{1cm}{1cm}
\pgfnodeconncurve{Node3}{Node4}{-25}{270}{1cm}{1.5cm}
\pgfnodeconncurve{Node3}{Node4}{-30}{280}{1cm}{2cm}
\pgfnodeconncurve{Node3}{Node4}{-35}{290}{1cm}{2.5cm}
\pgfnodeconncurve{Node4}{Node5}{-5}{260}{.7cm}{.6cm}
\pgfnodeconncurve{Node4}{Node5}{-8}{270}{.8cm}{.8cm}
\pgfnodeconncurve{Node4}{Node5}{-11}{280}{.9cm}{1cm}
\pgfnodeconncurve{Node4}{Node5}{-13}{290}{1cm}{1.2cm}
\end{pgfpicture}
\end{frame}
\end{document}