虽然传递parskip=half
到scrbook
会删除所有缩进,但我(不幸的是)应该将所有内容缩进 10 毫米,但章节/部分/...标题除外。如何最轻松地实现这一点?我考虑尝试一下bcor
和将章节编号放入(假)边距中,但这似乎相当复杂......
编辑添加这个有点晚了,但理想情况下,标题的文本(不是编号)也应该从该缩进开始并对齐,即
+----------¦-----------+------¦---------------+
| 1 A chapter | 3 Another chapter |
| 1.1 A section | some text |
| 1.1.1 A subsection| 3.1 another section |
...
应该回答这个问题尽管。
答案1
第二次更新: 如果章节和部分标题等应该与缩进文本对齐,则可以使用:
\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}
结果:
更新:最好只使用@egreg 在其回答中展示的选项。但如果使用geometry
KOMA-Script 选项,以下代码也有效。chapterprefix
\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}
原始答案:
也许类似的东西
\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}
答案2
你可以使用我之前学到的一个技巧:使用布局功能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}
答案3
该设置\leftskip
适用于普通段落,但不适用于列表,因为列表需要进行额外的调整:
\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}
}
这可能不完整,例如我还没有用这个测试表格和图形。