如何在对齐环境中将花括号放置在几行的右侧?

如何在对齐环境中将花括号放置在几行的右侧?
\documentclass[a4paper]{article}
\usepackage{derivative}
\begin{document}

\begin{align*}
    \{q_a,q_b\} &= 0 = \{p_a,p_b\} \\
    \{q_a,p_b\} &= \delta_{ab} \\
    \{q_a,F\} &= \pdv{F}{q_a}\\
    \{p_a,F\} &= -\pdv{F}{p_a}
\end{align*}

\end{document}

我想在前两行右侧添加一个花括号: 结构

我尝试使用该mathtools包:

\documentclass[a4paper]{article}
\usepackage{derivative}
\usepackage{mathtools}
\begin{document}

\begin{align*}
    \negthickspace
    \begin{rcases}
        \{q_a,q_b\} &= 0 = \{p_a,p_b\} \\
        \{q_a,p_b\} &= \delta_{ab}
    \end{rcases} \\
    \{q_a,F\} &= \pdv{F}{q_a}\\
    \{p_a,F\} &= -\pdv{F}{p_a}
\end{align*}

\end{document}

但对齐就被搞乱了

我怎样才能实现这一点,也许没有环境rcases

答案1

您可以定位一个大}同时隐藏对齐:

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage{mathtools,derivative}
\begin{document}

\begin{align*}
    \{q_a,q_b\} &= 0 = \{p_a,p_b\} 
\quad\smash{\raisebox{-10pt}{$\mathrlap{\Biggr\}}$}}\\
    \{q_a,p_b\} &= \delta_{ab} \\[2pt]
    \{q_a,F\} &= \pdv{F}{q_a}\\
    \{p_a,F\} &= -\pdv{F}{p_a}
\end{align*}

\end{document}

答案2

您可以使用nicematrix

\documentclass[a4paper]{article}
\usepackage{derivative}
\usepackage{nicematrix}

\begin{document}

\begin{equation*}
\setlength{\arraycolsep}{0pt}
\renewcommand{\arraystretch}{1.5}
\begin{NiceArray}{r >{{}}c<{{}} >{\displaystyle}l}
  \{q_a,q_b\} &=& 0 = \{p_a,p_b\} \\
  \{q_a,p_b\} &=& \delta_{ab} \\[1ex]
  \{q_a,F\}   &=& \pdv{F}{q_a}\\[2ex]
  \{p_a,F\}   &=& -\pdv{F}{p_a}
\CodeAfter\SubMatrix.{1-3}{2-3}\}
\end{NiceArray}
\end{equation*}

\end{document}

在此处输入图片描述

答案3

带有 tikzmark 和书法

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{derivative}
\usepackage{tikz}
\usetikzlibrary{decorations,calligraphy,tikzmark}
\begin{document}
\begin{align*}
    \{q_a,q_b\} &= 0 = \tikzmarknode{ne}{\{p_a,p_b\}} \\
    \{q_a,p_b\} &= \tikzmarknode{se}{\delta_{ab}} \\
    \{q_a,F\} &= \pdv{F}{q_a}\\
    \{p_a,F\} &= -\pdv{F}{p_a}
\end{align*}
\begin{tikzpicture}[remember picture,overlay]
\draw[decorate, decoration={calligraphic brace, amplitude=4pt, raise=4pt}, thick]
([yshift=2pt]ne.north east) -- ([yshift=-2pt]ne.north east |- se.south east);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容