4

While passing parskip=half to scrbook removes all indentation, I (unfortunately) should indent everything by 10 mm, excluding chapter/section/... titles. How can this be achieved easiest? I was considering toying around with bcor and putting section numbers into the (fake) margin, but that seems pretty complicated...

edit It's a bit late to add this, but ideally the titles' texts (not the numbering) would also start at that indentation and be aligned, i.e.

+----------¦-----------+------¦---------------+
|    1     A chapter   |    3 Another chapter |
|    1.1   A section   |      some text       |
|    1.1.1 A subsection|  3.1 another section |
...

That should be answered in this question though.

  • 1
    You should “outdent” titles, instead. – egreg Nov 30 '15 at 13:03
  • @egreg How? And will this work correctly for a twoside layout? – Tobias Kienzler Nov 30 '15 at 13:05
  • What do you mean? What should happen to titles in left-hand and right-hand pages? – egreg Nov 30 '15 at 13:08
  • @egreg "outdenting" titles would mean I should increase the margin, right? But in a twoside layout and using \usepackage[inner=10mm, outer=20mm]{geometry} how could I increase only the "left" margin no matter whether the page is odd or even? Would bcor work here? – Tobias Kienzler Nov 30 '15 at 13:16
  • I think you just want 2cm on either side, with titles sticking in the margin (inner on odd pages, outer on even pages) by 1cm. – egreg Nov 30 '15 at 13:22
7

Second Update: If the chapter and section titles etc. should be aligned to the indented text you can use:

\documentclass[
  paper=a4,
  %chapterprefix
]{scrbook}[2015/10/03]

\newcommand\secnumwidth{1.5cm}

\makeatletter
\renewcommand\chapterlinesformat[3]{%
  \IfArgIsEmpty{#2}
    {#3}
    {\@hangfrom{\hspace{-\secnumwidth}\makebox[\secnumwidth][l]{#2}}{#3}}%
}

\renewcommand\sectionlinesformat[4]{%
  \IfArgIsEmpty{#3}
    {#4}
    {\@hangfrom{\hspace{-\secnumwidth}\makebox[\secnumwidth][l]{#3}}{#4}}%    
}
\makeatother

\usepackage[
  layoutsize={\dimexpr\paperwidth-\secnumwidth\relax,\paperheight},
  layoutoffset={\secnumwidth,0cm},
  inner=1cm,
  outer=2cm,
  showframe,
]{geometry}

\usepackage{blindtext}% dummy text

\begin{document}
\tableofcontents
\chapter{Kapitel}
\blindtext
\section{Abschnitt}
\subsection{Unterabschnitt}
\subsubsection{Unterunterabschnitt}
\blindtext
\addsec{Abschnitt ohne Nummer}
\blindtext
\end{document}

Result:

enter image description here


Update: It is better to use only the geometry options like @egreg showed in his answer. But the following code works also if the KOMA-Script option chapterprefix is used.

\documentclass[
  paper=a4,
  chapterprefix
]{scrbook}[2015/10/03]

\RedeclareSectionCommands[indent=-10mm]{section,subsection,subsubsection}

\renewcommand*{\chapterformat}{%
  \hspace{-10mm}\mbox{\chapappifchapterprefix{\nobreakspace}\thechapter
  \autodot\IfUsePrefixLine{}{\enskip}}%
}

\renewcommand{\chapterlineswithprefixformat}[3]{%
  #2\hspace{-10mm}\parbox[t]{\dimexpr\textwidth+10mm}{\raggedchapter#3}%
}

\usepackage[
  layoutsize={20cm,27.9cm},% cut 1cm from the width
  layoutoffset={1cm,0cm},% put it in the offset
  inner=1cm,
  outer=2cm,
  showframe,
]{geometry}% from http://tex.stackexchange.com/a/280792/43317


\usepackage{blindtext}% dummy text

\begin{document}
\tableofcontents
\Blinddocument
\end{document}

enter image description here

Original answer:

Maybe something like that

\documentclass[
  chapterprefix
]{scrbook}[2015/10/03]

\RedeclareSectionCommands[indent=-10mm]{section,subsection,subsubsection}
\renewcommand*{\chapterformat}{%
  \hskip -10mm\mbox{\chapappifchapterprefix{\nobreakspace}\thechapter
  \autodot\IfUsePrefixLine{}{\enskip}}%
}

\renewcommand{\chapterlineswithprefixformat}[3]{%
  #2\hskip -10mm\parbox[t]{\dimexpr\textwidth+10mm}{\raggedchapter#3}%
}

\usepackage[inner=10mm,outer=20mm,nomarginpar
  ,showframe% shows the page layout
]{geometry}
\addtolength\hoffset{10mm}
\addtolength\textwidth{-10mm}

\usepackage{blindtext}% dummy text

\begin{document}
\tableofcontents
\chapter{Kapitel}
\parbox{\linewidth}{\blindtext}
\section{Abschnitt}
\begin{center}
\blindtext
\end{center}
\Blinddocument
\end{document}

enter image description here

  • Great, thanks! I was about to suggest using egreg's geometry options, too, since the other version messed up with my wallpaper layer – Tobias Kienzler Nov 30 '15 at 15:33
  • It's a bit late and probably should go to a separate question, but any chance you know how to have the section titles etc. be aligned with the indented text? – Tobias Kienzler Nov 30 '15 at 15:35
  • it was not requested, but I added \setlist{leftmargin=5mm,labelwidth=5mm} to decrease lists' indentations – Tobias Kienzler Nov 30 '15 at 15:39
  • I have added an example that have the section titles etc. aligned with the indented text. – esdd Nov 30 '15 at 23:37
  • Great update, thanks! I replaced \newcommand{\secnumwidth}{1.5cm} by \newlength{\secnumwidth} \setlength{\secnumwidth}{1.5cm} for better manipulability though. (I guess without arguments \newcommand with or without * are basically the same) – Tobias Kienzler Dec 1 '15 at 8:14
7

You can use a trick I learnt some time ago: using the layout feature of geometry

\documentclass{scrbook}
\usepackage{geometry}
\usepackage{kantlipsum}

\geometry{
  a4paper,
  layoutsize={20cm,27.9cm},% cut 1cm from the width
  layoutoffset={1cm,0cm},% put it in the offset
  inner=1cm,
  outer=2cm,
  showframe,
}

\renewcommand{\chapterformat}{%
  \hspace*{-1cm}%
  \mbox{\chapappifchapterprefix{\nobreakspace}\thechapter \autodot\IfUsePrefixLine{}{\enskip}}%
}

\renewcommand{\sectionformat}{\hspace*{-1cm}\thesection\autodot\enskip}
\renewcommand{\subsectionformat}{\hspace*{-1cm}\thesubsection\autodot\enskip}
\renewcommand{\subsubsectionformat}{\hspace*{-1cm}\thesubsubsection\autodot\enskip}

\setcounter{secnumdepth}{3}

\begin{document}

\chapter{Title}

\kant[1]

\section{A title}

\subsection{A subtitle}

\subsubsection{A subsubtitle}

\kant[2-4]

\section{A title}

\subsection{A subtitle}

\subsubsection{A subsubtitle}

\kant[5-6]

\section{A title}

\subsection{A subtitle}

\subsubsection{A subsubtitle}

\kant[7-15]

\end{document}

enter image description here

  • Great, thanks! I basically hybridized your answer and esdd's one due to \RedeclareSectionCommands being shorter ;) – Tobias Kienzler Nov 30 '15 at 15:34
  • It's a bit late and probably should go to a separate question, but any chance you know how to have the section titles etc. be aligned with the indented text? – Tobias Kienzler Nov 30 '15 at 15:36
  • @TobiasKienzler I think it can be done, but this would move the numbers much more than 1cm (look at the subsubsections). – egreg Nov 30 '15 at 15:39
  • Good point, so the overall indentation would have to be increased to, say, 2 cm... I think I saw another question about my additional request, but I can't find it right now :-/ – Tobias Kienzler Nov 30 '15 at 15:42
  • ah, I meant this one – Tobias Kienzler Nov 30 '15 at 16:05
2

Setting \leftskip works for normal paragraphs, but not for lists, which require additional tweaking:

\RequirePackage{enumitem}  % If using a custom class, else replace with \usepackage{enumitem}
\AtBeginDocument{  % Or put this after \begin{document}
    \setlength{\leftskip}{10mm}
    \setlist[1]{leftmargin=15mm,labelwidth=5mm}
}

This is probably incomplete, e.g. I haven't tested tables and figures with this yet.

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.