我有下图
\documentclass[border=0.9cm]{standalone}
% More defined colors
\usepackage[dvipsnames]{xcolor}
\usepackage{amsmath}
% Required package
\usepackage{tikz}
\usetikzlibrary{positioning}
\definecolor{gr}{RGB}{221, 220, 221}
\begin{document}
\begin{tikzpicture}
\node [draw=gr,
fill=gr,
rounded corners,
minimum width=3cm,
minimum height=1.2cm,
] (controller) {$equations$};
\node [draw=gr,
fill=gr,
rounded corners,
minimum width=2cm,
minimum height=1.2cm,
below right= 1cm and -4cm of controller
] (sensor) {\begin{tabular}{c} Dynamical \\ system \end{tabular}};
\draw[-stealth] (controller.east) -- +(0.6,0) |- node[pos=0.755, above]{$\text{control input}$} (sensor.east);
\draw[-stealth] (sensor.west) -- +(-1.8,0) |- node[pos=0.5,left]{$x(k)$} (controller.west);
\end{tikzpicture}
\end{document}
我如何添加类似这里的文字(用红色标记)
答案1
尝试
\draw[-stealth] (controller.east) -- +(0.6,0) |- node[pos=0.755, above]{control input} node[pos=0.755, below]{another text here} (sensor.east);
\draw[-stealth] (sensor.west) -- node[above]{Text also here} +(-1.8,0) |- node[pos=0.5,left]{$x(k)$} (controller.west);
您可以node
连续执行多个命令。
顺便说一句,您可以$\text{some words}$
用替换some words
。
\documentclass{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
\definecolor{gr}{RGB}{221, 220, 221}
\begin{document}
\begin{tikzpicture}
\node [draw=gr,
fill=gr,
rounded corners,
minimum width=3cm,
minimum height=1.2cm,
] (controller) {$equations$};
\node [draw=gr,
fill=gr,
rounded corners,
minimum width=2cm,
minimum height=1.2cm,
below right= 1cm and -4cm of controller,
align=center
] (sensor) {Dynamical \\ system};
\draw[-stealth]
(controller.east)
-- +(0.6,0) node[pos=0.5,above]{X}
|- node[pos=0.755, above]{control input}
node[pos=0.755, below]{another text}
(sensor.east);
\draw[-stealth]
(sensor.west)
-- node[above]{also here} +(-1.8,0)
|- node[pos=0.5,left]{$x(k)$}
(controller.west);
\end{tikzpicture}
\end{document}