
Я пытаюсь создать подпункт и подпункт подпункта. Подпункт подпункта работает нормально, но подпункт подпункта дает мне странные результаты в моем Оглавлении.
Вот мой код:
\documentclass[parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{titlesec}
\makeatletter
\titleclass{\subsubparagraph}{straight}[\subparagraph]
\titleformat{\subsubparagraph}{\normalfont\normalsize\bfseries}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}.\arabic{subsubparagraph}}{1em}{}
\titlespacing{\subsubparagraph}{0pt}{-3.25ex plus-1ex minus-.2ex}{1.25ex plus .1ex}
\newcounter{subsubparagraph}[subparagraph]
\titlespacing{\subparagraph}{0pt}{-3.25ex plus-1ex minus-.2ex}{1.25ex plus .1ex}
\titleclass{\subsubsubparagraph}{straight}[\subparagraph]
\titleformat{\subsubsubparagraph}{\normalfont\normalsize\bfseries}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}.\arabic{subsubparagraph}.\arabic{subsubparagraph}}{1em}{}
\titlespacing{\subsubsubparagraph}{0pt}{3.25ex plus-1ex minus-.2ex}{1.25ex plus .1ex}
\newcounter{subsubsubparagraph}[subsubparagraph]
\renewcommand\thesubsubparagraph {\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}.\arabic{subsubparagraph}}%
\setcounter{secnumdepth}{8}
\setcounter{tocdepth}{8}
\newcommand*\l@subsubparagraph{\@dottedtocline{7}{12em}{2em}}
\newcommand*\l@subsubsubparagraph{\@dottedtocline{8}{17em}{2em}}
\begin{document}
\setcounter{tocdepth}{10}
\setcounter{secnumdepth}{10}
\tableofcontents
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\subparagraph{Subparagraph}
\subsubparagraph{Subsubparagraph}
\subsubsubparagraph{Subsubparagraph}
\end{document}
Заголовок подпункта пересекается с нумерацией.
Как я могу это исправить?
решение1
Обратите внимание, что пакет titlesec
нарушает некоторые функции KOMA-Script. Поэтому не рекомендуется использовать этот пакет вместе с scrartcl
.
Вы можете использовать \DeclareNewSectionCommands
и \RedeclareSectionCommand
:
\documentclass[parskip=full]{scrartcl}[2016/05/10]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\DeclareNewSectionCommands[
style=section,
level=\subparagraphnumdepth+1,
beforeskip=-3.25ex plus -1ex minus -.2ex,
afterskip=1.25ex plus .1ex,
counterwithin=subparagraph,
font={},
indent=0pt,
toclevel=\subparagraphtocdepth+1,
tocnumwidth=6em
]{subsubparagraph,subsubsubparagraph}
\RedeclareSectionCommand[
tocindent=12em
]{subsubparagraph}
\RedeclareSectionCommand[
tocindent=14em
]{subsubsubparagraph}
\setcounter{secnumdepth}{\subsubsubparagraphnumdepth}
\setcounter{tocdepth}{\subsubsubparagraphtocdepth}
\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
Text
\paragraph{Paragraph}
Text
\subparagraph{Subparagraph}
Text
\subsubparagraph{Subsubparagraph}
Text
\subsubsubparagraph{Subsubsubparagraph}
Text
\end{document}
Результат:
Как вы можете видеть на изображении paragraph
и subparagraph
являются встроенными заголовками. Отрицательное значение afterskip
устанавливает горизонтальный пропуск, что приводит к встроенному заголовку. Поэтому, если заголовки для новых определенных уровней также должны быть встроенными заголовками, используйте . Но если после и afterskip=-1em
должен быть вертикальный пробел, измените их на положительное значение, например:paragraph
subparagraph
afterskip
\RedeclareSectionCommands[
afterskip=1.25ex plus .1ex
]{paragraph,subparagraph}