我想创建一个文档,其中包含出现amsart
,但添加了\chapter
命令(样式如amsbook
,或不同)。我该怎么做?
我尝试通过各种和的组合让 LaTeX 加载amsbook
和,但这似乎是一个失败的策略,因为它们都使用 定义了很多东西,导致无数的错误。我还意识到我不能反过来做,因为我想坚持定理在 中的样子,而不是在 中。我也知道我理论上可以使用 自己设计样式,但要获得 标题的间距需要大量的手动工作,我想避免手动执行此操作。amsart
\LoadClass
\documentclass
\newcommand
amsart
amsbook
titlesec
amsart
MWE 如下:
%\documentclass[openany,11pt]{amsbook}
\documentclass[11pt]{amsart}
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{theorem}[lemma]{Theorem}
\begin{document}
\chapter{My Fair Chapter}
\section{Lovely section}
\begin{theorem} % Should show "Theorem" in bold, unintended.
I love ducks.
\end{theorem}
\end{document}
答案1
我会修改你不喜欢的部分amsbook.cls
。仅添加章节的基础设施就需要比 David Carlisle 添加的代码行多得多的代码行,因为还应考虑目录和其他列表。
\documentclass{amsbook}
\usepackage{etoolbox}
\makeatletter
\numberwithin{section}{chapter}
\def\@secnumfont{\mdseries}
\def\section{\@startsection{section}{1}%
\z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%
{\normalfont\scshape\centering}}
\def\subsection{\@startsection{subsection}{2}%
\z@{.5\linespacing\@plus.7\linespacing}{-.5em}%
{\normalfont\bfseries}}
\patchcmd{\@thm}{\let\thm@indent\indent}{\let\thm@indent\noindent}{}{}
\patchcmd{\@thm}{\thm@headfont{\scshape}}{\thm@headfont{\bfseries}}{}{}
\makeatother
\newtheorem{thm}{Theorem}[section]
\begin{document}
\chapter{Chapter title}
\section{Title of this section}
\subsection{Title of this subsection}
\begin{thm}
Whatever the theorem says.
\end{thm}
\begin{thm}[Somebody]
Whatever the theorem says.
\end{thm}
\end{document}
\chapter{Chapter title}
如果我删除自定义并加载,则会得到以下结果amsart
。
答案2
\chapter
只需从 amsbook复制相关的行即可
%\documentclass[openany,11pt]{amsbook}
\documentclass[11pt]{amsart}
\makeatletter
\def\chaptermark#1{}%whatever
\let\chapterrunhead\partrunhead
\def\chapter{%
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}\global\@topnum\z@
\@afterindenttrue \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\refstepcounter{chapter}%
\ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
\else \let\@secnumber\thechapter \fi
\typeout{\chaptername\space\@secnumber}%
\def\@toclevel{0}%
\ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}%
\else \@tocwriteb\tocchapter{chapter}{#2}\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\@makechapterhead{#2}\@afterheading}
\def\@schapter#1{\typeout{#1}%
\let\@secnumber\@empty
\def\@toclevel{0}%
\ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#1}%
\else \@tocwriteb\tocchapter{chapter}{#1}\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\@makeschapterhead{#1}\@afterheading}
\newcommand\chaptername{Chapter}
\def\@makechapterhead#1{\global\topskip 7.5pc\relax
\begingroup
\fontsize{\@xivpt}{18}\bfseries\centering
\ifnum\c@secnumdepth>\m@ne
\leavevmode \hskip-\leftskip
\rlap{\vbox to\z@{\vss
\centerline{\normalsize\mdseries
\uppercase\@xp{\chaptername}\enspace\thechapter}
\vskip 3pc}}\hskip\leftskip\fi
#1\par \endgroup
\skip@34\p@ \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\@makeschapterhead#1{\global\topskip 7.5pc\relax
\begingroup
\fontsize{\@xivpt}{18}\bfseries\centering
#1\par \endgroup
\skip@34\p@ \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\appendix{\par
\c@chapter\z@ \c@section\z@
\let\chaptername\appendixname
\def\thechapter{\@Alph\c@chapter}}
\newcounter{chapter}
\newif\if@openright
\makeatother
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{theorem}[lemma]{Theorem}
\begin{document}
\chapter{My Fair Chapter}
\section{Lovely section}
\begin{theorem} % Should show "Theorem" in bold, unintended.
I love ducks.
\end{theorem}
\end{document}