如何在 tikz 图表中使用方括号?

如何在 tikz 图表中使用方括号?

我正在尝试使用 Tikz 在 TeX 中绘制一个序列,其中顶点是 $[X,Y]$,但我似乎无法让代码运行。这是我尝试使用的代码。

\documentclass[12pt]{amsart}
\begin{document}
\begin{prop}
The retract of an $E$-local spectrum is $E$-local.
\end{prop}
\begin{proof}
Suppose $f:X\to Y$ is a morphism of spectra with $Y$ an $E$-local spectrum so
that $f$ admits a retract. Thus, there is $r:Y\to X$ such that $rf=1$. Then for $Z$ an $E$-acyclic spectrum we get a diagram whose composite is the identity
\[
\begin{tikzcd}
 [Z, X]\arrow{r}{f_*}& [Z, Y]\arrow{r}{r_*}& [Z, X]
\end{tikzcd}
\]
but as $Y$ is $E$-local, $[Z, Y]=0$. So, in fact $[Z, X]=0$.
\end{proof}
\end{document}

我收到以下错误

Package PGF Math Error: Unknown function `Z' (in `Z').

有谁知道如何解决这一问题?

谢谢!

答案1

类似这样。改用\left [ ... \right ]

在此处输入图片描述

代码

\documentclass[12pt]{amsart}
\usepackage{tikz-cd}
\newtheorem{prop}{Proposition}
\begin{document}
\begin{prop}
The retract of an $E$-local spectrum is $E$-local.
\end{prop}
\begin{proof}
Suppose $f:X\to Y$ is a morphism of spectra with $Y$ an $E$-local spectrum so
that $f$ admits a retract. Thus, there is $r:Y\to X$ such that $rf=1$. Then for $Z$ an $E$-acyclic spectrum we get a diagram whose composite is the identity
\[
\begin{tikzcd}
\left [Z, X \right]\arrow{r}{f_*}& \left [Z, Y\right ]\arrow{r}{r_*}&\left [Z, X\right ]
\end{tikzcd}
\]
but as $Y$ is $E$-local, $[Z, Y]=0$. So, in fact $[Z, X]=0$.
\end{proof}
\end{document}

答案2

[在 中有特殊用途tikz。命令的选项tikz包含在 中[..]。你可以通过将[(和]tikz括在括号中来隐藏解析器,例如{[Z, X]}

\documentclass[12pt]{amsart}
\usepackage{tikz-cd}
\newtheorem{prop}{Proposition}
\begin{document}
\begin{prop}
The retract of an $E$-local spectrum is $E$-local.
\end{prop}
\begin{proof}
Suppose $f:X\to Y$ is a morphism of spectra with $Y$ an $E$-local spectrum so
that $f$ admits a retract. Thus, there is $r:Y\to X$ such that $rf=1$. Then for $Z$ an $E$-acyclic spectrum we get a diagram whose composite is the identity
\[
\begin{tikzcd}
 {[Z, X]}\arrow{r}{f_*}& {[Z, Y]}\arrow{r}{r_*}& {[Z, X]}
\end{tikzcd}
\]
but as $Y$ is $E$-local, $[Z, Y]=0$. So, in fact $[Z, X]=0$.
\end{proof}
\end{document}

在此处输入图片描述

相关内容