\begin{cases} 的间距问题

\begin{cases} 的间距问题

在我的 MWE 中,我想调整每个 实例之前的间距\begin{cases}。大花括号似乎卡在了上一行。我该如何调整呢?我的源代码:

    % arara: xelatex: { shell: true }
    \documentclass{article}
    \usepackage{caption}
    \usepackage{amsmath}
    \usepackage{amsthm}
    \usepackage{amssymb}
    \usepackage[ruled]{algorithm2e}
    
    \DeclareMathOperator{\op}{op}
    \DeclareMathOperator{\trig}{trig}
    \DeclareMathOperator{\atan}{atan}
    \DeclareMathOperator{\abs}{abs}
    \DeclareMathOperator{\acos}{acos}
    \DeclareMathOperator{\acosh}{acosh}
    \DeclareMathOperator{\asin}{asin}
    \DeclareMathOperator{\asinh}{asinh}
    \DeclareMathOperator{\atanh}{atanh}
    \DeclareMathOperator{\cabs}{cabs}
    \DeclareMathOperator{\cotan}{cotan}
    \DeclareMathOperator{\cotanh}{cotanh}
    \DeclareMathOperator{\recip}{crecip}
    \DeclareMathOperator{\sqr}{sqr}
    
    %______________________________________________________________________________
    \begin{document}
    \setcounter{algocf}{21}
    \begin{algorithm}[H]
    \caption{Calculate the M--Set for point `$c$' (\textbf{Algorithm 2} Expanded Again)}
    \DontPrintSemicolon
    $c \leftarrow \text{a point on the complex plane}$\;
    $z_0 \leftarrow (0,0i)$\;
    \While{$|z_{n}| \leq 2$} {
      $zf_{n+1} = z_{n}^{10-z_{n}} + z_{n} + c$\;
      $z_{n+1} = (1+\sin(zf_{n+1}))^{2} + c$\;
      \If{inverse} {
        $z_{n+1} = \frac{1}{z_{n+1}}$
      }
      \If{const} {
        $z_{n+1} = \op ( z_{n+1}, C ), \text{where}\ \op =
        \text{any one of:}
        \begin{cases}
          z_{n+1} = z_{n+1} * C\\
          z_{n+1} = \frac{C}{z_{n+1}}\\
          z_{n+1} = z_{n+1} + C\\
          z_{n+1} = C - z_{n+1}\\
          z_{n+1} = \frac{z_{n+1}}{C}\\
          z_{n+1} = z_{n+1} - C\\
          z_{n+1} = z_{n+1}^2 + C\\
          z_{n+1} = z_{n+1}^2 - C
        \end{cases}$
      }
      \If{fof} {
        $z_{n+1} = \trig z_{n+1}, \text{where}\ \trig =
        \text{any one of:}
        \begin{cases}
          \sin, \atan, \abs, \acos, \acosh,\\
          \asin, \asinh, \atan2, \atanh, \cabs,\\
          \cos, \cosh, \cotan, \cotanh, \exp,\\
          \log, \recip, \sinh, \sqr, \text{sqrt},\\
          \tan, \tanh
        \end{cases}$
      }
    }
    \end{algorithm}
    \end{document}

答案1

C

dcases可以考虑的一个替代方案:使用包中的环境mathtools

% !TeX TS-program = xelatex

\documentclass{article}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage[ruled]{algorithm2e}

\usepackage{mathtools} % added

\DeclareMathOperator{\op}{op}
\DeclareMathOperator{\trig}{trig}
\DeclareMathOperator{\atan}{atan}
\DeclareMathOperator{\abs}{abs}
\DeclareMathOperator{\acos}{acos}
\DeclareMathOperator{\acosh}{acosh}
\DeclareMathOperator{\asin}{asin}
\DeclareMathOperator{\asinh}{asinh}
\DeclareMathOperator{\atanh}{atanh}
\DeclareMathOperator{\cabs}{cabs}
\DeclareMathOperator{\cotan}{cotan}
\DeclareMathOperator{\cotanh}{cotanh}
\DeclareMathOperator{\recip}{crecip}
\DeclareMathOperator{\sqr}{sqr}

%______________________________________________________________________________
\begin{document}
    \setcounter{algocf}{21}
    \begin{algorithm}[H]
        \caption{Calculate the M--Set for point `$c$' (\textbf{Algorithm 2} Expanded Again)}
        \DontPrintSemicolon
        $c \leftarrow \text{a point on the complex plane}$\;
        $z_0 \leftarrow (0,0i)$\;
        \While{$|z_{n}| \leq 2$} {
            $zf_{n+1} = z_{n}^{10-z_{n}} + z_{n} + c$\;
            $z_{n+1} = (1+\sin(zf_{n+1}))^{2} + c$\;
            \If{inverse} {%
                $z_{n+1} = \frac{1}{z_{n+1}}$
            }
            \If{const}{%
                $z_{n+1} = \op ( z_{n+1}, C ), \text{where}\ \op = \text{any one of:}               
                \begin{dcases}
                    z_{n+1} = z_{n+1} * C\\
                    z_{n+1} = \frac{C}{z_{n+1}}\\
                    z_{n+1} = z_{n+1} + C\\
                    z_{n+1} = C - z_{n+1}\\
                    z_{n+1} = \frac{z_{n+1}}{C}\\
                    z_{n+1} = z_{n+1} - C\\
                    z_{n+1} = z_{n+1}^2 + C\\
                    z_{n+1} = z_{n+1}^2 - C
                \end{dcases}$
            }
            \If{fof}{%
                $z_{n+1} = \trig z_{n+1}, \text{where}\ \trig = \text{any one of:}              
                \begin{dcases}
                 \sin, \atan, \\ \abs, \acos, \acosh,\\
                \asin, \asinh,\\ \atan2, \atanh, \cabs,\\
                \cos, \cosh, \cotan, \\ \cotanh,\\ \exp,\\
                \log, \recip, \\ \sinh, \sqr, \text{sqrt},\\
                \tan, \tanh
                \end{dcases}$
            }       
        }
    \end{algorithm}
\end{document}

相关内容