并排等式不适合页面

并排等式不适合页面

我想写一个具有两个等价形式的方程,所以我想将它们并排写出。因此,我使用以下方法进行操作

  \[
  \begin{aligned}
   (X',Y',Z')=\begin{cases}
   \left(X,2Y,\dfrac{Z}{2}\right), & \mbox{if } ~0\leq X<\dfrac{1}{2}, ~0\leq Y<\dfrac{1}{2} \\
   \left(2X,2Y-1,\dfrac{Z}{2}+\dfrac{1}{2}\right), & \mbox{if } ~0\leq X<\dfrac{1}{2}, ~\dfrac{1}{2}\leq Y<1\\
   \left(X-1,2Y,\dfrac{Z}{2}+\dfrac{1}{4}\right), & \mbox{if } ~\dfrac{1}{2}\leq X<1, ~0\leq Y<\dfrac{1}{2}\\
    \left(2X-1,2Y-1,\dfrac{Z}{2}+\dfrac{3}{4}\right), & \mbox{if } ~\dfrac{1}{2}\leq X<1, ~\dfrac{1}{2}\leq Y<1\\
    \end{cases}
    \end{aligned}
  \implies
 \begin{aligned}
  X'=\begin{cases}
  \text{mod}(2X,N), & \mbox{if }~Z+1\equiv (3\vee 1)\text{mod}~4\\
  \text{mod}(2X,N)+1, & \mbox{if }~Z+1\equiv (2\vee 0)\text{mod}4\\
      \end{cases}\\
 Y'=\begin{cases}
  \text{mod}(2Y,N), & \mbox{if }~Z+1\equiv (2\vee 1)\text{mod}4\\
  \text{mod}(2Y,N)+1, & \mbox{if }~Z+1\equiv (3\vee 0)\text{mod}4\\
  \end{cases}\\
  Z'=\begin{cases}
  \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor,~~~~~~~~~~~~~,& \mbox{if}~0\leq X<\dfrac{N}{2}-1~\text{and}~ 0\leq Y<\dfrac{N}{2}-1  \\
  \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor+\dfrac{2N}{4},& \mbox{if}~0\leq X<\dfrac{N}{2}-1~\text{and}~\dfrac{N}{2}-1<Y  \\
  \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor+\dfrac{N}{4}, & \mbox{if}~\dfrac{N}{2}+1<X~\text{and}~ 0\leq Y<\dfrac{N}{2}-1  \\
  \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor+\dfrac{3N}{4},& \mbox{if}~\dfrac{N}{2}-1<X~\text{and}~ \dfrac{N}{2}-1<Y \\
     \end{cases}
         \end{aligned}
    \]

它给出输出

在此处输入图片描述

但如您所见,它没有正确对齐,不适合页面,应该如何解决?有人可以解决这个问题吗?

答案1

我看不出有什么办法可以将这两个大块并排放置。为什么不将一个块放在另一个块的上方呢?

\documentclass{article}
\usepackage{amsmath,mathtools}

\usepackage{showframe}

\DeclareMathOperator{\omod}{mod}

\begin{document}

\begingroup
\setlength{\multlinegap}{0pt}
\begin{multline*}
(X',Y',Z')=
\begin{dcases}
  \left(X,2Y,\frac{Z}{2}\right),
    & \text{if } 0\leq X<\frac{1}{2},\ 0\leq Y<\frac{1}{2} \\
  \left(2X,2Y-1,\frac{Z}{2}+\frac{1}{2}\right),
    & \text{if } 0\leq X<\frac{1}{2},\ \frac{1}{2}\leq Y<1 \\
  \left(X-1,2Y,\frac{Z}{2}+\frac{1}{4}\right),
    & \text{if } \frac{1}{2}\leq X<1,\ 0\leq Y<\frac{1}{2} \\
  \left(2X-1,2Y-1,\frac{Z}{2}+\frac{3}{4}\right),
    & \text{if } \frac{1}{2}\leq X<1,\ \frac{1}{2}\leq Y<1\\
\end{dcases}
\\
\implies\left\{
  \begin{aligned}
    X'&=
    \begin{dcases}
      \omod(2X,N),   & \text{if } Z+1\equiv (3\vee 1)\pmod{4}\\
      \omod(2X,N)+1, & \text{if } Z+1\equiv (2\vee 0)\pmod{4}\\
    \end{dcases}
  \\
    Y'&=
    \begin{dcases}
      \omod(2Y,N),   & \text{if } Z+1\equiv (2\vee 1)\pmod{4}\\
      \omod(2Y,N)+1, & \text{if } Z+1\equiv (3\vee 0)\pmod{4}\\
    \end{dcases}
  \\
    Z'&=
    \begin{dcases}
      \biggl\lfloor\frac{Z}{4}\biggr\rfloor,
        & \text{if } 0\leq X<\frac{N}{2}-1 \text{ and } 0\leq Y<\frac{N}{2}-1  \\
      \biggl\lfloor\frac{Z}{4}\biggr\rfloor+\frac{2N}{4},
        & \text{if } 0\leq X<\frac{N}{2}-1 \text{ and } \frac{N}{2}-1<Y  \\
      \biggl\lfloor\frac{Z}{4}\biggr\rfloor+\frac{N}{4},
        & \text{if } \frac{N}{2}+1<X \text{ and }  0\leq Y<\frac{N}{2}-1  \\
      \biggl\lfloor\frac{Z}{4}\biggr\rfloor+\frac{3N}{4},
        & \text{if } \frac{N}{2}-1<X \text{ and }  \frac{N}{2}-1<Y \\
    \end{dcases}
  \end{aligned}
\right.
\end{multline*}
\endgroup

\end{document}

我在本地将其设置\multlinegap为零,以便用尽所有可用空间。我认为,添加括号可以明确含义。

请注意,这\usepackage{showframe}仅用于显示文本块的边距,请将其从生产版本中删除。

在此处输入图片描述

我也做了一些改变。

  1. 对于 mod 运算符,我定义了一个合适的命令(\text{mod}是错误的)
  2. 对于表示一致性模数的 mod,使用\pmod
  3. \bigg\lfloor并且\bigg\rfloor应该是\biggl\lfloor\biggr\rfloor
  4. 全部~消失了
  5. 不要\dfrac一直使用,最好使用dcases它来处理垂直间距

答案2

由于纵向排列的方程式无法放在一行中,并且难以阅读,因此我建议横向排列。下面我给出了一个输出示例。要修复对齐问题,只需在方程式右侧的&前面添加一个。X',Y',Z'

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{pdflscape}
\usepackage{geometry}


\begin{document}
\newgeometry{margin=1cm}
\begin{landscape}
\[
  \begin{aligned}
       (X',Y',Z')=\begin{cases}
           \left(X,2Y,\dfrac{Z}{2}\right), & \mbox{if } ~0\leq X<\dfrac{1}{2}, ~0\leq Y<\dfrac{1}{2} \\
           \left(2X,2Y-1,\dfrac{Z}{2}+\dfrac{1}{2}\right), & \mbox{if } ~0\leq X<\dfrac{1}{2}, ~\dfrac{1}{2}\leq Y<1\\
           \left(X-1,2Y,\dfrac{Z}{2}+\dfrac{1}{4}\right), & \mbox{if } ~\dfrac{1}{2}\leq X<1, ~0\leq Y<\dfrac{1}{2}\\
            \left(2X-1,2Y-1,\dfrac{Z}{2}+\dfrac{3}{4}\right), & \mbox{if } ~\dfrac{1}{2}\leq X<1, ~\dfrac{1}{2}\leq Y<1\\
        \end{cases}
    \end{aligned}
    \hspace{.5cm}
    \implies
    \hspace{.5cm}
    \begin{aligned}
      & X'=\begin{cases}
        \text{mod}(2X,N), & \mbox{if }~Z+1\equiv (3\vee 1)\text{mod}~4\\
        \text{mod}(2X,N)+1, & \mbox{if }~Z+1\equiv (2\vee 0)\text{mod}4\\
      \end{cases}\\
      & Y'=\begin{cases}
          \text{mod}(2Y,N), & \mbox{if }~Z+1\equiv (2\vee 1)\text{mod}4\\
          \text{mod}(2Y,N)+1, & \mbox{if }~Z+1\equiv (3\vee 0)\text{mod}4\\
      \end{cases}\\
      & Z'=\begin{cases}
          \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor,~~~~~~~~~~~~~,& \mbox{if}~0\leq X<\dfrac{N}{2}-1~\text{and}~ 0\leq Y<\dfrac{N}{2}-1  \\
          \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor+\dfrac{2N}{4},& \mbox{if}~0\leq X<\dfrac{N}{2}-1~\text{and}~\dfrac{N}{2}-1<Y  \\
          \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor+\dfrac{N}{4}, & \mbox{if}~\dfrac{N}{2}+1<X~\text{and}~ 0\leq Y<\dfrac{N}{2}-1  \\
          \bigg\lfloor\dfrac{Z}{4}\bigg\rfloor+\dfrac{3N}{4},& \mbox{if}~\dfrac{N}{2}-1<X~\text{and}~ \dfrac{N}{2}-1<Y \\
      \end{cases}
    \end{aligned}
\]
\end{landscape}
\restoregeometry
\end{document}

所包含代码的输出

答案3

这是一个不使用案例并转换为区间符号的解决方案。请注意X' = ...Y' = ...Z' = ...几乎与 完美对齐(X',Y',Z')

输出

\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}

\newcommand{\range}[3]{\ensuremath{#1 \in \left[#2, ~#3\right)}}% Interval notation [...)
\newcommand{\infRange}[2]{\ensuremath{#1 \in \left(-\infty, ~#2\right)}}% Interval notation (...)
\newcommand{\MOD}[2]{\ensuremath{\text{mod}(#1, #2)}}
\newcommand{\tuple}[3]{\ensuremath{\left(#1, #2, #3\right)\hspace*{-0.75ex},}}% (a, b, c)
\newcommand{\floor}[2]{\ensuremath{\bigg\lfloor\dfrac{#1}{#2}\bigg\rfloor}}% floor(a/b)
\begin{document}
{\def\arraystretch{2}
\begin{align*}
  (X',Y',Z')=\left\{
  \begin{array}{*{15}{l}}
    \tuple{X}   {2Y}    {\dfrac{Z}{2}}              & \text{if } \range{X}{0}{\dfrac{1}{2}} \text{and } \range{Y}{0}{\dfrac{1}{2}}\\
    \tuple{2X}  {2Y-1}  {\dfrac{Z}{2}+\dfrac{1}{2}} & \text{if } \range{X}{0}{\dfrac{1}{2}} \text{and } \range{Y}{\dfrac{1}{2}}{1}\\
    \tuple{X}   {2Y}    {\dfrac{Z}{2}+\dfrac{1}{4}} & \text{if } \range{X}{\dfrac{1}{2}}{1} \text{and } \range{Y}{0}{\dfrac{1}{2}}\\
    \tuple{2X-1}{2Y-1}  {\dfrac{Z}{2}+\dfrac{3}{4}} & \text{if } \range{X}{\dfrac{1}{2}}{1} \text{and } \range{Y}{\dfrac{1}{2}}{1}\\
  \end{array}\right.\hspace*{-1.6pt}
  %,%if you want a comma afterwards
  \end{align*}
  \begin{align*}
    \implies
    \left\{
    \begin{aligned}  
      X' &= \left\{\begin{array}{*{3}{l}}
             \MOD{2X}{N}    & \text{if } & Z+1 \equiv (3 \vee 1) (\text{mod }4)\\
             \MOD{2X}{N}+1  & \text{if } & Z+1 \equiv (2 \vee 0) (\text{mod }4)\\
           \end{array}\right.\\
      Y' &= \left\{\begin{array}{*{3}{l}}
             \MOD{2Y}{N}    & \text{if } & Z+1 \equiv (2\vee 1) (\text{mod }4)\\
             \MOD{2Y}{N}+1  & \text{if } & Z+1 \equiv (3 \vee 0) (\text{mod }4)\\
           \end{array}\right.\\
      Z' &= \left\{\begin{array}{*{3}{l}}
            \floor{Z}{4}                & \text{if } &\range{X}{0}{\dfrac{N}{2}-1} \text{and } \range{Y}{0}{\dfrac{N}{2}-1}\\
            \floor{Z}{4}+\dfrac{2N}{4}  & \text{if } &\range{X}{0}{\dfrac{N}{2}-1} \text{and } \infRange{\dfrac{N}{2}-1}{Y}\\
            \floor{Z}{4}+\dfrac{N}{4}   & \text{if } &\infRange{\dfrac{N}{2}+1}{X} \text{and } \range{Y}{0}{\dfrac{N}{2}-1}\\
            \floor{Z}{4}+\dfrac{3N}{4}  & \text{if } &\infRange{\dfrac{N}{2}-1}{X} \text{and } \infRange{\dfrac{N}{2}-1}{Y}\\
           \end{array}\right.\hspace*{-1.2pt}
  \end{aligned}
  \right.
  \end{align*}
  }
\end{document}

相关内容