我对 LaTeX 还很陌生。我不太理解下面的代码,它只是从维基百科粘贴的模板。
我正在尝试制作一种简单的定理样式,它与普通的定理样式相同,但数字后面有一个破折号。我试过了,但一直出现编号错误。在我打字的时候,它停了一会儿。无论如何,告诉它做定理样式的最佳方法是什么?我觉得可能有一个非常简单的方法。
\newtheoremstyle{theoremdd}% name of the style to be used
{}% measure of space to leave above the theorem. E.g.: 3pt
{}% measure of space to leave below the theorem. E.g.: 3pt
{}% name of font to use in the body of the theorem
{}% measure of space to indent
{}% name of head font
{}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{ #2'}\thmnote{ (#3)}.}
\theoremstyle{theoremdd}
\newtheorem{thmd}{Theorem}[section]
...
\begin{thmd}[hello]
jfgh
\end{thmd}
虽然理解所有代码的含义很好,但我迫切需要一个修复。
谢谢,理查德
编辑/更新:
除了完全不理解 LaTeX 代码的工作原理外,我还有一个可以运行的产品,但这完全是一种变通方法。如果我错了,请纠正我,但 #2 代表一个数字。我只想从计数器中减去 1。目前这是我的修复方法:
\newtheoremstyle{theoremd}% name of the style to be used
{}% measure of space to leave above the theorem. E.g.: 3pt
{}% measure of space to leave below the theorem. E.g.: 3pt
{\em}% name of font to use in the body of the theorem
{}% measure of space to indent
{\bf}% name of head font
{.}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{\addtocounter{thm}{-1} #2}'\thmnote{\textnormal{ (#3)}}}
正如你所见,我一无所知。如果能得到更多的理解,我将不胜感激。
最新编辑:
这就是我所决定的。欢迎大家提出意见。我仍然不确定这一切是如何运作的,但感谢大家,我学到了很多东西。
\newtheoremstyle{theoremd}% name of the style to be used
{}% measure of space to leave above the theorem. E.g.: 3pt
{}% measure of space to leave below the theorem. E.g.: 3pt
{\em}% name of font to use in the body of the theorem
{}% measure of space to indent
{\bf}% name of head font
{.}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{\addtocounter{thm}{-1} #2$^\prime$}\thmnote{\textnormal{ (#3)}}}
答案1
只需填写必要的参数即可。
\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{theoremdd}% name of the style to be used
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{0pt}% measure of space to indent
{\bfseries}% name of head font
{. ---}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{ #2}\textnormal{\thmnote{ (#3)}}}
\theoremstyle{theoremdd}
\newtheorem{thmd}{Theorem}[section]
\begin{document}
\section{Whatever}
\begin{thmd}
This is a test theorem.
\end{thmd}
\end{document}
答案2
你想要一个 Bourbaki 风格的布局吗?使用这个ntheorem
包很容易:
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[small]{titlesec}
\titleformat{\section}{\normalsize\bfseries}{\thesection.}{0.5em}{}
\usepackage[ thmmarks, thref]{ntheorem}
\usepackage{chngcntr}
\usepackage{cleveref}
\renewcommand\thesection{\arabic{section}}
\theoremstyle{plain}
\theoremheaderfont{\scshape}
\theoremseparator{.~---}
\newtheorem{thm}{Theorem}
\counterwithin*{thm}{chapter}
\pagestyle{plain}
\begin{document}
\section{A first section}
\begin{thm}\label{testthm}
This is a test theorem.
\end{thm}
We see in \cref{testthm}\dots
\end{document}