![如何在 amsthm 环境中对齐一个示例中的项目符号示例?](https://linux22.com/image/461155/%E5%A6%82%E4%BD%95%E5%9C%A8%20amsthm%20%E7%8E%AF%E5%A2%83%E4%B8%AD%E5%AF%B9%E9%BD%90%E4%B8%80%E4%B8%AA%E7%A4%BA%E4%BE%8B%E4%B8%AD%E7%9A%84%E9%A1%B9%E7%9B%AE%E7%AC%A6%E5%8F%B7%E7%A4%BA%E4%BE%8B%EF%BC%9F.png)
我正在使用 amsthm 来标记示例。我不想单独列出每个后续示例,而是想在一个标记为“示例”的行中列出多个示例。例如,我可能会将 4+3 = 7、2+4 = 6 和 3+1 = 4 列在单独的行上,并列出各自的要点,但所有三个要点都在示例 1.1 中。
我怎样才能做到这一点?这是一个最小的工作代码示例,其中第二个示例我设法获得了所需的结果,但第一个例子失败了:
\documentclass{article}
\usepackage{amsmath, amsfonts, amssymb, amsthm, bm, graphicx,color}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\parskip 5mm
\parindent 1cm
\begin{document}
\begin{example}
\begin{align*}
\text{\textbullet} && & 13 \oplus 3 = 3 \\
\text{\textbullet} && & -4 \oplus 15 = -4 \\
\end{align*}
\end{example}
\begin{example}
\begin{align*}
\text{\textbullet} && &\text{For } p = 2, \text{the p-adic (here 2-adic) valuation on } \frac{4}{9} \text{ is } 2, \text{ since } \frac{4}{9} = 2^{2} \cdot \frac{1}{9}, \\
&& &\text{where } 2 \nmid 1 \text{ and } 2 \nmid 9.\\
\text{\textbullet} && &\text{For } p = 5, \text{the 5-adic valuation on } \frac{16}{125} \text{ is } -3, \text{ since } \frac{16}{125} = 5^{-3} \cdot \frac{16}{1}, \\
&& &\text{where } 5 \nmid 16 \text{ and } 5 \nmid 1.\\
\end{align*}
\end{example}
\end{document}
我有两个问题。如何将第二个工作示例 0.2 复制到任何通用示例集?其次,有没有更有效的方法来做到这一点?
答案1
为什么不使用itemize
?
\documentclass{article}
\usepackage{amsmath, amsfonts, amssymb, amsthm, bm, graphicx,color}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
%\setlength{\parskip}{5mm} % should be flexible
%\setlength{\parindent}{1cm} % too wide
\begin{document}
\begin{example}\mbox{}
\begin{itemize}
\item \makebox[\linewidth]{$13 \oplus 3 = 3$}
\item \makebox[\linewidth]{$-4 \oplus 15 = -4$}
\end{itemize}
\end{example}
\begin{example}\mbox{}
\begin{itemize}
\item For $p = 2$, the $p$-adic (here $2$-adic) valuation on $\dfrac{4}{9}$ is $2$,
since $\dfrac{4}{9} = 2^{2} \cdot \dfrac{1}{9}$, where $2 \nmid 1$ and $2 \nmid 9$.
\item For $p = 5$, the $5$-adic valuation on $\dfrac{16}{125}$ is $-3$, since
$\dfrac{16}{125} = 5^{-3} \cdot \dfrac{16}{1}$, where $5 \nmid 16$ and $5 \nmid 1$.
\end{itemize}
\end{example}
\end{document}
无需猜测换行符。在第一种情况下,我会避免将数学置于中心。
与下面更易读的版本进行比较
\begin{example}\mbox{}
\begin{itemize}
\item $13 \oplus 3 = 3$
\item $-4 \oplus 15 = -4$
\end{itemize}
\end{example}
答案2
flalign
帮助您放置\textbullet
在左侧\linewidth
\eqmakebox
来自eqparbox
包帮助微调对齐
检查一下
\documentclass{article}
\usepackage{amsmath, amsfonts, amssymb, amsthm, bm, graphicx,color}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\parskip 5mm
\parindent 1cm
\usepackage{eqparbox}
\begin{document}
\begin{example}
\begin{flalign*}
\text{\textbullet}
&&
13 & \oplus \eqmakebox[tag][l]{$3$} = 3
&&
\\
\text{\textbullet}
&&
-4 & \oplus \eqmakebox[tag][l]{$15$} = -4
&&
\end{flalign*}
\end{example}
\begin{example}
\begin{flalign*}
\text{\textbullet}
&&
& \text{For } p = 2, \text{the p-adic (here 2-adic) valuation on } \frac{4}{9} \text{ is } 2, \text{ since } \frac{4}{9} = 2^{2} \cdot \frac{1}{9},
\\
&&
& \text{where } 2 \nmid 1 \text{ and } 2 \nmid 9.
\\
\text{\textbullet}
&&
&\text{For } p = 5, \text{the 5-adic valuation on } \frac{16}{125} \text{ is } -3, \text{ since } \frac{16}{125} = 5^{-3} \cdot \frac{16}{1},
\\
&&
&\text{where } 5 \nmid 16 \text{ and } 5 \nmid 1.
\\
\end{flalign*}
\end{example}
\end{document}