10

How to write the below expression in latex using equation or align.

enter image description here

Edit: Changed the wordings based on the suggestion from @Henri Menke

2
  • 9
    What is this supposed to do apart from being hard to read? Sep 10, 2019 at 8:46
  • 9
    Probably be easy to read. You don't know the context or the audience, so you have no justification for jumping to such narrow-minded condescending criticism. If you want to offer neutral, constructive criticism, you could say "Would form X be clearer to read for your scenario?" and be fully open to a potential answer "No". Sep 10, 2019 at 22:11

5 Answers 5

8

Very simple with stackengine:

\documentclass{article}

\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine} 

\begin{document}

\[ \begin{pmatrix}
  \Centerstack{Rate of heat \\ conduction \\at $x$} 
\end{pmatrix} -
 \begin{pmatrix}
  \Centerstack{Rate of heat \\ conduction \\at $x+Δx$}
\end{pmatrix} + 
\begin{pmatrix}
  \Centerstack{Rate of heat \\ generation \\ inside the \\ element} 
\end{pmatrix} =
\begin{pmatrix}
  \Centerstack{Rate of change \\ of the energy \\ content of the \\ element}
\end{pmatrix} \]%

\end{document} 

enter image description here

14

Decide which one is better in your context.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

This is the formula using words:
\begin{equation*}
\begin{pmatrix}\begin{tabular}{@{}c@{}}
Rate of heat \\ conduction \\ at $x$
\end{tabular}\end{pmatrix}
-
\begin{pmatrix}\begin{tabular}{@{}c@{}}
Rate of heat \\ conduction \\ at $x+\Delta x$
\end{tabular}\end{pmatrix}
+
\begin{pmatrix}\begin{tabular}{@{}c@{}}
Rate of heat \\ generation \\ inside the \\ element
\end{tabular}\end{pmatrix}
=
\begin{pmatrix}\begin{tabular}{@{}c@{}}
Rate of change\\ of the energy \\ content of the \\ element
\end{tabular}\end{pmatrix}
\end{equation*}

Let's denote by $R_{\mathrm{hc}}(x)$ the rate of heat conduction at~$x$, 
by $R_{\mathrm{hgi}}$ the rate of heat generation inside the element and
by $\mathit{RC}_{\mathrm{ec}}$ the rate of change of the element's energy
content. Then
\begin{equation*}
R_{\mathrm{hc}}(x)-R_{\mathrm{hc}}(x+\Delta x)+R_{\mathrm{hgi}}
=\mathit{RC}_{\mathrm{ec}}
\end{equation*}

\end{document}

enter image description here

3
  • This seems to be a more elegant solution. Thanks @egreg . Sep 11, 2019 at 7:04
  • @egreg What does the command {@{}c@{}} of the tabular environment do? Sep 18, 2019 at 0:43
  • 1
    @MarkFantini It defines “one column with center alignment and no padding on either side”.
    – egreg
    Sep 18, 2019 at 8:14
11

A new macro like \newcommand{\term}[1]{\left(\begin{tabular}{@{}c@{}}#1\end{tabular}\right)} can be very handy in this case:

\documentclass{article}

\newcommand{\term}[1]{\left(\begin{tabular}{@{}c@{}}#1\end{tabular}\right)}

\begin{document}

This is the formula using words:
\[
\term{Rate of heat\\ conduction\\ at $x$}
- \term{Rate of heat\\ conduction\\ at $x+\Delta x$}
+ \term{Rate of heat\\ generation\\ inside the\\ element} 
= \term{Rate of change\\ of the energy\\ content of the\\ element}
\]

\end{document}

enter image description here

2
\documentclass{book}

\usepackage{amsmath}

\begin{document}

\begin{equation*}

\left(\begin{array}{c}
\text{Rate of heat}\\
\text{conduction}\\
\text{at } x
\end{array}\right)-
\left(\begin{array}{c}
\text{Rate of heat}\\
\text{conduction}\\
\text{at } x + \triangle x
\end{array}\right) +
\left(\begin{array}{c}
\text{Rate of heat}\\
\text{generation}\\
\text{inside the}\\
\text{element}
\end{array}\right) =
\left(\begin{array}{c}
\text{Rate of change}\\
\text{of the energy}\\
\text{content of the}\\
\text{element}
\end{array}\right)

\end{equation*}

\end{document} 

enter image description here

2
  • Semantically, I think array should only enclose arrays of mathematical expressions; you've put lines of text in one and tabular is probably the better environment for that. Or maybe even a \parbox. Sep 11, 2019 at 0:01
  • Surely we want \Delta here, not \triangle. Sep 11, 2019 at 13:49
1

A solution using TikZ, with its internal aligns, to do a verbal equation (hence as spoken aloud and with symbolics minimised) of what are, in effect, conceptual automata; and, since the inflow and outflow happen concurrently, removing the linearity implied by the algebraic algorithm and re-arranging to show that energy in/out simultaneity feeding into the outcome.

verbal equation

Plus some colour coding, hot and cold.

A true visual representation would have a receptacle icon to hold the energy while it is in flux (like a cup), a pour-in icon (like a teapot, say), a pour-out icon (like air and a saucer), and a time dimension (animation?).

Not an equation in the narrow sense, though. So not really an answer.

MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}

\begin{document}
  \begin{tikzpicture}[%
    >=stealth,
    node distance=2cm,
    on grid,
    auto
  ]
    \node[state] (A)              [align=center,fill=blue!5,text width=2cm]{Rate of heat conduction at  $x$};
    \node        (A1) [align=center,below right=of A,text width=2em]{\textit{minus}};
    \node        (B) [align=center,right= of A1,fill=green!15,text width=2cm]{Rate of heat conduction at  $x + \Delta x$};
    \node        (B1) [align=center,above right=of A,text width=2em]{\textit{plus}};
    \node        (C) [align=center,right= of B1,fill=red!5,text width=2cm]{Rate of heat generation inside the element};
    \node        (C2) [align=center, right=of A]{};
    \node        (C3) [align=center, right=of C2]{};
        \node        (C1) [align=center, right=of C3,text width=2cm]{\textit{equals}};
    \node        (C4) [align=center, right=of C1]{};
        \node        (D) [state,node distance=1cm,align=center,right= of C4,fill=blue!5,text width=2cm]{Rate of change of the energy content of the element};
      \end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .