这是我的代码
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{parskip}
\usepackage{emptypage}
\usepackage{multirow}
\usepackage{framed}
\usepackage{bm}
\usepackage{hhline}
\usepackage{mathtools}
\usepackage{amsthm, amsmath}
\newtheoremstyle{definition}
{\parskip}% % Space above
{\parskip}% % Space below
{\itshape}% % Body font
{}% % Indent amount
{\bfseries}% % Theorem head font
{~---}% % Punctuation after theorem head
{ }% % Space after theorem head
{}
\theoremstyle{definition}
\usepackage[left=1in, right=1in, top=1.5in, bottom=1.5in]{geometry}
\usepackage{hyperref}
\hypersetup{
linktoc=all %set to all if you want both sections and subsections linked
}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Some Chapter}
\section{Some Section}
\newtheorem{somedef}{Definition}
\begin{somedef}
Some definition
\end{somedef}
\newtheorem{somedef2}{Definition}
\begin{somedef2}
Some other definition
\end{somedef2}
\end{document}
我正在 Overleaf 上编译此内容(不确定是否重要),链接在这里:https://www.overleaf.com/read/tsbqtfwbgsvm
定理计数器怎么没有增加?两个定义都显示 1。
感谢任何帮助。
编辑:我希望定理从 1 开始并以 1 为增量递增。这难道不应该是默认行为吗?
答案1
因此,您实际上正在寻找的是:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{parskip}
\usepackage{emptypage}
\usepackage{multirow}
\usepackage{framed}
\usepackage{bm}
\usepackage{hhline}
\usepackage{mathtools}
\usepackage{amsthm, amsmath}
\newtheoremstyle{definition}
{\parskip}% % Space above
{\parskip}% % Space below
{\itshape}% % Body font
{}% % Indent amount
{\bfseries}% % Theorem head font
{~---}% % Punctuation after theorem head
{ }% % Space after theorem head
{}
\theoremstyle{definition}
\usepackage[left=1in, right=1in, top=1.5in, bottom=1.5in]{geometry}
\usepackage{hyperref}
\hypersetup{
linktoc=all %set to all if you want both sections and subsections linked
}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Some Chapter}
\section{Some Section}
\newtheorem{somedef}{Definition}
\begin{somedef}
Some definition
\end{somedef}
% Do NOT issue a second \newtheorem{somedef2}{Definition}
% Simply reuse the same environment as above:
\begin{somedef}
Some other definition
\end{somedef}
\end{document}
还是我又误解了?