想用tikz绘一个章节的结构图,但代码存在问题

2020-06-04 10:01发布

## 编译环境 操作系统 * [x ] Windows 7/8/10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x ] TexLive ...

## 编译环境 操作系统 * [x ] Windows 7/8/10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x ] TexLive `年份` * [ ] MikTeX `版本号` * [ ] CTeX `若需勾选,请把[ ]改成[x]` ## 我的问题 a1,b1,c1,d1表示1-4列对应方框内的文本。 将下面的代码修正,或是指出达到效果的代码都可以。多谢了。 `````markdown \documentclass[UTF8]{ctexart} \usepackage{tikz} \usetikzlibrary{shapes,arrows} \begin{document} \begin{tikzpicture}[node distance=10pt] \node[draw, rounded corners] (a1) {有理数}; \node[draw, below=of a1] (a2) {数轴}; \node[draw, below=of a2] (a3) {比较大小}; \node[draw, diamond, aspect=2, rihgt=of a1] (b1) {有理数的运算}; \node[draw, right= of b1] (c1) {加法}; \node[draw, right= of b1] (c3) {乘法}; \node[draw, below=of c1] (c3) {交换律结合律}; \node[draw, below=of c3] (c4) {乘方}; \node[draw, right= of c1] (d1) {减法}; \node[draw, right= of c3] (d2) {分配律}; \node[draw, right= of c3] (d3) {除法}; \draw[->] (a1) -- node[rihgt] {点与数的对应} (a2); \draw[->] (a2) -- (a3); \draw[->] (a1) -- (b1); \draw[->] (b1) -- (b1-|-c1) (c1); \draw[->] (b1) -- (b1-|-c3) (c3); \draw[->] (c1) -- (d1); \draw[-] (c1) -- (c2); \draw[->] (c2) -- (c3); \draw[->] (c3) -- (c4); \draw[->] (c1) -- (d1); \draw[-] (c4) -- (d2); \draw[->] (c4) -- (d3); \end{tikzpicture} \end{document} ``` [![](https://wenda.latexstudio.net/data/attach/200604/l1ysEGRp.PNG)](https://wenda.latexstudio.net/data/attach/200604/l1ysEGRp.PNG)
3条回答
这个只要认真一点就不会有问题。 ``` \documentclass[UTF8]{ctexart} \usepackage{tikz} \usetikzlibrary{shapes,arrows} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[node distance=10pt] \node[draw, rounded corners] (a1) {有理数}; \node[draw, below=20pt of a1] (a2) {数轴}; \node[draw, below=of a2] (a3) {比较大小}; \node[draw, diamond, aspect=2, right=of a1] (b1) {有理数的运算}; \node[draw, right=of b1] (c2) {\parbox{3em}{交换律\\ 结合律}}; \node[draw, above=of c2] (c1) {加法}; \node[draw, below=of c2] (c3) {乘法}; \node[draw, below=of c3] (c4) {乘方}; \node[draw, right=of c1] (d1) {减法}; \node[draw, right=of c2] (d2) {分配律}; \node[draw, right=of c3] (d3) {除法}; \draw[->] (a1) -- node[right] {点与数的对应} (a2); \draw[->] (a2) -- (a3); \draw[->] (a1) -- (b1); \draw[->] (b1.east) -- ++(5pt,0) |- (c1); \draw[->] (b1.east) -- ++(5pt,0) |- (c3); \draw[-] (c1) -- (c2); \draw[-] (c2) -- (c3); \draw[->] (c3) -- (c4); \draw[->] (c1) -- (d1); \draw[-] (c3) -- (d2); \draw[->] (c3) -- (d3); \end{tikzpicture} \end{document} ``` ![](https://wenda.latexstudio.net/data/attach/200604/HwYsRAaC.jpg)

一周热门 更多>