Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Does anybody know how to do this:

line breaks in sections of an equation

Thank you!

share|improve this question

4 Answers 4

up vote 4 down vote accepted

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}

parboxes

share|improve this answer
    
Awesome, that worked nicely. How can I get the math font though, so that all the formulas have the same look? –  shailenTJ Jul 29 at 14:08
2  
@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 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.

enter image description here

\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}
share|improve this answer

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:

enter image description here

share|improve this answer

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} 

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.