![括号内不需要的空格](https://linux22.com/image/321639/%E6%8B%AC%E5%8F%B7%E5%86%85%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E7%A9%BA%E6%A0%BC.png)
我正在尝试写一个等式,我使用左右来调整括号。不幸的是,括号顶部的空白太多了。
有没有什么办法可以减少空白?
我的等式是:
$$ a_n=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\left[\frac{1}{4}\cos(3x)+\frac{3}{4}\cos(x)\right]\cos(nx)\text{d}x=\frac{1}{4}\left[\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(3x)\cos(nx)\text{d}x}_{\text{By lemma: }=\begin{cases}0,& \ n\ne 3 \\ 1,& n=3 \end{cases}}+3\cdot{\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(x)\cos(nx)\text{d}x}_{\text{By lemma: }=\begin{cases}0,& n \ne 1 \\ 1,& n=1 \end{cases}}}\right]$$
请帮忙,谢谢!
答案1
一种可能性是添加\vcenter{\hbox{$\displaystyle $}}
:
$$ a_n=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\left[\frac{1}{4}\cos(3x)+\frac{3}{4}\cos(x)\right]\cos(nx)\text{d}x=%
\frac{1}{4}\left[\vcenter{\hbox{$\displaystyle\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(3x)\cos(nx)\text{d}x}_{\text{By lemma: }=%
\begin{cases}0,& \ n\ne 3 \\ 1,& n=3 \end{cases}}+3\cdot{\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(x)\cos(nx)\text{d}x}_{\text{By lemma: }=\begin{cases}0,& n \ne 1 \\ 1,& n=1 \end{cases}}}$}}\right]$$
也许这不是一个很好的答案,但我发现它在我需要时就起作用。
答案2
也许这样看起来更好,也许可以分成两行。
\documentclass{article}
\usepackage{amsmath}
\newcommand*{\myd}{\mathrm{d}}
\begin{document}
\[
a_n =\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\biggl[\frac{1}{4}\cos(3x)+\frac{3}{4}\cos(x)\biggr]
\cos(nx)\myd x
=\frac{1}{4}\Biggl[\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(3x)\cos(nx)\myd x}_{\text{By lemma: }=\begin{cases}0,& n\ne 3 \\ 1,& n=3 \end{cases}}+3\cdot{\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(x)\cos(nx)\myd x}_{\text{By lemma: }=\begin{cases}0,& n \ne 1 \\ 1,& n=1 \end{cases}}}\Biggr]
\]
%
\[ \begin{aligned}
a_n &=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\biggl[\frac{1}{4}\cos(3x)+\frac{3}{4}\cos(x)\biggr]
\cos(nx)\myd x \\
&=\frac{1}{4}\Biggl[\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(3x)\cos(nx)\myd x}_{\text{By lemma: }=\begin{cases}0,& n\ne 3 \\ 1,& n=3 \end{cases}}+3\cdot{\underbrace{\frac{1}{\pi}\int\limits_{-\pi}^{\pi}\cos(x)\cos(nx)\myd x}_{\text{By lemma: }=\begin{cases}0,& n \ne 1 \\ 1,& n=1 \end{cases}}}\Biggr]
\end{aligned}
\]
\end{document}
注意使用
\Biggl
etc fromamsmath
而不是 dynamic \left
and \right
。另外d
indx
应该是\mathrm
not \text
。