嵌套对齐中的对齐

嵌套对齐中的对齐

如何在嵌套对齐中对齐方程式?

\documentclass{article}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{flexisym}

\begin{document}

\begin{equation*}
    CT_i = \left\{\begin {aligned}
        &CT_{i1} = \tau \\
        &CT_{i2} = H(M).e(g, g)^{s\alpha} \\
        &CT_{i3} = h^s \\
        &CT_{i4} = H(M)^{t.H_1(ID_{Ui})} \\
        &CT_{i5} = H(M)^{t.H_1(ID_{ESP_i})} \\
        &\left.\begin{aligned}
            &CT_{i6} = g^{q_y(0)} \\
            &CT_{i7} = H(attr(y))^{q_y(0)}
        \end{aligned}\right\}\forall j \in   \mathbb{A}_{Ui}
    \end{aligned}\right.
\end{equation*}

\end{document}

在这种情况下,最后两行没有与其余行对齐(在 C 处对齐,= g/h)。

请帮忙。提前致谢。

答案1

使用包中的 cases和环境。没有任何与符号:rcasesmathtools

\documentclass{article}
\usepackage{mathtools,% for rcases, also load amsmath
            amssymb}  % amsfonts is loaded by amssymb
%\usepackage{flexisym}% not needed in this MWE

\begin{document}
\[
CT_i = \begin{cases}
    CT_{i1} = \tau \\
    CT_{i2} = H(M).e(g, g)^{s\alpha} \\
    CT_{i3} = h^s \\
    CT_{i4} = H(M)^{t.H_1(ID_{Ui})} \\
    CT_{i5} = H(M)^{t.H_1(ID_{ESP_i})} \\
\kern-\nulldelimiterspace\begin{rcases}
    CT_{i6}  = g^{q_y(0)} \\
    CT_{i7}  = H(attr(y))^{q_y(0)}
\end{rcases}\forall j \in   \mathbb{A}_{Ui}
        \end{cases}
\]
\end{document}

在此处输入图片描述

您的方程式中的点的含义不清楚,因此在上面的 MWE 中,我保留了它们的原样。您可能更喜欢使用 `\cdot˙:

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools,% for rcases, also load amsmath
            amssymb}  % amsfonts is loaded by amssymb
%\usepackage{flexisym}% not needed in this MWE

\begin{document}
\[
CT_i = \begin{cases}
    CT_{i1} = \tau \\
    CT_{i2} = H(M)\cdot e(g, g)^{s\alpha} \\
    CT_{i3} = h^s \\
    CT_{i4} = H(M)^{t\cdot H_1(ID_{U_i})} \\
    CT_{i5} = H(M)^{t\cdot H_1(ID_{\mathrm{ESP}_i})} \\
\kern-\nulldelimiterspace
\begin{rcases}
    CT_{i6}  = g^{q_y(0)} \\
    CT_{i7}  = H\bigl(\mathrm{attr}(y)\bigr)^{q_y(0)}
\end{rcases}\forall j \in   \mathbb{A}_{Ui}
        \end{cases}
\]
\end{document}

相关内容