
align
저는 TikZ를 처음 접했고 환경을 사용하여 일부 텍스트를 정렬한 다음 일부 TikZ 선을 사용하여 그 위에 무언가를 그리려고 합니다 .
alignment
하지만 환경을 TikZ 그림 안에 넣으려고 할 때마다 pdfLaTeX에서 오류가 발생하는 문제가 있습니다 .
내 코드는 다음과 같습니다.
\begin{figure}
\centering
\begin{tikzpicture}
\begin{align}
\notag &a_1,\ &b_1,\ &c_1,\ &d_1,\ &e_1\ \mbox{etc.}\\
\notag &a_2,\ &b_2,\ &c_2,\ &d_2,\ &e_2\ \mbox{etc.}
\end{align}
%% draw some stuff using tikz on the the aligned text.
\end{tikzpicture}
\end{figure}
하지만 항상 다음 오류가 발생합니다.
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.358 \end{align}
align
PS TikZ 환경 외부에 놓으면 모든 것이 정상적으로 작동합니다.
답변1
이것은 단지 문제가 아니라 align
거의 모든 비 tikz
건설 분야의 문제입니다. tikz
일반적인 LaTeX 명령이 필요한 상황에 처해야 합니다 . 그 중 하나는 노드에 대한 레이블입니다. 이제 의 구문 분석으로부터 항목을 추가로 보호하기 위해 아래와 같이 tikz
자료를 a에 포함할 수 있습니다 . minipage
AMS가 아닌 경우에도 비슷한 문제가 나타납니다 displaymath
.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) {
\begin{minipage}{0.9\linewidth}
\begin{align}
\notag &a_1,\ &b_1,\ &c_1,\ &d_1,\ &e_1\ \mbox{etc.}\\
\notag &a_2,\ &b_2,\ &c_2,\ &d_2,\ &e_2\ \mbox{etc.}
\end{align}
\end{minipage}
};
%% draw some stuff using tikz on the the aligned text.
\end{tikzpicture}
\end{document}
답변2
안에서 tikzpicture
당신은 언어를 말해야합니다 tikz
. 이것은 a node
와 a 안에 둘 수 있습니다 minipage
.
\documentclass{article}
\usepackage{amsmath,tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node at (0,0) {%
\begin{minipage}{5cm}%adjust width here
\begin{align}
\notag &a_1,\ &b_1,\ &c_1,\ &d_1,\ &e_1\ \mbox{etc.}\\
\notag &a_2,\ &b_2,\ &c_2,\ &d_2,\ &e_2\ \mbox{etc.}
\end{align}
\end{minipage}
};
%% draw some stuff using tikz on the the aligned text.
\end{tikzpicture}
\end{figure}
\end{document}