
ノード内にラベルとして数式を追加すると、正常に動作します。
\begin{figure}
\begin{tikzpicture}[]
\node[circle, draw] (c1) [label=left: text] {};
\node[block, draw, right = of c1] (e1) {$1*1=1$};
\draw[->] (c1) -- (e1);
\end{tikzpicture}
\end{figure}
ただし、数式をノードの隣に配置したい場合 (上記の「テキスト」ラベルのように)、コンパイルされません。
\begin{figure}
\begin{tikzpicture}[]
\node[circle, draw] (c1) [label=left: text] {};
\node[block, draw, right = of c1] (e1) [label=right: $1*1=1$] {};
\draw[->] (c1) -- (e1);
\end{tikzpicture}
\end{figure}
どうすればそれが機能するかについて何か考えはありますか?
答え1
{}
問題を解くために数式をラップする
説明
として@Zarkoはコメントで説明した問題は数式そのものではなく、符号です。=
符号が原因で、オプションが誤って解析されることになります。式の周囲にtikz
という追加レイヤーを配置すると、 はtikz から隠されます。 {}
=
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\begin{tikzpicture}[]
\node[circle, draw] (c1) [label=left: text] {};
\node[draw, right = of c1] (e1) [label=right: {$1*1=1$}] {};
\draw[->] (c1) -- (e1);
\end{tikzpicture}
\end{figure}
\end{document}