我很难用这个长方程式制作一个框,同时在其中输入一个数字。我只想删除文本行前方程式下方的空白处。方程式是这样的
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tensor}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{scalerel}%scale things
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=2.5cm, % Inner margin
outer=3.7cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
% showframe, % Uncomment to show how the type block is set on the page
}
\usepackage{empheq}%Boxes in Align
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\newcommand{\T}[2]{\tensor{#1}{#2}}%fortensors
\newcommand{\Te}[3]{\tensor*{#1}{^{\scaleto{(#2)}{6pt}}#3}}
\newcommand{\h}[2]{\tensor*{h}{^{\scaleto{(#1)}{6pt}}#2}}
\begin{document}
\begin{empheq}[box=\fbox]{align}
\Te{G\left[\h{1}{_a_b}\right]}{2}{_a_b}&=\frac{1}{2}\left\lbrace\h{1}{^c^d}\left[\tensor{\tilde{\nabla}}{_a}\tensor{\tilde{\nabla}}{_b}\h{1}{_c_d}+\tensor{\tilde{\nabla}}{_c}\tensor{\tilde{\nabla}}{_d}\h{1}{_a_b}-2\tensor{\tilde{\nabla}}{_c}\tensor{\tilde{\nabla}}{_(_a}\h{1}{_b_)_d}\right]\right.\\
&\qquad+\left[\frac{1}{2}\tensor{\tilde{\nabla}}{_a}\h{1}{^c^d}\tensor{\tilde{\nabla}}{_b}\h{1}{_c_d}\right.+\left(\frac{1}{2}\tensor{\tilde{\nabla}}{^c}\h{1}{}-\tensor{\tilde{\nabla}}{_d}\h{1}{^c^d}\right)\left(2\tensor{\tilde{\nabla}}{_(_a}\h{1}{_b_)_c}-\tensor{\tilde{\nabla}}{_c}\h{1}{_a_b}\right)\notag\\
&\qquad\left.\left.+\tensor{\tilde{\nabla}}{_c}\h{1}{_b_d}\left(\tensor{\tilde{\nabla}}{^c}\h{1}{_a^d}-\tensor{\tilde{\nabla}}{^d}\h{1}{_a^c}\right)
\right]\right\rbrace\notag\\
&\quad -\frac{1}{4}\T{\tilde{g}}{_a_b}\left\lbrace\T{\tilde{\nabla}}{^c}\h{1}{_c_d}\T{\tilde{\nabla}}{^d}\h{1}{}-\T{\tilde{\nabla}}{_c}\h{1}{_d_f}\T{\tilde{\nabla}}{^f}\h{1}{^c^d}+\frac{3}{2}\T{\tilde{\nabla}}{^c}\h{1}{^d^f}\T{\tilde{\nabla}}{_c}\h{1}{_d_f}-\frac{1}{2}\T{\tilde{\nabla}}{^c}\h{1}{}\T{\tilde{\nabla}}{_c}\h{1}{}\right.\notag\\
& \qquad\qquad\left.-2\T{\tilde{\nabla}}{_c}\h{1}{^c^d}\T{\tilde{\nabla}}{^f}\h{1}{_d_f}+\h{1}{^c^d}\left[\T{\tilde{\nabla}}{^f}\T{\tilde{\nabla}}{_f}\h{1}{_c_d}+\T{\tilde{\nabla}}{_c}\T{\tilde{\nabla}}{_d}\h{1}{}-2\T{\tilde{\nabla}}{_c}\T{\tilde{\nabla}}{^f}\h{1}{_f_d}\right]\right\rbrace.\notag
\end{empheq}
\lipsum
\end{document}
答案1
我会重新组织方程式,使每行变得更短一些。在此我将使用\MoveEqLeft
包中的宏mathtools
:
\documentclass{article}
\usepackage{tensor}
\usepackage{mathtools}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{scalerel}%scale things
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=2.5cm, % Inner margin
outer=3.7cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
showframe, % Uncomment to show how the type block is set on the page
}
\usepackage{empheq}%Boxes in Align
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\newcommand{\T}[2]{\tensor{#1}{#2}}%fortensors
\newcommand{\Te}[3]{\tensor*{#1}{^{\scaleto{(#2)}{6pt}}#3}}
\newcommand{\h}[2]{\tensor*{h}{^{\scaleto{(#1)}{6pt}}#2}}
\begin{document}
\begin{empheq}[box=\fbox]{align}
\MoveEqLeft
\Te{G\Bigl[\h{1}{_a_b}\Bigr]}{2}{_a_b} =
\frac{1}{2}\Bigl\lbrace\h{1}{^c^d}
\Bigl[\tensor{\tilde{\nabla}}{_a}
\tensor{\tilde{\nabla}}{_b}\h{1}{_c_d} +
\tensor{\tilde{\nabla}}{_c}
\tensor{\tilde{\nabla}}{_d}\h{1}{_a_b} - 2\tensor{\tilde{\nabla}}{_c}
\tensor{\tilde{\nabla}}{_(_a}\h{1}{_b_)_d}\Bigr] \notag \\
& + \Bigl[\frac{1}{2}
\tensor{\tilde{\nabla}}{_a}\h{1}{^c^d}
\tensor{\tilde{\nabla}}{_b}\h{1}{_c_d} +
\Bigl(\frac{1}{2}\tensor{\tilde{\nabla}}{^c}\h{1}{} -
\tensor{\tilde{\nabla}}{_d}\h{1}{^c^d}\Bigr)
\Bigl(2\tensor{\tilde{\nabla}}{_(_a}\h{1}{_b_)_c} -
\tensor{\tilde{\nabla}}{_c}\h{1}{_a_b}\Bigr) \notag \\
& + \tensor{\tilde{\nabla}}{_c}\h{1}{_b_d}
\Bigl(\tensor{\tilde{\nabla}}{^c}\h{1}{_a^d} -
\tensor{\tilde{\nabla}}{^d}\h{1}{_a^c}\Bigr)\Bigr]\Bigr\rbrace \\
& - \frac{1}{4}\T{\tilde{g}}{_a_b}
\Bigl\lbrace\T{\tilde{\nabla}}{^c}\h{1}{_c_d}\T{\tilde{\nabla}}{^d}\h{1}{}-
\T{\tilde{\nabla}}{_c}\h{1}{_d_f}\T{\tilde{\nabla}}{^f}\h{1}{^c^d}+
\frac{3}{2}\T{\tilde{\nabla}}{^c}\h{1}{^d^f}\T{\tilde{\nabla}}{_c}\h{1}{_d_f}-
\frac{1}{2}\T{\tilde{\nabla}}{^c}\h{1}{}\T{\tilde{\nabla}}{_c}\h{1}{} \notag \\
& - 2\T{\tilde{\nabla}}{_c}\h{1}{^c^d}\T{\tilde{\nabla}}{^f}\h{1}{_d_f} +
\h{1}{^c^d}
\Bigl[\T{\tilde{\nabla}}{^f}\T{\tilde{\nabla}}{_f}\h{1}{_c_d} +
\T{\tilde{\nabla}}{_c}\T{\tilde{\nabla}}{_d}\h{1}{} -
2\T{\tilde{\nabla}}{_c}\T{\tilde{\nabla}}{^f}\h{1}{_f_d}\Bigr]\Bigr\rbrace. \notag
\end{empheq}
\lipsum[11]
\end{document}
答案2
像这样:
\begin{empheq}[box=\fbox]{align*}%use an asterix after align
...
\end{empheq}
\begin{equation}%used to create a tag below the box
\end{equation}
\lipsum
解决这个问题的另一种方法是以某种方式减少公式的宽度,以便公式及其标签可以适合 \textwidth。
答案3
正如@egreg在评论中指出的那样,问题是由于需要添加方程编号。要解决这个问题,只需按照@NuncTorUs的建议在行中使用align*
而不是。答案中没有明确说明这一点,因此我写了这个。align
\begin{empheq}[box=\fbox]{align}