我希望使用高架支撑,从 2 的底部开始支撑 8、3、11 这三个项目。
以下是一个模板:
\documentclass[11pt,urlcolor=blue, linkcolor=blue]{article}
\usepackage{sseq}
\usepackage[all,cmtip]{xy}
\usepackage{tikz-cd}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{figure}[!h]
\begin{center}
\begin{tikzpicture}[scale=0.8]
\node at (0,5) {1};
\node at (0,4.5) {2};
\node at (0,4) {3};
\draw[->] (0,3.5) -- (0,2.5);
\node[right] at (0,3) {};
\node at (0,2) {4};
\node at (0,1.5) {};
\node at (0,1) {5};
\node at (0,0.5) {6};
\draw[->] (-0.5,3.5) -- (-3.5,2.5);
\node at (-2,3) {};
\node at (-3.5,2) {7};
\node at (-4,4) {8};
\draw[->] (-4,3.5) -- (-4,2.5);
\node[left] at (-4,3) {};
\node at (-4.5,2) {9};
\node at (-4,1.5) {};
\node at (-4,1) {10};
\node at (4,4) {11};
\draw[->] (4,3.5) -- (4,2.5);
\node[right] at (4,3) {};
\node at (4,2) {12};
\node at (4,1.5) {};
\node at (4,1) {13};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
答案1
我没有简化你的代码,代码可以通过几种不同的方式简化。我使用了positioning
库(手册 3.0.1a 第 229 页)定位节点2
并1
相对于节点3
。我根据它们的值命名了一些节点。为了使用括号,我使用了decorations.pathreplacing
库。(手册 3.0.1a 第 581 页)
\documentclass[11pt,urlcolor=blue, linkcolor=blue]{article}
% \usepackage{sseq}
% \usepackage[all,cmtip]{xy}
% \usepackage{tikz-cd}
\usepackage{tikz}
% \usetikzlibrary{matrix}
% \usetikzlibrary{decorations.markings}
\usetikzlibrary{positioning,decorations.pathreplacing}
\begin{document}
\begin{figure}[!h]
\begin{center}
\begin{tikzpicture}[scale=0.8]
\node at (0,4)(3) {3};
\node[above =of 3] {1};
\node[above=5mm of 3]{2};
\node at (-4,4)(8) {8};
\node at (4,4)(11) {11};
\draw[decorate, decoration={brace,raise=2pt,amplitude=10pt}](8.north west)--(11.north east);
\draw[->] (0,3.5) -- (0,2.5);
\node[right] at (0,3) {};
\node at (0,2) {4};
\node at (0,1.5) {};
\node at (0,1) {5};
\node at (0,0.5) {6};
\draw[->] (-0.5,3.5) -- (-3.5,2.5);
\node at (-2,3) {};
\node at (-3.5,2) {7};
\draw[->] (-4,3.5) -- (-4,2.5);
\node[left] at (-4,3) {};
\node at (-4.5,2) {9};
\node at (-4,1.5) {};
\node at (-4,1) {10};
\draw[->] (4,3.5) -- (4,2.5);
\node[right] at (4,3) {};
\node at (4,2) {12};
\node at (4,1.5) {};
\node at (4,1) {13};
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}