
如何在文字中嵌入小節標題,如下圖所示?在大多數標準乳膠模板中,都會有間隙
1.2韋爾函數域猜想
在這個部分...
我試圖避免這種情況,因為我認為這會讓事情變得混亂。我仍然希望章節標題有一個間隙,並且在小節標題之前有一個小空間,如下圖所示。
編輯:根據要求,這是一個顯示問題的最小工作範例:
\documentclass[12pt]{article}
\begin{document}
\section{Section}
Text A
\subsection{Subsection}
There are two problems with this working example: the subsection is not part of this paragraph (and the letters are not the same size as the letters here), and the gap between Text A and the subsection is too large.
\end{document}
以及當我將其通過 TeXmaker 時出現的結果的圖片:
我很高興更改我正在使用的文檔類。
答案1
如果您想重現圖片中的輸出,請使用amsart
.
\documentclass[12pt]{amsart}
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{remark}[theorem]{Remark}
\begin{document}
Some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words.
\section{Section title}
Some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words.
\subsection{Subsection title}
Some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words.
\begin{theorem}
A theorem statement. A theorem statement. A theorem statement.
A theorem statement. A theorem statement.
\end{theorem}
\begin{remark}
A remark. A remark. A remark. A remark. A remark.
\end{remark}
Some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words.
\subsection{Another subsection title}
Some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words some nonsense words some nonsense words
some nonsense words.
\end{document}
答案2
在article
(沒有套件)中,切片巨集都在\@startsection
內部使用。\@startsection
採用 6 個參數來控制節標題的外觀:
\@startsection
{<sectioning name>}
{<sectioning level>}
{<horizontal indent from left>}
{<vertical skip pre>}
{<skip post>}
{<font choice>}
雖然上面的論點大多是不言自明的,但其中兩個論點表現得有些特殊:
<vertical skip pre>
決定標題後面的段落是否縮排。如果該值為正數或 0,則接下來的段落將正常縮進,如果該值為負數,則縮排將被抑制。無論哪種方式,它的絕對值都將用於垂直跳躍。<skip post>
控制標題是否顯示為插入標題,如果為正,它將在標題後面表現為垂直跳過並顯示標題。如果為負數或 0,則標題將是插入標題,並且這將是標題和同一行中的文字之間的水平跳躍。
因此,解決了這個問題後,我們現在可以重新定義\subsection
格式為插入標題。
\renewcommand\subsection
{%
\@startsection
{subsection}
{2}
{\z@}
{3.25ex \@plus 1ex \@minus .2ex}
{-1em}
{\normalfont\normalsize\bfseries}%
}
如果我們在層面上開始這個格式化\subsection
,我們也應該\subsubsection
以同樣的方式重新定義。進行這些重新定義的完整文件:
\documentclass[]{article}
\makeatletter
\renewcommand\subsection
{%
\@startsection
{subsection}
{2}
{\z@}
{3.25ex \@plus 1ex \@minus .2ex}
{-1em}
{\normalfont\normalsize\bfseries}%
}
\renewcommand\subsubsection
{%
\@startsection
{subsubsection}
{3}
{\z@}
{3.25ex \@plus 1ex \@minus .2ex}
{-1em}
{\normalfont\normalsize\bfseries}%
}
\makeatother
\usepackage{duckuments}
\begin{document}
\section{This is a section}\blindduck
\subsection{This is a subsection}\blindduck
\subsubsection{This is a subsubsection}\blindduck
\paragraph{This is a paragraph}\blindduck
\end{document}
答案3
與titlesec
和article
:
\documentclass[12pt]{article}
\usepackage{titlesec}
\titleformat{\subsection}[runin]{\normalsize\bfseries}{\thesubsection}{5pt}{}
\begin{document}
\section{Section}
Text A
\subsection{Subsection}
There are two problems with this working example: the subsection is not part of this paragraph (and the letters are not the same size as the letters here), and the gap between Text A and the subsection is too large.
\end{document}