Заголовки подразделов в тексте

Заголовки подразделов в тексте

Как вставить заголовки подразделов в текст, как на картинке ниже? В большинстве стандартных шаблонов Latex будет пробел

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, следующий абзац будет иметь обычный отступ, если это отрицательное значение, отступ будет подавлен. В любом случае для вертикального пропуска будет использоваться абсолютное значение this.

  • <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}

Связанный контент