tikz节点的定位

2020-04-13 21:08发布

关于tikz结点定位的问题 就是在感受器.west往上偏移一点 -- 神经网络.east 往上偏移一点的箭头有什么简单点的方法定位吗。自己手动尝试定位真的优点笨重。 用这种方法draw[-Stealt...

关于tikz结点定位的问题 就是在感受器.west往上偏移一点 -- 神经网络.east 往上偏移一点的箭头有什么简单点的方法定位吗。自己手动尝试定位真的优点笨重。 用这种方法draw[-Stealth,above of = 0.1cm] (ganshou.east) -- (shenjing.west)还是自动从感受器的东到神经网络的西去。。 看了看手册,positioning是对node做偏移的。。 ![](https://pics.latexstudio.net/data/images/202004/58cce72c176327b.jpg) ```tex \documentclass[UTF8,fontset = macnew]{ctexart} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \node (ciji) [] at (-0.5,0) {刺激}; \node (ganshouqi)[draw,minimum height = 0.8cm,thick] at (1.5,0) {感受器}; \node (shenjing) [draw,minimum height = 0.8cm,thick] at (4,0) {神经网络}; \node (xiaoying) [draw,minimum height = 0.8cm,thick] at (6.5,0) {效应器}; \node (xiangying) [minimum height = 0.8cm,thick] at (8.5,0) {响应}; \draw [-Stealth] (ciji.east) -- (ganshouqi.west); \draw [-Stealth] (2.172,0.2) -- (3.146,0.2); \draw [-Stealth] (3.146,-0.2) -- (2.172,-0.2); \draw [-Stealth] (4.87,0.2) -- (5.83,0.2); \draw [-Stealth] (5.83,-0.2) -- (4.87,-0.2); \draw [-Stealth] (xiaoying.east) -- (xiangying.west); \end{tikzpicture} \end{document} ```
2条回答
registor
2020-04-14 15:07
如果用相对位置计算,是不是更方便一些呢,将尺寸比较定义成一个宏命令,修改会更方便一些。 ```tex \documentclass[tikz, border=5mm]{standalone} \usepackage{xeCJK} \usepackage{tikz} \usetikzlibrary{arrows.meta} \usetikzlibrary{positioning} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \def\ratio{0.4} % 定义位置比例宏 \node (ciji) [] at (-0.5,0) {刺激}; \node (ganshouqi)[draw,minimum height = 0.8cm,thick] at (1.5,0) {感受器}; \node (shenjing) [draw,minimum height = 0.8cm,thick] at (4,0) {神经网络}; \node (xiaoying) [draw,minimum height = 0.8cm,thick] at (6.5,0) {效应器}; \node (xiangying) [minimum height = 0.8cm,thick] at (8.5,0) {响应}; \draw [-Stealth] (ciji.east) -- (ganshouqi.west); \draw [-Stealth] ($(ganshouqi.east)!\ratio!(ganshouqi.north east)$) -- ($(shenjing.west)!\ratio! (shenjing.north west)$); \draw [-Stealth] ($(shenjing.west)!\ratio!(shenjing.south west)$) -- ($(ganshouqi.east)!\ratio!(ganshouqi.south east)$); \draw [-Stealth] (xiaoying.east) -- (xiangying.west); \end{tikzpicture} \end{document} ```

一周热门 更多>