在自定义定理编号@egreg 提供了一种自定义定理编号的方法:
\documentclass{article}
%\usepackage{amsthm} %% uncomment to see the difference
\newtheorem{innercustomthm}{Theorem}
\newenvironment{customthm}[1]
{\renewcommand\theinnercustomthm{#1}\innercustomthm}
{\endinnercustomthm}
\begin{document}
\begin{customthm}{8}[Somebody]\label{eight}
Every theorem must be numbered by hand.
\end{customthm}
Here is a reference to theorem~\ref{eight}.
\end{document}
现在我倾向于将这种方法扩展到引理、定义、推论等。但是在扩展到引理时我遇到了错误。
我输入
\newtheorem{innercustomlemma}{Lemma}
\newenvironment{customlemma}[1]
{\renewcommand\theinnercustomlemma{#1}\innercustomlemma}
{\endinnercustomlemma}
一开始的时候
\begin{customlemma}{abc}[abcd]\label{abcde}
abcdef
\end{customthm}
在主体上。错误显示:
! Undefined control sequence. \customlemma ...heinnercustomlemma {#1}\innercust
omlemma
l.126 \begin{customlemma}{abc}
[abcd]\label{abcde} ?
我不知道我该怎么办?
另外,定理里面的字体默认是斜体,我想知道是否可以关闭它?