我在某些数学期刊的 latex 文件中看到了一些不错的功能,我想在自己的 .tex 文件中创建该功能。现在,我可以写
\begin{equation}\label{eq:STUFF}
MATH STUFF
\end{equation}
这将生成一个编号的方程式。在其他地方,我可以引用“ Equation \ref{eq:STUFF}
”,它会帮我处理编号。这是我正在寻找的新功能:我希望能够编写
\begin{theorem}\label{thm:LATEX}
For example, this theorem is Theorem 2.5.1 because it is the first theorem in the fifth subsection of the second section.
\end{theorem}
我希望能够写入“ Theorem \ref{thm:LATEX}
”,并让我的 PDF 使用以下格式的定理编号构建:[Section].[Subsection].[Item],在本例中为“2.5.1”。
我还希望能够切换未编号项目的编号,例如简单的备注,或者
\begin{proof}
Proof of the above numbered theorem.
\end{proof}
我将其称为“定理 \ref{thm:LATEX} 的证明”,并且我不希望项目计数器计算证明,因此证明之后的项目将是项目“2.5.2”
下面是我的 TEX 文件,其中包含我想要的内容的注释:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx} % needed for figures
\usepackage{bm} % for math
\usepackage{amssymb} % for math
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{titling}
\usepackage{bigints}
\usepackage{mathtools}
\usepackage{centernot}
\usepackage[left=1in,right=1in,top=0.468in,bottom=.768in,centering,includeheadfoot]{geometry}
\title{{\LARGE{ \textbf{Proof of Latex}}}}
\author{\Large{Hodor P. Bojangleton}}
\begin{document}
\renewcommand{\abstractname}{\vspace{-\baselineskip}}
\date{\today}
\maketitle
\tableofcontents
\newpage
\large{
\section{SECTION 1}
Currently this starts with 0 because it is counting the chapters, but I only want to use sections and subsections. I need to get rid of the counting for chapters.
Items in this space should be numbered 1.0.X
Here I create and equation with the "begin/end" syntax that I want for my new commands.
\begin{equation}\label{eq:111}
1+1=2
\end{equation}
I want to add a zero for the subsection in the numbering of Equation \ref{eq:111}.
\subsection{SUBSECTION 1.1}
Here we have the 0 chapter number than I want to get rid of.
Items in this space should be numbered 1.1.X
I want the item name and number to appear aesthetically like:\newline
\noindent {\Large \textbf{Theorem 1.1.1}} After I write "begin theorem" to mimic the "begin equation" functionality that I already have, I want the text I write between "begin" and "end" to show up on the same line as the large bold theorem header.\newline
\noindent {\Large \textit{Proof.}} This is an unnumbered proof of the above theorem.\newline
\noindent {\Large \textbf{Lemma 1.1.2}} The item counter did not increment for the proof.
\section{SECTION 2}
Items in this space should be numbered 2.0.X
\subsection{SUBSECTION 2.1}
Items in this space should be numbered 2.1.X
\subsection{SUBSECTION 2.2}
Items in this space should be numbered 2.2.X
}
\end{document}
答案1
您可以使用ntheorem
包来实现这一点。[section]
选项newtheorem
控制定理标签是否包含章节编号。请参阅手册ntheorem
了解详细信息和更多示例。
\documentclass{report}
\usepackage{mathtools}
\usepackage[amsmath, thmmarks, thref]{ntheorem}
\usepackage{unicode-math}
\usepackage{microtype}
\usepackage[paperwidth=10cm]{geometry}
\defaultfontfeatures{Scale = MatchLowercase}
\setmathfont{Latin Modern Math}
\setmathfont[range=\QED]{XITS Math}
\renewcommand\qedsymbol{\ensuremath{\QED}}
\theoremstyle{marginbreak}
\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\slshape}
\theoremsymbol{\qedsymbol}
\theoremseparator{:}
\newtheorem{Theorem}{Theorem}[section]
\begin{document}
\section{Introduction}\label{sec:introduction}
We will introduce theorem \thref{thm:112} shortly. Wait for it!
\subsection*{The Theorem}\label{subsec:01}
\begin{Theorem}[An Exercise in Peano Arithmetic]\label{thm:112}[Theorem]
When I was young and brash, I would always ask on the first day of every math
class I took, “Is this where we finally learn why \(1+1=2\)?”
One day, a classmate said to me, “You \textbf{do} know that one plus one is \textbf{defined} as two?”
When I told this story later, it kicked off an argument over whether he should’ve said, “Two is defined as one plus one.”
Thus, by definition, \( 1 + 1 = 2 \).
\end{Theorem}
\end{document}
这并不是最基本的,我对你的模板做了一些改动。特别是,我加载unicode-math
并设置了 QED 符号为某些版本中使用的“墓碑”。计算机编程艺术。
添加amsthm
包选项将允许您使用proof
定理内的环境。
因为这是一份报告,所以您也可以开始\chapter
。