![收集數組內的方程](https://rvso.com/image/353041/%E6%94%B6%E9%9B%86%E6%95%B8%E7%B5%84%E5%85%A7%E7%9A%84%E6%96%B9%E7%A8%8B.png)
我想在表格中列出一些練習的解決方案。我僅通過使用兩個數組(並分解方程式)和以下程式碼就成功地做到了這一點:
\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}
\noindent \textbf{1.3 (4)}
$$\begin{array}{cccccc}
\textbf{(a)} & 13\equiv b \pmod{8} & \textbf{(b)} & 52\equiv b\pmod{9} & \textbf{(c)} & -8\equiv b\pmod{10}\\
& 13=8\cdot 1 +5 & & 52=9\cdot 5 +7 & & -8=10\cdot (-1) +2\\
& \therefore 13\bmod 8= 5 & & \therefore 52\bmod 9= 7 & & \therefore -8\bmod 10= 2 \\
& \therefore \text{ s{\"a}tt } b=5 & & \therefore \text{ s{\"a}tt } b=7 & & \therefore \text{ s{\"a}tt } b=7\\
\end{array}$$
$$\begin{array}{ccccccc}
\textbf{(d)} & 14\equiv b\pmod{14} & \textbf{(e)} & 8\equiv b\pmod{12} & \textbf{(f)} & -23\equiv b\pmod{11}\\
& 14=14\cdot 1 +0 & & 8=12\cdot 0 +8 & & -23=11\cdot (-3) +10\\
& \therefore 14\bmod 14= 0 & & \therefore 8\bmod 12= 8 & & \therefore -23\bmod 11= 10\\
&\therefore \text{ s{\"a}tt } b=0 & & \therefore \text{ s{\"a}tt } b=8 & & \therefore \text{ s{\"a}tt } b=10\\
\end{array}$$
\end{document}
但我想知道是否可以透過將收集到的方程式嵌入到一個陣列中來實現這一點(因為這對我來說更有意義,因此我可以將方程式放在一起而不是將它們分開)。我嘗試了以下程式碼,但無法使其工作:
\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}
\noindent \textbf{1.3 (4)(a)}
$$\begin{array}{ccc}
\begin{gather*}
13\equiv b \pmod{8}\\
13=8\cdot 1 +5\\
\therefore 13\bmod 8= 5\\
\therefore \text{ s{\"a}tt } b=5\\
\end{gather*} &
\begin{gather*}
52\equiv b\pmod{9}\\
52=9\cdot 5 +7\\
\therefore 52\bmod 9= 7\\
\therefore \text{ s{\"a}tt } b=7\\
\end{gather*} &
\begin{gather*}
-8\equiv b\pmod{10}\\
-8=10\cdot (-1) +2\\
\therefore -8\bmod 10= 2\\
\therefore \text{ s{\"a}tt } b=7\\
\end{gather*}\\
\begin{gather*}
14\equiv b\pmod{14}\\
14=14\cdot 1 +0\\
\therefore 14\bmod 14= 0\\
\therefore \text{ s{\"a}tt } b=0\\
\end{gather*} &
\begin{gather*}
8\equiv b\pmod{12}\\
8=12\cdot 0 +8\\
\therefore 8\bmod 12= 8\\
\therefore \text{ s{\"a}tt } b=8\\
\end{gather*}&
\begin{gather*}
-23\equiv b\pmod{11}\\
-23=11\cdot (-3) +10\\
\therefore -23\bmod 11= 10\\
\therefore \text{ s{\"a}tt } b=10\\
\end{gather*}
\end{array}$$
\end{document}
答案1
您的陣列已經處於數學模式,因此您不能再次嵌套在它的數學模式中。嘗試:
\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}
\noindent \textbf{1.3 (4)(a)}
\[\setlength\arraycolsep{12pt} % more space between columns
\begin{array}{ccc}
\begin{gathered}% it is designed for use inside math environment
13\equiv b \pmod{8}\\
13=8\cdot 1 +5\\
\therefore 13\bmod 8= 5\\
\therefore \text{ s{\"a}tt } b=5\\
\end{gathered} % <---
& \begin{gathered} % <---
52\equiv b\pmod{9}\\
52=9\cdot 5 +7\\
\therefore 52\bmod 9= 7\\
\therefore \text{ s{\"a}tt } b=7\\
\end{gathered} % <---
& \begin{gathered} % <---
-8\equiv b\pmod{10}\\
-8=10\cdot (-1) +2\\
\therefore -8\bmod 10= 2\\
\therefore \text{ s{\"a}tt } b=7\\
\end{gathered} % <--- \\
% second row
\begin{gathered} % <---
14\equiv b\pmod{14}\\
14=14\cdot 1 +0\\
\therefore 14\bmod 14= 0\\
\therefore \text{ s{\"a}tt } b=0\\
\end{gathered} % <---
& \begin{gathered} % <---
8\equiv b\pmod{12}\\
8=12\cdot 0 +8\\
\therefore 8\bmod 12= 8\\
\therefore \text{ s{\"a}tt } b=8\\
\end{gathered} % <---
& \begin{gathered} % <---
-23\equiv b\pmod{11}\\
-23=11\cdot (-3) +10\\
\therefore -23\bmod 11= 10\\
\therefore \text{ s{\"a}tt } b=10\\
\end{gathered} % <---
\end{array}
\]
\end{document}