# Line breaks in part of the equation in math mode - how to?

Does anybody know how to do this:

Thank you!

-

Use parboxes (change the width parameters in the following as appropriate).

\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}


-
Awesome, that worked nicely. How can I get the math font though, so that all the formulas have the same look? –  shailenTJ Jul 29 '14 at 14:08
@shailenTJ --- By default the fonts in math mode and text mode are the same. Have you changed this in your document? –  Ian Thompson Jul 29 '14 at 14:13

Here's a solution that uses just the basic tabular environment. By "wrapping" the tabulars in \textit directives you can typeset the letters in italics.

\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}

-

Here is another solution using tikz package with math fonts also:

\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}


The output is as follows:

-

Teh stackengine package helps doing that without having to compute whatever with the Centerstack command:

\documentclass{article}
\usepackage{stackengine}
\setstackEOL{\\}

\begin{document}
$\Centerstack{Node power\\consumption} = \Centerstack{dynamic\\consumption} + \Centerstack{static\\consumption}$

\end{document}


-