# How can i have text between brackets in equation with respect to some criterion?

I try to have something close to that

Here is my try,

$$\begin{array}{cccc} \partial_t C & + \partial_x u C + \partial_x v C = & D_x \partial_{xx} C + D_y \partial_{yy} C + & R(C) \\ \begin{Bmatrix} \text{Time rate of\\ change\\ of concentration\\ of chemical\\ component } \end{Bmatrix} & + \begin{Bmatrix} \text{ Term of advection\\ of chemical component } \end{Bmatrix} & + \begin{Bmatrix} \text{ Change in\\ component\\ due to\\ diffusion \\} \end{Bmatrix} & + \begin{Bmatrix} \text{Rate of\\ formation of component - Rate of\\ consumption of\\ component } \end{Bmatrix} \end{array}$$


Another question : how to tell to Latex to respect the width of the text between parenthesis automatically according to the first equation above

(edited answer after noticing that I had misunderstood the OP's overall objective)

Something like this?

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{mathtools,ragged2e,array}
\newcolumntype{C}{>{{}}c<{{}}} % column type for binary and relational operator symbols
\newcommand\mymat[2][0.12]{%
\begin{Bmatrix}
\footnotesize
\begin{tabular}{@{}p{#1\textwidth}@{}} % default width is 0.12\textwidth
\itshape\Centering #2
\end{tabular}
\end{Bmatrix}
}
\begin{document}
$$\setlength\arraycolsep{0pt} \begin{array}{cCcCcCc} \partial_t C & + & \partial_x u C + \partial_x v C & = & D_x \partial_{xx} C + D_y \partial_{yy} C & + & R(C) \\[2ex] \mymat{Time rate of change of concentration of chemical component} & + & \mymat[0.1]{Term of advection of chemical component} & = & \mymat[0.1]{Change in component due to diffusion} & + & \mymat[0.14]{Rate of formation of component~- Rate of consumption of component} \end{array}$$
\end{document}

• Thank you man, exactly what i want May 28, 2019 at 15:19

I guessing that you like text in square brackets related to above equation. For this people usual use something like this:

\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{newtxtext,newtxmath} % optional
\usepackage{ragged2e}
\usepackage{array}
\usepackage{stackengine}
\stackMath
\newcommand{\underlabel}[3][9em]{\stackunder{#2}
{\overbrace{\scriptsize
\begin{tabular}{@{}>{\Centering}p{#1}@{}}#3\end{tabular}}_{}}%
}
\newcommand{\mystrut}{\vphantom{\partial_{yy}}}

\begin{document}
$$\underlabel{\partial_t C\mystrut}{Time rate of change of concentration of chemical component} \ + \ \underlabel{\partial_x u C + \partial_x v C\mystrut}{Term of advection of chemical component} \ = \ \underlabel[11em]{D_x \partial_{xx} C + D_y \partial_{yy} C}{Change in component due to diffusion} \ + \ \underlabel[11em]{R(C)\mystrut}{\tabcolsep=3pt \begin{tabular}{@{}m{5em} c m{5em} @{}} Rate of formation of component &-& Rate of consumption of component \end{tabular}}$$
\end{document}


• Excellent too, thank you so much May 28, 2019 at 15:20