%3F.png)
Мне было интересно, как я могу «разделить» документ Latex на «тома». Окончательное оглавление должно выглядеть примерно так:
Volume 1 2
1. chapter 1 of volume 1 3
2. chapter 2 of volume 2 15
Volume 2 35
1. chapter 1 of volume 2 36
2. chapter 2 of volume 2 40
Следующий код дает мне правильную нумерацию глав, но, к сожалению, части тоже нумеруются
\documentclass[openright]{scrreprt}
% enforces that chapter numbering restarts after each 'part'
\makeatletter\@addtoreset{chapter}{part}\makeatother%
\usepackage{lipsum}% for dummy text
\begin{document}
\tableofcontents
\part{Volume 1}
\chapter{chapter 1 of volume 1}
\lipsum[1-10]
\chapter{chapter 2 of volume 1}
\lipsum[1-10]
% volume 2 starts with its own chapter numbering
\part{Volume 2}
\chapter{chapter 1 of volume 2}
\lipsum[1-10]
\chapter{chapter 2 of volume 2}
\lipsum[1-10]
\end{document}
вот результат:
I. Volume 1 2
1. chapter 1 of volume 1 3
2. chapter 2 of volume 2 15
II. Volume 2 35
1. chapter 1 of volume 2 36
2. chapter 2 of volume 2 40
Вопросы:
- Как избавиться от «I.» и «II.» в оглавлении?
- На каждой странице теперь написано «часть I. Том 1» — как мне избавиться от «части I»?
- есть ли способ настроить вид страницы частей? Для каждой части я хотел бы разместить несколько строк текста ниже
РЕДАКТИРОВАТЬ:
Быстрое и грубое решение вопроса №1:
\documentclass[openright]{scrreprt}
% enforces that chapter numbering restarts after each 'part'
\makeatletter\@addtoreset{chapter}{part}\makeatother%
\renewcommand\partname{Volume}
\usepackage{lipsum}% for dummy text
% show chapter & section in TOC, no subsection
\setcounter{tocdepth}{1}
\begin{document}
\tableofcontents
% don't add Volume 1 to TOC
\part*{this is volume 1}
% add manual entry for volume 1
\addcontentsline{toc}{part}{this is volume 1}
\chapter{chapter 1 of volume 1}
\lipsum[1-10]
\section{sdfg}
\end{document}
решение1
Либо избавляемся от числа, заменив его \part
на \addpart
:
\documentclass[openright]{scrreprt}
\usepackage{lipsum}% for dummy text
\begin{document}
\tableofcontents
\addpart{Volume 1}\setcounter{chapter}{0}
\chapter{chapter 1 of volume 1}
\lipsum[1-10]
\chapter{chapter 2 of volume 1}
\lipsum[1-10]
% volume 2 starts with its own chapter numbering
\addpart{Volume 2}\setcounter{chapter}{0}
\chapter{chapter 1 of volume 2}
\lipsum[1-10]
\chapter{chapter 2 of volume 2}
\lipsum[1-10]
\end{document}
В этом случае вам придется сбросить счетчик глав, поскольку счетчик деталей не увеличится.
Или вы можете заменить part
на volume
:
\documentclass[openright]{scrreprt}
% enforces that chapter numbering restarts after each 'part'
\makeatletter\@addtoreset{chapter}{part}\makeatother%
\renewcommand*{\thepart}{\arabic{part}}
\renewcommand*{\partname}{Volume}
\usepackage{lipsum}% for dummy text
\begin{document}
\tableofcontents
\part[Volume]{}
\chapter{chapter 1 of volume 1}
\lipsum[1-10]
\chapter{chapter 2 of volume 1}
\lipsum[1-10]
% volume 2 starts with its own chapter numbering
\part[Volume]{}
\chapter{chapter 1 of volume 2}
\lipsum[1-10]
\chapter{chapter 2 of volume 2}
\lipsum[1-10]
\end{document}
1 Volume
Но в этом случае у вас вместо этого будет Volume 1
оглавление.
Я бы использовал модифицированное первое решение:
\documentclass[openright]{scrreprt}
\usepackage{lipsum}% for dummy text
\newcommand*{\volume}[1][]{% optional argument: additional text
\cleardoublepage\refstepcounter{part}%
\setpartpreamble{#1}% add this preamble below the heading
\addpart{Volume \thepart}
}
\renewcommand*{\thepart}{\arabic{part}}
% enforces that chapter numbering restarts after each 'part'
\makeatletter\@addtoreset{chapter}{part}\makeatother%
\begin{document}
\tableofcontents
\volume[{\begin{abstract}\lipsum[1]\end{abstract}}]% Volume with additional text below heading.
\chapter{chapter 1 of volume 1}
\lipsum[1-10]
\chapter{chapter 2 of volume 1}
\lipsum[1-10]
\volume
\chapter{chapter 1 of volume 2}
\lipsum[1-10]
\chapter{chapter 2 of volume 2}
\lipsum[1-10]
\end{document}
Для добавления текста ниже \setpartpreamble{…}
использован заголовок детали. scrguien.pdf
Для получения дополнительной информации см. руководство KOMA-Script (страница 91f в текущей версии ).