Часть 1. Альфа

Часть 1. Альфа

У меня есть художественная книга, написанная в LaTeX. Она уже хорошо структурирована с 4 уровнями заголовков (часть, глава, раздел и подраздел), но для художественных целей я хочу вместо названий разделов и подразделов отобразить какой-то преднамеренный текст (например, по центру "***"), а названия глав и частей я хочу отобразить обычным способом. Я использую классы scrbookи scrreprt.

Итак, я хочу, чтобы это:

\documentclass{scrreprt}% or scrbook
\begin{document}
\part{Alpha}
\chapter{Aleph}
text here
\section{name for an internal usage}
text there
\section{one more internal name}
more and more text
\chapter{Bet}
\section{adjacent section}
text
\section{another internal name}
text text text
\end{document}

будет отображаться следующим образом:

Часть 1. Альфа

Глава 1. Алеф

текст здесь

***

текст там

***

все больше и больше текста

Глава 2. Ставка

текст

***

текст текст текст

Поэтому было бы замечательно, если бы соседняя секция вообще не отображалась (как в моем примере), но это не критично.

Также я сосредоточен на отображении текста, оглавление менее важно, но для идеального решения было бы здорово, если бы для разделов и подразделов оглавление использовало начало предложения следующего текста.

решение1

Вы можете использовать \sectionlinesformat. Он сгенерирует правильный toc, используя внутренние имена.

А если вы используете, \subsectionто получите точки меньшего размера, чем секции.

звезды

\documentclass{scrreprt}

\renewcommand{\sectionlinesformat}[4]{\centering ***}

\begin{document}
\part{Alpha}
\chapter{Aleph}
text here
\section{name for an internal usage}
text there
\section{one more internal name}
more and more text
\chapter{Bet}
\section{adjacent section}
text
\section{another internal name}
text text text
\subsection{Test}
\end{document}

Я бы рекомендовал вам использовать более интересный символ. Ниже я возьму один из adfornпакета. Вот пример.

адфорн

\documentclass{scrreprt}

\usepackage{adforn}
\renewcommand{\sectionlinesformat}[4]{\centering\adforn{21}\quad\adforn{11}\quad\adforn{49}}

\begin{document}
\part{Alpha}
\chapter{Aleph}
text here
\section{name for an internal usage}
text there
\section{one more internal name}
more and more text
\chapter{Bet}
\section{adjacent section}
text
\section{another internal name}
text text text
\subsection{Test}
\end{document}

Предлагаемая действительно шикарная версия:

изысканный

\documentclass{scrreprt}

\usepackage{adforn}
\renewcommand{\sectionlinesformat}[4]{\centering\ifstr{#1}{section}{\adforn{21}\quad\adforn{11}\quad\adforn{49}}{***}}
\renewcommand*{\chapterformat}{\chapapp~\thechapter\autodot\enskip}

\begin{document}
\part{Alpha}
\chapter{Aleph}
text here
\section{name for an internal usage}
text there
\section{one more internal name}
more and more text
\chapter{Bet}
\section{adjacent section}
text
\section{another internal name}
text text text
\subsection{Test}
\end{document}

решение2

Вы можете изменить \sectionlinesformatмакрос, он вызывается командами секционирования section и ниже следующим образом \sectionlinesformat{layer}{indent}{number}{text}:

\documentclass[]{scrreprt}

\renewcommand*{\sectionlinesformat}[4]{%
    \centering\textbf{***}%
}

\begin{document}
\part{Alpha}
\chapter{Aleph}
text here
\section{name for an internal usage}
text there
\section{one more internal name}
more and more text
\chapter{Bet}
\section{adjacent section}
text
\section{another internal name}
text text text
\subsection{another internal}
\end{document}

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