如何把公式写在左边而把括号写在右边?

如何把公式写在左边而把括号写在右边?

我期待在我的 Latex 文档中重现以下内容:

在此处输入图片描述

您推荐使用什么来实现这一点?

答案1

从屏幕截图中输入公式其实并不困难,但并不是一件令人愉快的事情。剩下的就是重复。

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathrsfs}
\DeclareMathOperator{\tr}{tr}
\newcommand\RBrace[1]{&&\left\{\begin{tabular}{@{}l@{}}#1
\end{tabular}\right.}
\begin{document}
\begin{equation}
\begin{aligned}
 \mathscr{L}=&{}-\frac{1}{2}\tr(W_{\mu\nu}W^{\mu\nu})
 -\frac{1}{4}B_{\mu\nu}B^{\mu\nu}
 \RBrace{$W$, $Z$, $\gamma$ kinetic\\ energies and\\ self-interactions}\\
 &{}\begin{aligned}
 & +\overline{L}\left(\mathrm{i}\,\partial_\mu-g\tau_iW_i-g'\frac{Y}{2}B_\mu\right)L \\
 &+\overline{R}\left(\mathrm{i}\,\partial_\mu-g'\frac{Y}{2}B_\mu\right)R
 \end{aligned}
 \RBrace{lepton and quark\\ kinetic energies\\ and their\\ interactions
 with\\ $W$, $Z$, $\gamma$}\\
\end{aligned}
\end{equation}
\end{document}

在此处输入图片描述

答案2

如果您有多个这样的描述,则语法会更加方便。

\documentclass{article}
\usepackage{showframe}% remove from the production version
\usepackage{amsmath,bm}
\usepackage{varwidth,ragged2e}
%\usepackage{xparse} % uncomment if using LaTeX release prior to 2020-10-01

\numberwithin{equation}{section}

\newcommand{\BWpm}{\ensuremath{\mathrm{W}^{\pm}}}
\newcommand{\BZ}{\ensuremath{\mathrm{Z}}}
\newcommand{\photon}{\ensuremath{\gamma}}

\ExplSyntaxOn
\NewDocumentEnvironment{aligndesc}{O{4em}b}
 {
  \ricardo_aligndesc:nn { #1 } { #2 }
 }{}

\box_new:N \l__ricardo_aligndesc_left_box
\dim_new:N \l__ricardo_aligndesc_wd_dim

\cs_new_protected:Nn \ricardo_aligndesc:nn
 {
  \hbox_set:Nn \l__ricardo_aligndesc_left_box
   {
    \cs_set_eq:NN \desc \use_none:n
    $\begin{aligned} #2 \end{aligned}$
   }
  \dim_set:Nn \l__ricardo_aligndesc_wd_dim
   { \displaywidth - \box_wd:N \l__ricardo_aligndesc_left_box - #1 - 3em}
  \cs_set_eq:NN \desc \__ricardo_aligndesc_desc:n
  \begin{alignedat}{2} #2 \end{alignedat}
 }

\cs_new_protected:Nn \__ricardo_aligndesc_desc:n
 {
  & \quad &
    \left\{
    \begin{varwidth}{\l__ricardo_aligndesc_wd_dim}
    \RaggedRight #1
    \end{varwidth}
    \right.\kern-\nulldelimiterspace
 }

\ExplSyntaxOff

\begin{document}
\setcounter{section}{11}
\section{Test}
\setcounter{equation}{9}

\begin{equation}
\begin{aligndesc}
\mathcal{L} &=
  -\frac{1}{4}\mathbf{W}_{\mu\nu}\cdot\mathbf{W}^{\mu\nu}
  -\frac{1}{4}B_{\mu\nu}B^{\mu\nu}
  \desc{\BWpm, \BZ, \photon{} kinetic energies and self-interactions}
\\
&\quad\begin{aligned}
   &+\bar{L}\gamma^\mu
   \Bigl(
     i\partial_\mu-g\frac{1}{2}\tau\cdot\mathbf{W}_\mu-g'\frac{Y}{2}B_\mu
   \Bigr)L
   \\
   &+\bar{R}\gamma^\mu\Bigl(i\partial_\mu-g'\frac{Y}{2}B_\mu\Bigr)R
 \end{aligned}
 \desc{lepton and quark kinetic energies and their interactions with
       \BWpm, \BZ, \photon}
\\
&\quad+\Bigl|
 \Bigr(
   i\partial_\mu-g\frac{1}{2}\tau\cdot\mathbf{W}_\mu-g'\frac{Y}{2}B_\mu
 \Bigr)
 \phi\Bigr|^2 - V(\phi)
 \desc{\BWpm, \BZ, \photon, and Higgs masses and couplings}
\\
&\quad-(G_1\bar{L}\phi R+G_2\bar{L}\phi_c R+\text{hermitian conjugate})
 \desc{lepton and quark masses and coupling to Higgs}
\end{aligndesc}
\end{equation}

\end{document}

首先测量环境的内容,而不考虑描述。宽度用于设置描述的宽度;无论如何,方程式和描述之间都会有两个四边形。

在此处输入图片描述

\begin{aligndesc*}[3em]会得到

在此处输入图片描述

可选参数是对描述部分的一种“缩减”。该值越高,为描述保留的空间就越小。

相关内容