
두 개의 서로 다른 노드에 두 개의 벡터를 표시한 다음 화살표를 사용하여 일부 요소를 연결하려고 합니다.
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[node distance = 2cm,auto,remember picture]
% Place nodes
\node [draw,rounded corners] (node1) {$\matrix[mymatrix, name=M1]{
1 \\
|[!]| 2\rho\pi \\
|[draw,rounded corners,fill=blue]| 3\\
}$};
\node [draw,rounded corners] (node1) {$\matrix[mymatrix, name=M2]{
4 \\
|[!]| 2\lambda\pi \\
|[draw,rounded corners,fill=yellow]| 3\\
}$};
\draw [red, >=stealth, <->, shorten <= 3pt, shorten >=3 pt]
(M1-2-1.south east) to[bend left=60] (M2-3-1.north east);
\end{tikzpicture}
내 Tikz 서문에는 다음과 같은 패키지 선언이 있습니다.
\documentclass{article,fleqn}
\usepackage{tikz,amsmath, amssymb,bm,color,automata,matrix,positioning,fit}
\usepackage[margin=0cm,nohead]{geometry}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,arrows}
% needed for BB
\usetikzlibrary{calc}
\usetikzlibrary{topaths}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{calc}
\usetikzlibrary{tikzmark}
\usetikzlibrary{topaths}
\usetikzlibrary{backgrounds}
\usepackage{todonotes}
%To be able to use
\tikzset{
!/.style = {
fill=yellow!30,
},
mymatrix/.style = {
matrix of math nodes,
left delimiter = (,
right delimiter = ),
nodes={minimum width=6ex},
}
}
\tikzset{every picture/.style=remember picture}
\PreviewEnvironment{tikzpicture}
아마도 필요한 것보다 더 많이 사용하고 있지만 다른 파일이 있습니다. Tikz에서 다음과 같은 오류가 발생했습니다.
Package amsmath Error: Old form '\matrix' should be \begin{\matrix}..de[draw,rounded corners](node1){$\matrix(followed by: [mymatrix, na
나는 이미 Latex에서 그것을 사용했지만(일부 stackeschange 사용자의 도움 덕분에) Tikz에서는 작동하지 않는 것 같습니다. 누군가 제안이 있다면 부탁드립니다...
건배.
답변1
귀하의 코드에는 구문상 문제가 많이 있습니다.
아래 코드에서는 두 가지 가능성을 보여줍니다. 강조표시는 \tcbhighmath
다음 명령을 사용하여 수행되었습니다 .tcolorbox
패키지; 추가 화살표는 다음의 도움으로 그려졌습니다.tikzmark
도서관:
\documentclass{article}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}
\usetikzlibrary{tikzmark,positioning}
\tcbset{
myformulai/.style={
colback=yellow!30,
colframe=yellow!30,
left=2pt,right=2pt,top=0pt,bottom=0pt,
},
myformulaii/.style={
colback=blue!30,
boxrule=0.4pt,
colframe=blue!30!black,
left=2pt,right=2pt,top=0pt,bottom=0pt,
},
myformulaiii/.style={
colback=white,
colframe=black,
boxrule=0.4pt,
left=2pt,right=2pt,top=0pt,bottom=0pt,
}
}
\begin{document}
\[
\tcbhighmath[myformulaiii]{%
\begin{pmatrix}
1 \\ \tcbhighmath[myformulai]{2\rho\pi\tikzmark{a}} \\ \tcbhighmath[myformulaii]{3}
\end{pmatrix}}
\]
\[
\tcbhighmath[myformulaiii]{%
\begin{pmatrix}
1 \\ \tcbhighmath[myformulai]{2\rho \pi} \\ \tcbhighmath[myformulaii]{3}\tikzmark{b}
\end{pmatrix}}
\]
\begin{tikzpicture}[remember picture, overlay]
\draw [red, >=stealth, <->, shorten <= 3pt, shorten >=3 pt,overlay]
(pic cs:a) to[bend left=90] (pic cs:b);
\end{tikzpicture}
\begin{center}
\begin{tikzpicture}[remember picture, overlay]
\node[rounded corners,draw] (mat1)
{
$\begin{pmatrix}
1 \\ \tcbhighmath[myformulai]{2\rho\pi\tikzmark{c}} \\ \tcbhighmath[myformulaii]{3}
\end{pmatrix}$
};
\node[rounded corners,draw,below=of mat1] (mat2)
{
$\begin{pmatrix}
1 \\ \tcbhighmath[myformulai]{2\rho \pi} \\ \tcbhighmath[myformulaii]{3}\tikzmark{d}
\end{pmatrix}$
};
\draw [red, >=stealth, <->, shorten <= 3pt, shorten >=3 pt,overlay]
(pic cs:c) to[bend left=90] (pic cs:d);
\end{tikzpicture}
\end{center}
\end{document}