如何修改枚舉計數器?

如何修改枚舉計數器?

我想在我的文件中列舉這樣的公理。

A1 this is the first axiom
A2 this is the second axiom

Now some text

A3 this is the third axiom

我怎麼能在 LaTeX 中做到這一點?

答案1

公理和類似元素通常作為定理環境處理,並自動編號。使用這種方法,您可以在序言中包含以下指令:

\newtheorem{axiom}{A}

這會將公理標記為「A 1」、「A 2」等。

(更常見的是拼出“Axiom”;這將取代上面代碼中的“A”。)

如果您確實希望標籤為“A1”等,並且“A”和數字之間沒有空格,事情會變得更加複雜。請確認此要求,並指定您正在使用的文件類別和任何套件,以便提供適當的程式碼。

答案2

A 和公理數之間沒有空格並不難:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm}
\usepackage{cleveref}
\crefname{axiom}{axiom}{axioms}
\Crefname{axiom}{Axiom}{Axioms}

\newtheorem{axiom}{}
\renewcommand\theaxiom{A\arabic{axiom}}

\begin{document}

\begin{axiom}\label{ax1}
This is the first axiom.
\end{axiom}

\begin{axiom}\label{ax2}
This is the second axiom.
\end{axiom}
\Cref{ax2} cannot be deduced from \cref{ax2}.

\end{document} 

在此輸入影像描述

相關內容