我第一次使用 tikzpicture,试图创建一个图。只要我在以 %%%%%% 开头的行中添加逗号(这里只是为了突出显示)在 S_T 和 (,) K 之间,latex 就无法创建文件。怎么了?提前致谢
\documentclass[a4paper, 10pt]{article}
\usepackage[parfill]{parskip}
\usepackage[german]{varioref}
\usepackage{url}
\usepackage{amsmath}
\usepackage{dcolumn}
\setcounter{tocdepth}{4}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{intersections}
\begin{document
\begin{figure}[h] \centering
\begin{tikzpicture}
\draw[->] (0,0) -- (10,0);
\draw[->] (0,0) -- (0, 5);
\draw (2,0) -- (6,4);
\draw (4,0) -- (6,-4);
\draw (6,0) -- (10,4);
\draw[dashed] (4,0) -- (4,2);
\draw[dashed] (4,2) --(0,2);
\coordinate[label=left:$\text{Payoff}$] (A) at (0,3);
\coordinate[label=left:$S_T$] (A) at (10,-0.5);
\coordinate[label=center: $S_{\hat{\theta}-1}$] (K) at (2,-0.5);
\coordinate[label=left: $S_{\hat{\theta}}$] (A) at (4,-0.5);
\coordinate[label=center: $S_{\hat{\theta}+1}$] (A) at (6,-0.5);
\coordinate[label =center: $\delta$] (A) at (-0.5,2);
\coordinate[label =center: $C_T(S_T,KS_{\hat{\theta}-1})$] (A) at (4,4);
\coordinate[label =center: $C_T(S_TKS_{\hat{\theta}+1})$] (A) at (8,4);
%%%%%%\coordinate[label =center: $-2 \times C_T(S_T,KS_{\hat{\theta}})$] (A) at (7.5,-3);
\end{tikzpicture}
\end{figure}
答案1
除了失踪}
和\begin{document
失踪\end{document}
……
钛钾Z 将逗号视为字段分隔符,即使它们处于数学模式。因此,您必须将它们隐藏在一对中{}
才能使其正常工作:
\documentclass[a4paper, 10pt]{article}
\usepackage[parfill]{parskip}
\usepackage[german]{varioref}
\usepackage{url}
\usepackage{amsmath}
\usepackage{dcolumn}
\setcounter{tocdepth}{4}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{intersections}
\begin{document}
\begin{figure}[h] \centering
\begin{tikzpicture}
\draw[->] (0,0) -- (10,0);
\draw[->] (0,0) -- (0, 5);
\draw (2,0) -- (6,4);
\draw (4,0) -- (6,-4);
\draw (6,0) -- (10,4);
\draw[dashed] (4,0) -- (4,2);
\draw[dashed] (4,2) --(0,2);
\coordinate[label=left:$\text{Payoff}$] (A) at (0,3);
\coordinate[label=left:$S_T$] (A) at (10,-0.5);
\coordinate[label=center: $S_{\hat{\theta}-1}$] (K) at (2,-0.5);
\coordinate[label=left: $S_{\hat{\theta}}$] (A) at (4,-0.5);
\coordinate[label=center: $S_{\hat{\theta}+1}$] (A) at (6,-0.5);
\coordinate[label =center: $\delta$] (A) at (-0.5,2);
\coordinate[label =center: {$C_T(S_T,KS_{\hat{\theta}-1})$}] (A) at (4,4);
\coordinate[label =center: $C_T(S_TKS_{\hat{\theta}+1})$] (A) at (8,4);
\coordinate[label =center: {$-2 \times C_T(S_T,KS_{\hat{\theta}})$}] (A) at (7.5,-3);
\end{tikzpicture}
\end{figure}
\end{document}