有人知道怎么做这个吗:
谢谢你!
答案1
使用 parboxes(根据需要更改下面的宽度参数)。
\documentclass{article}
\begin{document}
\[
\parbox{0.2\textwidth}{\centering Node power consumption}
+
\parbox{0.2\textwidth}{\centering dynamic consumption}
+
\parbox{0.2\textwidth}{\centering static consumption}
\]
\end{document}
答案2
这是一个仅使用基本tabular
环境的解决方案。通过“包裹”指令tabular
中的 s,\textit
您可以将字母排版为斜体。
\documentclass{article}
\begin{document}
\[
\begin{tabular}{c}
Node\\ power\\ consumption
\end{tabular}
=
\begin{tabular}{c}
dynamic\\ consumption
\end{tabular}
+
\begin{tabular}{c}
static\\ consumption
\end{tabular}
\]
\[
\textit{\begin{tabular}{c}
Node\\ power\\ consumption
\end{tabular}}
=
\textit{\begin{tabular}{c}
dynamic\\ consumption
\end{tabular}}
+
\textit{\begin{tabular}{c}
static\\ consumption
\end{tabular}}
\]
\end{document}
答案3
该stackengine
包可以帮助您做到这一点,而无需使用以下Centerstack
命令进行任何计算:
\documentclass{article}
\usepackage{stackengine}
\setstackEOL{\\}
\begin{document}
\[
\Centerstack{Node power\\consumption}
=
\Centerstack{dynamic\\consumption}
+
\Centerstack{static\\consumption}
\]
\end{document}
答案4
以下是使用tikz
带有数学字体的包的另一种解决方案:
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\sffamily
\begin{tikzpicture}[node distance=.5ex,every node/.style={align=center}]
\node (con) at (0,0) {Node\\power\\consumption};
\node (eq) [right=of con]{$=$};
\node (dy) [right=of eq]{dynamic\\consumption};
\node (pl) [right=of dy]{$+$};
\node (st) [right=of pl]{static\\consumption};
\end{tikzpicture}
\end{document}
输出如下: