如何使用LaTeX得到如下圖的結果?
在這張圖片中,$\mathsection{1} Hình thang và hình bình hành$
是第一部分的標題。如果我使用\mathsection
and \section
,那麼結果是
我的問題是:給我第一張圖片的結果的程式碼是什麼?
答案1
您可以重新定義\@makechapterhead
,\@makeschapterhead
並\@sect
獲得所需的標題表示形式(titlesec
不可能使用像這裡這樣的包,因為它與 AMS 文檔類不相容):
\documentclass[11pt,a4paper]{amsbook}
\makeatletter
\def\@makechapterhead#1{\global\topskip 5.5pc\relax
\begingroup
\fontsize{\@xivpt}{18}\bfseries\centering
\ifnum\c@secnumdepth>\m@ne
\leavevmode \hskip-\leftskip
\rlap{\vbox to\z@{\vss
\centerline{\normalsize\mdseries
\@xp{\scshape{\chaptername}}\enspace\thechapter}
\vskip 2pc}}\hskip\leftskip\fi
\normalfont\scshape#1\par \endgroup
\skip@34\p@ \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\@makeschapterhead#1{\global\topskip 7.5pc\relax
\begingroup
\fontsize{\@xivpt}{18}\normalfont\scshape\centering
#1\par \endgroup
\skip@34\p@ \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\@sect#1#2#3#4#5#6[#7]#8{%
\edef\@toclevel{\ifnum#2=\@m 0\else\number#2\fi}%
\ifnum #2>\c@secnumdepth \let\@secnumber\@empty
\else \@xp\let\@xp\@secnumber\csname the#1\endcsname\fi
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\edef\@svsec{\ifnum#2<\@m
\@ifundefined{#1name}{}{%
\ignorespaces\csname #1name\endcsname\space}\fi
\@nx\textup{%
\csname the#1\endcsname.}\enspace
}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@ % then this is not a run-in section heading
\begingroup\ifnum#2=1 \noindent\textbf{\S}\fi#6\relax% NEW
\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty\@M #8\par}%
\endgroup
\csname #1mark\endcsname{#7}%
\ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
\else
\def\@svsechd{#6\hskip #3\@svsec
\@ifnotempty{#8}{\ignorespaces#8\unskip
\@addpunct.}%
\ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
}%
\fi
\global\@nobreaktrue
\@xsect{#5}}
\def\section{\@startsection{section}{1}%
\z@{.7\linespacing\@plus\linespacing}{.5\linespacing}
{\normalfont\bfseries}}
\makeatother
\begin{document}
\chapter{Test Chapter}
\section{Test Numbered Section}
\section*{Test Unnumbered Section}
\end{document}