对齐不垂直对齐方程式正确

对齐不垂直对齐方程式正确

我尝试将两个运行 Lucas-Lehmer 测试的方程对齐。我尝试使用

\begin{multicols}{2}
\begin{align*}
S_{I}(1)&=4\\
S_{I}(2)&=\left(14^{2}-2\right) mod 127 = 14\\
S_{I}(3)&=\left(67^{2}-2\right) mod 127 = 67\\
S_{I}(4)&=\left(42^{2}-2\right) mod 127 = 42\\
S_{I}(5)&=\left(111^{2}-2\right) mod 127 = 111\\
S_{I}(6)&=\left(0^{2}-2\right) mod 127 = 0
\end{align*}
\begin{align*}
S_{II}(1)&=4\\
S_{II}(2)&=\left(14^{2}-2\right) mod 255 = 14\\
S_{II}(3)&=\left(194^{2}-2\right) mod 255 = 194\\
S_{II}(4)&=\left(149^{2}-2\right) mod 255 = 149\\
S_{II}(5)&=\left(14^{2}-2\right) mod 255 = 14\\
S_{II}(6)&=\left(194^{2}-2\right) mod 255 = 194\\
S_{II}(7)&=\left(149^{2}-2\right) mod 255 = 149
\end{align*}
\end{multicols}

然而它导致在此处输入图片描述

如何实现 S_I(1) 和 S_II(1) 从同一高度开始?使用minipage结果

\begin{minipage}[t]{0.5\textwidth}
\begin{align*}
S_{I}(1)&=4\\
S_{I}(2)&=\left(14^{2}-2\right) \bmod 127 = 14\\
S_{I}(3)&=\left(67^{2}-2\right) \bmod 127 = 67\\
S_{I}(4)&=\left(42^{2}-2\right) \bmod 127 = 42\\
S_{I}(5)&=\left(111^{2}-2\right) \bmod 127 = 111\\
S_{I}(6)&=\left(0^{2}-2\right) \bmod 127 = 0
\end{align*}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{align*}
S_{II}(1)&=4\\
S_{II}(2)&=\left(14^{2}-2\right) \bmod 255 = 14\\
S_{II}(3)&=\left(194^{2}-2\right) \bmod 255 = 194\\
S_{II}(4)&=\left(149^{2}-2\right) \bmod 255 = 149\\
S_{II}(5)&=\left(14^{2}-2\right) \bmod 255 = 14\\
S_{II}(6)&=\left(194^{2}-2\right) \bmod 255 = 194\\
S_{II}(7)&=\left(149^{2}-2\right) \bmod 255 = 149
\end{align*}
\end{minipage}

在此处输入图片描述

答案1

这显示了单一align方法。

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
S_{I}(1)&=4 & S_{II}(1)&=4\\
S_{I}(2)&=\left(14^{2}-2\right) \bmod 127 = 14 &
S_{II}(2)&=\left(14^{2}-2\right) \bmod 255 = 14\\
S_{I}(3)&=\left(67^{2}-2\right) \bmod 127 = 67 &
S_{II}(3)&=\left(194^{2}-2\right) \bmod 255 = 194\\
S_{I}(4)&=\left(42^{2}-2\right) \bmod 127 = 42 &
S_{II}(4)&=\left(149^{2}-2\right) \bmod 255 = 149\\
S_{I}(5)&=\left(111^{2}-2\right) \bmod 127 = 111 &
S_{II}(5)&=\left(14^{2}-2\right) \bmod 255 = 14\\
S_{I}(6)&=\left(0^{2}-2\right) \bmod 127 = 0 &
S_{II}(6)&=\left(194^{2}-2\right) \bmod 255 = 194\\
&& S_{II}(7)&=\left(149^{2}-2\right) \bmod 255 = 149
\end{align*}

\end{document}

演示

相关内容