還有其他方法可以用數學中的編號來寫範例嗎?我正在使用asmart類。
\textbf{Example 1 }
答案1
不確定這種風格是否是您想要實現的,但這裡有一個 MWE,展示瞭如何使用它\newtheorem
來獲取編號example
環境,您可以使用通常label
/ref
方法來參考:
\documentclass{amsart}
\theoremstyle{definition}
\newtheorem{thm}{Theorem}[section]
\newtheorem{example}[thm]{Example}
\begin{document}
\begin{example}
some example
\label{test example}
\end{example}
Reference the above example: \ref{test example}
\end{document}
正如 barbara beeton 在評論中所述,上面的範例將使用相同的計數器對範例和定理進行編號。如果您想單獨對範例進行編號,請使用\newtheorem{example}{Example}[section]
。
答案2
如果您想要自動編號、上下文中正確的垂直間距,請使用以下內容:
\newtheorem{example}{Example}
......
\begin{document}
......
\begin{example}
......
\end{example}
......
\end{document}
佈局細節可以使用專用套件(例如amsthm
或ntheorem
)使用其預先定義的套件之一進行自訂styles
。像 之類的包thmtools
與兩者合作,提供了進一步定制的可能性。