我經常需要使用這種格式來輸入練習,它很令人滿意,但我想知道如何將括號中的字母與相鄰練習的第一行對齊。因此,第一個問題是我如何使用gathered
內部來完成它array
,後續問題是是否沒有更合適的方法來完成它。
\documentclass{article}
\usepackage{amssymb,amsmath}
\begin{document}
\noindent \textbf{3.4}
\[
\begin{array}{cccc}
\noindent \textbf{(a)}&
\begin{gathered}
\mathbb{Z}^*_{7}=\left\{1,3,5\right\}\\
4^3=64=1
\end{gathered}&
\noindent \textbf{(b)}&
\begin{gathered}
\mathbb{Z}^*_{8}=\left\{1,3,5,7\right\}\\
3^4=81=1\\
\end{gathered}\\\\
\noindent \textbf{(c)}&
\begin{gathered}
\mathbb{Z}^*_{11}=\left\{1,,2,3,4,5,6,7,8,9,10\right\}\\
\begin{array}{c|cccccccccc}
\cdot & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
\hline
{\rule{0pt}{2.6ex}}
5 & 5 & 10 & 4 & 9 & 3 & 8 & 2 & 7 & 1 & 6\\
\end{array}\\
5^{-2}=5^{-1}\cdot 5^{-1}=9\cdot 9=4\\
\end{gathered}&
\noindent \textbf{(d)}&
\begin{gathered}
\mathbb{Z}^*_{12}=\left\{1,5,7,11\right\}\\
\begin{array}{c|cccc}
\cdot & 1 & 5 & 7 & 11\\
\hline
{\rule{0pt}{2.6ex}}
5 & 5 & 1 & 11 & 7\\
\end{array}\\
5^{-4}\cdot 7^2=5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 1=5^4=1\\
\end{gathered}
\end{array}
\]
\end{document}
答案1
像這樣?
我對和環境使用套件exams
和選項:[t]
aligned
gathered
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{amsmath, amsfonts}
\usepackage{array}
\setlength\extrarowheight{2pt}
\newlength\labelwd
\settowidth\labelwd{\bfseries viii.)}
\usepackage{tasks}
\settasks{counter-format =tsk[a].),
label-format=\bfseries,
label-offset=1em,
label-align=right,
label-width=\labelwd,
item-indent=\dimexpr\labelwd+1em\relax,
before-skip =-0.5ex,
after-item-skip=\medskipamount}
\usepackage{enumitem}
\setlist[enumerate,1]{% (
leftmargin=*, itemsep=\baselineskip,
label={\textbf{\thesection.\arabic*}}
}
\begin{document}
\section{section title}
\begin{enumerate}
\item
\begin{tasks}(2)
\task $\begin{aligned}[t]
\mathbb{Z}^*_{7} & = \left\{1,3,5\right\}\\
4^3 & = 64 = 1
\end{aligned}$
\task $\begin{aligned}[t]
\mathbb{Z}^*_{8} & = \left\{1,3,5,7\right\}\\
3^4 & = 81 = 1
\end{aligned}$
\task $\begin{gathered}[t]
\mathbb{Z}^*_{11}=\left\{1,2,3,4,5,6,7,8,9,10\right\}\\
\begin{array}{c|cccccccccc}
\cdot & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
\hline
5 & 5 & 10 & 4 & 9 & 3 & 8 & 2 & 7 & 1 & 6\\
\end{array}\\
5^{-2}=5^{-1}\cdot 5^{-1}=9\cdot 9=4\\
\end{gathered}$
\task $\begin{gathered}[t]
\mathbb{Z}^*_{12}=\left\{1,5,7,11\right\}\\
\begin{array}{c|cccc}
\cdot & 1 & 5 & 7 & 11\\
\hline
5 & 5 & 1 & 11 & 7\\
\end{array}\\
5^{-4}\cdot 7^2=5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 1=5^4=1\\
\end{gathered}$
\end{tasks}
\item
\begin{tasks}(2)
\task 1
\task 2
\task 3
\task 4
\end{tasks}
\end{enumerate}
\end{document}
附錄:
從tasks
2020 年 3 月 21 日起的 V1.2 版本以上,MWE 不再如預期運作。其序言(重現有問題的圖像)應更改為:
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{enumitem}
\setlist[enumerate,1]{leftmargin=*,
itemsep=\baselineskip,
label={\textbf{\thesection.\arabic*}}
}
\usepackage{amsmath, amssymb}
\usepackage{array}
\setlength\extrarowheight{2pt}
\usepackage{tasks}
\settasks{label=(\alph*),
label-format=\bfseries,
label-offset=1em,
before-skip =-0.5ex,
after-item-skip=\medskipamount
}
答案2
只需使用 的[t]
選項即可gathered
。但是,我建議使用tasks
同名包中的環境,該包是針對水平練習清單而完成的。我還建議aligned
在相關的地方使用,並且我定義了一個\set
命令以獲得更輕的程式碼:
\documentclass{article}
\usepackage{amssymb,mathtools}
\usepackage{tasks}
\usepackage[showframe]{geometry}
\DeclarePairedDelimiter\set\{\}
\begin{document}
\noindent \textbf{3.4}
\[
\begin{array}{cccc}
\noindent \textbf{(a)}&
\begin{gathered}[t]
\mathbb{Z}^*_{7}=\set{1,3,5}\\
4^3=64=1
\end{gathered}&
\noindent \textbf{(b)}&
\begin{gathered}[t]
\mathbb{Z}^*_{8}=\set{1,3,5,7}\\
3^4=81=1\\
\end{gathered}\\\\
\noindent \textbf{(c)}&
\begin{gathered}[t]
\mathbb{Z}^*_{11}=\set{1,2,3,4,5,6,7,8,9,10}\\
\begin{array}{c|*{10}{c}}
\cdot & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
\hline
{\rule{0pt}{2.6ex}}
5 & 5 & 10 & 4 & 9 & 3 & 8 & 2 & 7 & 1 & 6\\
\end{array}\\
5^{-2}=5^{-1}\cdot 5^{-1}=9\cdot 9=4\\
\end{gathered}&
\noindent \textbf{(d)}&
\begin{gathered}[t]
\mathbb{Z}^*_{12}=\set{1,5,7,11}\\
\begin{array}{c|*{4}{c}}
\cdot & 1 & 5 & 7 & 11\\
\hline
{\rule{0pt}{2.6ex}}
5 & 5 & 1 & 11 & 7\\
\end{array}\\
5^{-4}\cdot 7^2=5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 1=5^4=1\\
\end{gathered}
\end{array}
\]
\vspace{1cm}
\begin{tasks}[counter-format = (tsk[a]), label-format=\bfseries, label-width=1.5em, label-offset=0.5em, column-sep=1em](2)
\task \centering$ \begin{aligned}[t]
\mathbb{Z}^*_{7} & =\set{1,3,5}\\
4^3 & =64=1
\end{aligned} $
\task $ \begin{aligned}[t]
\mathbb{Z}^*_{8} & =\set{1,3,5,7}\\
3^4 & =81=1\\
\end{aligned} $
\task $ \begin{gathered}[t]
\mathbb{Z}^*_{11}=\set{1,2,3,4,5,6,7,8,9,10}\\
\begin{array}{c|*{10}{c}}
\cdot & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\
\hline
{\rule{0pt}{2.6ex}}
5 & 5 & 10 & 4 & 9 & 3 & 8 & 2 & 7 & 1 & 6\\
\end{array}\\
5^{-2}=5^{-1}\cdot 5^{-1}=9\cdot 9=4
\end{gathered} $
\task $ \begin{gathered}[t]
\mathbb{Z}^*_{12}=\set{1,5,7,11}\\
\begin{array}{c|*{4}{c}}
\cdot & 1 & 5 & 7 & 11\\
\hline
{\rule{0pt}{2.6ex}}
5 & 5 & 1 & 11 & 7\\
\end{array}\\
5^{-4}\cdot 7^2=5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 5^{-1}\cdot 1=5^4=1
\end{gathered}$
\end{tasks}
\end{document}