无法为节点的单独文本添加换行符

无法为节点的单独文本添加换行符

这是此图的我的 LaTeX 代码。我无法为文本添加换行符

\tikzstyle{arrow}=[draw, -latex] 
\begin{tikzpicture}

% first row of nodes
\draw(1,0.5)  circle(0.5) node[align = center, label=below:{$K_1, h_1$}] {$\times$};
\draw(4,0)  rectangle (6,1)  node[pos=0.5,  label=above:{$K_2, h_2$}] {$10^{-4}$};
\draw(8,0)  rectangle (10,1) node[pos=0.5, label=below:{Displacement \\ Sensor}]{$100 \times V_S$};
\draw(12,0) rectangle (14,1) node[pos=.5, label=below:{$Amplifier$}] {$10^3$} ;



% lines for connecting nodes
% The leftest arrow
\draw[arrow] (1,1) (-2,0.5) -- (0,0.5) node [pos=0.1, draw, sloped, above right]  {Input force} node [below, pos=0.5] {F \\ Balancing force};
\draw[arrow] (1,1) (2,0.5) -- (4,0.5) node [pos=0.1, draw, sloped, above right]  {$O_1 = I_2$} node [below, pos=0.5] {$\Omega$};
\draw[arrow] (1,1) (6,0.5) -- (8,0.5) node [pos=0.1, draw, sloped, above right] {$O_2 = I_3$} node [below, pos=0.5] {$mV$};
\draw[arrow] (1,1) (10,0.5) -- (12,0.5) node [pos=0.1, draw, sloped, above right] {$O_3 = I_4$} node [below, pos=0.5] {$mV$};
% The rightest arrow
\draw[arrow] (1,1) (14,0.5) -- (16,0.5) node [pos=0.1, draw, sloped, above right] {$O_4 = O$} node [below, pos=0.5] {$Pa$};

\end{tikzpicture}

在此处输入图片描述

我想用这种方式显示它。

移位

传感器

F

平衡传感器

答案1

以下是你正在尝试做的事情的猜测

\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw(1,0.5) circle[radius=0.5] node[label={[below=0.8cm]:$K_1, h_1$}]{$\times$};
\draw(4,0) rectangle (6,1) node[pos=0.5, label={[above=0.3cm]:$K_2, h_2$}]{$10^{-4}$};
\draw(8,0) rectangle (10,1) node[pos=0.5, label={[align=left, below=0.8cm]:Displacement\\Sensor}]{$100\times V_S$};
\draw(12,0) rectangle (14,1) node[pos=0.5, label={[below=0.8cm]:$Amplifier$}]{$10^3$} ;
\draw[-latex] (-2,0.5) --node[above]{Input force} node[below, align=left]{F\\Balancing sensor} (0,0.5);
\draw[-latex] (2,0.5) --node[above]{$O_1=I_2$} node[below]{$\Omega$} (4,0.5);
\draw[-latex] (6,0.5) --node[above]{$O_2=I_3$} node[below]{$mV$} (8,0.5);
\draw[-latex] (10,0.5) --node[above]{$O_3=I_4$} node[below]{$mV$} (12,0.5);
\draw[-latex] (14,0.5) --node[above]{$O_4=O$} node[below]{$Pa$} (16,0.5);
\end{tikzpicture}
\end{document}

水平交换图

通常情况下,人们不会用坐标、圆和矩形来硬编码这样的图表。例如,你可以使用tikzcd

答案2

添加align=center一些距离。

\draw(8,0)  rectangle (10,1) node[pos=0.5, label={[align=center,label distance=0.5cm] below:Displacement \\ Sensor}]{$100 \times V_S$};

\draw[arrow] (1,1) (-2,0.5) -- (0,0.5) node [pos=0.1, draw, sloped, above right]  {Input force} node [below=0.5cm, pos=0.5, align=center] {F \\ Balancing force};

相关内容