投影仪中的换行符是什么?

投影仪中的换行符是什么?

如果我使用\\ 或 $\newline$在 tikzpicture 内的 beamer 中,出现以下错误:

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

它的正确用法是怎样的?

我的 tikz 代码如下:

\documentclass{beamer}
\usepackage{color}
\usepackage{enumerate}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage{pgf}
\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{beamerthemesplit}
\usepackage{amsmath,hyperref}
\usetheme{CambridgeUS}
\usecolortheme{whale}
\useoutertheme{infolines}
\useinnertheme{circles}
\usefonttheme[onlylarge]{structuresmallcapsserif}
\setbeamercolor{title}{fg=red!80!black,bg=red!20!white}
\setbeamertemplate{footline}[page number]{}
\setbeamertemplate{navigation symbols}{}

\begin{document}

\begin{frame}{A}
\begin{tikzpicture}[->,shorten >=1pt,auto,node distance=7 cm,
                semithick, scale = 0.4, transform shape]


\node[initial,state] (A)                    {$s_0$};
\node[state]         (B) [above right of=A] {$s_1$};
\node[state]         (C) [below right of=A] {$s_2$};
\node[state]         (D) [below right of=B] {$s_3$};
\node[state]         (E) [above right of=D] {$s_4$};
\node[state]         (F) [below right of=D] {$s_5$};


  \path (A) 
    edge [left] node [blue, pos=0.5, sloped, above] {$0 \rightarrow [x = x.0.0]$} (B)
    edge [left] node [cyan, pos=0.8]{$1 \rightarrow [x = x.0.1]$} (C)(B) 
    edge [loop above] node [align=center] {$0 \rightarrow$ \\ $[x = x.0]$ }   (B)
    edge [bend right,left] node  {$1 \rightarrow [x = x.1]$ }   (C)
    edge [] node [red, pos=0.2] {$\$  \rightarrow  [x = x.0.\$]$ } (D);   

\end{tikzpicture}
\end{frame}



\end{document}

答案1

改变线路

edge [loop above] node [align=center] {$0 \rightarrow$ $\\$ $[x = x.0]$ }   (B)

edge [loop above] node [align=center] {$0 \rightarrow$ \\ $[x = x.0]$ }   (B)

\\不应该处于数学模式,即在一对之内$\\$

相关内容