1

I want to have text as above an equation with arrows as pointer. I get this to working but not as pretty. There is a lot of wasted space. Here is what I got enter image description here

The vertical space between the lines is too much. If I try to reduce the the arrows merge in next line.

Here is how I want enter image description here

\documentclass{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\begin{document}
  \begin{equation*}
   \begin{array}{ccc}
    \text{partial derivative} & &\text{partial derivative} \\
    \text{w.r.t } x & & \text{w.r.t } t \\        
    \downarrow & & \downarrow \\
    \pd{f}{x} & & \pd{f}{t}
   \end{array} 
  \end{equation*}







\end{document}
Kumarm
  • 942

3 Answers3

1

With tikz-cd:

enter image description here

\documentclass[11pt,a4paper]{report}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[row sep=2em]
\begin{array}{c}
\text{word or phrase} \\
\text{word or phrase}
\end{array} \arrow[d] & \text{word or phrase} \arrow[d] \\ 
\dfrac{\partial f}{\partial x} & \dfrac{\partial f}{\partial t}
\end{tikzcd}
\]
\end{document}

enter image description here

Edit: another two options, changing the aligment of the arrays.

enter image description here

\documentclass[11pt,a4paper]{report}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}
\[
\begin{tikzcd}[row sep=2em]
\begin{array}[t]{c}         % <--- [t]
\text{word or phrase} \\
\text{word or phrase}
\end{array} \arrow[d] & \text{word or phrase} \arrow[d] \\ 
\dfrac{\partial f}{\partial x} & \dfrac{\partial f}{\partial t}
\end{tikzcd}
\]

\medskip

\[
\begin{tikzcd}[row sep=2em]
\begin{array}[b]{c}          % <--- [b]
\text{word or phrase} \\
\text{word or phrase}
\end{array} \arrow[d] & \text{word or phrase} \arrow[d] \\ 
\dfrac{\partial f}{\partial x} & \dfrac{\partial f}{\partial t}
\end{tikzcd}
\]
\end{document}
Sigur
  • 37,330
1

A simple solution with stackengine:

\documentclass{article}
\usepackage{amsmath, amssymb, amsthm}
\newcommand{\pd}[2]{\dfrac{\partial#1}{\partial#2}}
\usepackage[usestackEOL]{stackengine}

\begin{document}

’Twas brillig, and the slithy toves did gyre and gimble in the wabe; all mimsy were the borogoves, and the mome raths outgrabe.

\begin{equation*}
\stackMath \Shortstack{\text{partial derivative} \\ \text{w.r.t }x\\\downarrow \\\\\pd{f}{x}} \qquad
\Shortstack{\text{partial derivative} \\ \text{w.r.t }t\\\downarrow\\\\\pd{f}{t}}
  \end{equation*}

\end{document} 

enter image description here

Bernard
  • 271,350
1

You could with a little creativity create a lot of codes for what you ask for. I suggest these two, one of which uses a beautiful macro of the best user @egreg that you can see in this link: How to elongate down arrow?. This type of macro is useful to increase the length of the vertical arrow.

First proposal using xy package

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage[all]{xy}
\usepackage{amsmath,amssymb}
\usepackage{newtxtext,newtxmath}
\begin{document}
\xymatrix@R=3pc@C=3pc{
*\txt{partial derivative\\w.r.t\,\textit{x}} \ar[d]  & *\txt{partial derivative\\w.r.t\,\textit{t}} \ar[d] \\
\dfrac{\partial f}{\partial x}  & \dfrac{\partial f}{\partial t}}
\end{document}

Second proposal using some packages

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage[all]{xy}
\usepackage{amsmath,amssymb}
\usepackage{relsize}
\usepackage{newtxtext,newtxmath}
\newcommand{\xdownarrow}[1]{%
  {\left\downarrow\vbox to #1{}\right.\kern-\nulldelimiterspace}
}

\begin{document}

\[\underset{\mkern70mu\text{and}\mkern10mu\dfrac{\partial f}{\partial x}+ \dfrac{\partial f}{\partial t}\mathlarger{=3x+2y}}{\underset{\begin{matrix}
\xdownarrow{.5cm}&\xdownarrow{.5cm}\end{matrix}}{\substack{\text{an ODE can contain more}\\ \text{than one dependent variable}}}}
\]

\end{document}

After newtxtext and newtxmath are clones of mathematical and textual fonts from Times New Roman.

Sebastiano
  • 54,118