出了点问题——可能缺少 \item。\end{frame}: tikzpicture

出了点问题——可能缺少 \item。\end{frame}: tikzpicture

我的演示文稿中有以下 tikzpicture:

\begin{frame}{Unitary bounds}
\begin{figure}
    \scalebox{.7}{
\begin{center}
\begin{tikzpicture}
\fill[red,opacity=.2] (-.5,-1) rectangle (4,3);
\fill[green!80!black,opacity=.2] (-.5,3) rectangle (4,5);
\draw[very thick,green!80!black] (-1,3) -- (5,3) node[right, black] {$\Delta=\Delta_A$};
\draw[very thick, green!80!black] (-1,1) -- (5,1) node[right,black] {$\Delta=\Delta_B$};
\draw[thick,->] (0,-1) -- (0,5.5) node[right] {$\Delta$};
\node at (2,2) {non-unitary};
\node at (2,0) {non-unitary};
\node at (2,4) {unitary};
\end{tikzpicture}
\end{center}}
\caption{Unitarity structure of superconformal multiplets.}\label{fig:unitarity}
\end{figure}
\end{frame}

但不幸的是,这导致

Something's wrong--perhaps a missing \item. \end{frame}

答案1

  • 注释掉center环境并加载tikz包后,问题就消失了。
  • \scalebox另外,你可以使用tikzoption来取消scale=0.7。如果你也想缩放节点文本,请every node/.append style={scale=0.7}按照建议使用如何缩放包含文本的 tikzpicture?
  • 在以下示例中,center环境被替换为\centering\centering无需使用,因为figure环境默认将其内容居中。
\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}{Unitary bounds}
  \begin{figure}
    \begin{tikzpicture}[scale=0.7, every node/.append style={scale=0.7}]
      \fill[red,opacity=.2] (-.5,-1) rectangle (4,3);
      \fill[green!80!black,opacity=.2] (-.5,3) rectangle (4,5);
      \draw[very thick,green!80!black] (-1,3) -- (5,3) node[right, black] {$\Delta=\Delta_A$};
      \draw[very thick, green!80!black] (-1,1) -- (5,1) node[right,black] {$\Delta=\Delta_B$};
      \draw[thick,->] (0,-1) -- (0,5.5) node[right] {$\Delta$};
      \node at (2,2) {non-unitary};
      \node at (2,0) {non-unitary};
      \node at (2,4) {unitary};
    \end{tikzpicture}
    \caption{Unitarity structure of superconformal multiplets.}\label{fig:unitarity}
  \end{figure}
\end{frame}

\end{document}

在此处输入图片描述

相关内容