我想要像方程式上方那样的文本,并以箭头作为指针。我让这个工作正常,但不太美观。浪费了很多空间。这是我得到的
行与行之间的垂直间距太大。如果我尝试减少间距,箭头就会合并到下一行。
\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}
答案1
和tikz-cd
:
\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}
编辑:另外两个选项,改变数组的对齐。
\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}
答案2
一个简单的解决方案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}
答案3
只要稍加创意,您就可以创建很多代码来满足您的要求。我建议使用这两个,其中一个使用了最佳用户@egreg 的精美宏,您可以在此链接中看到:如何拉长向下的箭头?。这种类型的宏对于增加垂直箭头的长度很有用。
xy
使用包的第一个提案
\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}
第二个建议使用一些包
\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}
之后newtxtext
和newtxmath
是 Times New Roman 的数学和文本字体的克隆。