2

I have fictional book written in LaTeX. And it is already good structured with 4 level of heading (part, chapter, section and subsection), but for art purposes I want render instead of sections and subsections name some deliberate text (e.g. centred "***"), and the name of chapters and parts I want render in normal way. I use scrbook and scrreprt classes.

So I want that this:

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

will be render as this:

Part 1. Alpha

Chapter 1. Aleph

text here

***

text there

***

more and more text

Chapter 2. Bet

text

***

text text text

So it would be wonderful if adjacent section doesn't render at all (how is in my example), but this isn't crucial.

Also I'm focused on the rendering of text, ToC is less important, but for ideal solution it will be great, if for section and subsection ToC uses begin of the sentence of the following text.

  • I've made your example compilable. Please always add a minimal but working example (MWE) to your questions. This makes it easier to help you and is more efficient than to let all of us make your almost compilable example really compilable. – Schweinebacke Jun 28 '17 at 16:05
2

You can use \sectionlinesformat. It will generate the correct toc using internal names.

And if you use \subsection you will get the dots in a smaller size than the section ones.

stars

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

I would recommend you to use a more interesting symbol. The following will take one from the adforn package. Here's an example.

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}

The suggested really fancy version:

fancy

\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}
  • You could add a check which layer it is and insert different symbols based on it (just because I'm too lazy atm, to edit my fabulous answer). – Skillmon Jun 28 '17 at 15:21
  • To also add the "Chapter" before the chapter number (see the example in the question) you can redefine \chapterformat to add \chapapp, e.g. \renewcommand*{\chapterformat}{\chapapp~\thechapter\autodot\enskip} (untested). – Schweinebacke Jun 28 '17 at 15:50
  • Thanks for the answer! I assume that size of symbols can be influenced by subsections format, right? – Alaksiej Stankievič Jun 30 '17 at 14:46
  • @AlaksiejStankievič Yes. – TeXnician Jun 30 '17 at 14:47
1

You might alter the \sectionlinesformat-macro, it gets called by the sectioning commands of section and lower as \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}
  • You were some seconds too late... ;) – TeXnician Jun 28 '17 at 15:07
  • yeah, just recognized that. I shouldn't have added the description of the call of \sectionlinesformat, then I would have been faster than you :( – Skillmon Jun 28 '17 at 15:08
  • I'm glad to see in your answer API of macros, thanks! – Alaksiej Stankievič Jun 30 '17 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.