[FIX] содержание: убран дублирующий заголовок, добавлен tocloft
This commit is contained in:
@@ -9,13 +9,14 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
UNNUMBERED = {
|
UNNUMBERED = {
|
||||||
"АННОТАЦИЯ",
|
"АННОТАЦИЯ",
|
||||||
"СОДЕРЖАНИЕ",
|
|
||||||
"ПЕРЕЧЕНЬ ПРИНЯТЫХ СОКРАЩЕНИЙ",
|
"ПЕРЕЧЕНЬ ПРИНЯТЫХ СОКРАЩЕНИЙ",
|
||||||
"ВВЕДЕНИЕ",
|
"ВВЕДЕНИЕ",
|
||||||
"ЗАКЛЮЧЕНИЕ",
|
"ЗАКЛЮЧЕНИЕ",
|
||||||
"СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ",
|
"СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TOC_HEADING = "СОДЕРЖАНИЕ"
|
||||||
|
|
||||||
NEWPAGE_BEFORE = {
|
NEWPAGE_BEFORE = {
|
||||||
"ВВЕДЕНИЕ",
|
"ВВЕДЕНИЕ",
|
||||||
"ЗАКЛЮЧЕНИЕ",
|
"ЗАКЛЮЧЕНИЕ",
|
||||||
@@ -32,6 +33,9 @@ def heading(r: Renderer) -> str:
|
|||||||
r.current_heading = text.upper()
|
r.current_heading = text.upper()
|
||||||
r.pos += 2
|
r.pos += 2
|
||||||
|
|
||||||
|
if text.upper() == TOC_HEADING:
|
||||||
|
return ""
|
||||||
|
|
||||||
if text.upper() in UNNUMBERED:
|
if text.upper() in UNNUMBERED:
|
||||||
prefix = ""
|
prefix = ""
|
||||||
if text.upper() in NEWPAGE_BEFORE:
|
if text.upper() in NEWPAGE_BEFORE:
|
||||||
@@ -45,15 +49,13 @@ def heading(r: Renderer) -> str:
|
|||||||
r.section += 1
|
r.section += 1
|
||||||
r.subsection = 0
|
r.subsection = 0
|
||||||
r.subsubsection = 0
|
r.subsubsection = 0
|
||||||
num = f"{r.section}. "
|
return f"\\section{{{text}}}"
|
||||||
elif level == 2:
|
elif level == 2:
|
||||||
r.subsection += 1
|
r.subsection += 1
|
||||||
r.subsubsection = 0
|
r.subsubsection = 0
|
||||||
num = f"{r.section}.{r.subsection} "
|
return f"\\subsection{{{text}}}"
|
||||||
elif level == 3:
|
elif level == 3:
|
||||||
r.subsubsection += 1
|
r.subsubsection += 1
|
||||||
num = f"{r.section}.{r.subsection}.{r.subsubsection} "
|
return f"\\subsubsection{{{text}}}"
|
||||||
else:
|
else:
|
||||||
num = ""
|
return f"\\textbf{{{text}}}"
|
||||||
|
|
||||||
return f"\\textbf{{{num}{text}}}"
|
|
||||||
|
|||||||
@@ -49,9 +49,39 @@ PREAMBLE = r"""\documentclass[a4paper, 14pt]{extarticle}
|
|||||||
\usepackage[perpage]{footmisc}
|
\usepackage[perpage]{footmisc}
|
||||||
\usepackage{tabularx}
|
\usepackage{tabularx}
|
||||||
\usepackage{titlesec}
|
\usepackage{titlesec}
|
||||||
|
\renewcommand{\thesection}{\arabic{section}}
|
||||||
|
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
|
||||||
|
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
|
||||||
|
\titleformat{\section}{\fontsize{14pt}{18pt}\selectfont\bfseries}{}{0em}{\thesection.\quad}
|
||||||
|
\titleformat{\subsection}{\fontsize{14pt}{18pt}\selectfont\bfseries}{}{0em}{\thesubsection.\quad}
|
||||||
|
\titleformat{\subsubsection}{\fontsize{14pt}{18pt}\selectfont\bfseries}{}{0em}{\thesubsubsection.\quad}
|
||||||
\titlespacing*{\section}{1.25cm}{0.5ex plus 0.2ex minus 0.2ex}{0.3ex plus 0.1ex minus 0.1ex}
|
\titlespacing*{\section}{1.25cm}{0.5ex plus 0.2ex minus 0.2ex}{0.3ex plus 0.1ex minus 0.1ex}
|
||||||
\titlespacing*{\subsection}{1.25cm}{0.5ex plus 0.2ex minus 0.2ex}{0.3ex plus 0.1ex minus 0.1ex}
|
\titlespacing*{\subsection}{1.25cm}{0.5ex plus 0.2ex minus 0.2ex}{0.3ex plus 0.1ex minus 0.1ex}
|
||||||
\titlespacing*{\subsubsection}{1.25cm}{0.5ex plus 0.2ex minus 0.2ex}{0.3ex plus 0.1ex minus 0.1ex}
|
\titlespacing*{\subsubsection}{1.25cm}{0.5ex plus 0.2ex minus 0.2ex}{0.3ex plus 0.1ex minus 0.1ex}
|
||||||
|
\usepackage{tocloft}
|
||||||
|
\addto\captionsrussian{%
|
||||||
|
\renewcommand{\contentsname}{СОДЕРЖАНИЕ}%
|
||||||
|
}
|
||||||
|
\renewcommand{\cfttoctitlefont}{\hfill\fontsize{14pt}{18pt}\selectfont\bfseries}
|
||||||
|
\renewcommand{\cftaftertoctitle}{\hfill\null}
|
||||||
|
\setlength{\cftbeforesecskip}{0pt}
|
||||||
|
\renewcommand{\cftsecaftersnum}{.}
|
||||||
|
\renewcommand{\cftsubsecaftersnum}{.}
|
||||||
|
\renewcommand{\cftsubsubsecaftersnum}{.}
|
||||||
|
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
|
||||||
|
\renewcommand{\cftdotsep}{1}
|
||||||
|
\cftsetpnumwidth{0.7em}
|
||||||
|
\cftsetrmarg{1em}
|
||||||
|
\renewcommand{\cftsecfont}{\mdseries}
|
||||||
|
\renewcommand{\cftsecpagefont}{\mdseries}
|
||||||
|
\renewcommand{\cftsubsecfont}{\mdseries}
|
||||||
|
\renewcommand{\cftsubsubsecfont}{\mdseries}
|
||||||
|
\setlength{\cftsecindent}{0em}
|
||||||
|
\setlength{\cftsecnumwidth}{1em}
|
||||||
|
\setlength{\cftsubsecindent}{0em}
|
||||||
|
\setlength{\cftsubsecnumwidth}{1.5em}
|
||||||
|
\setlength{\cftsubsubsecindent}{0em}
|
||||||
|
\setlength{\cftsubsubsecnumwidth}{2.1em}
|
||||||
|
|
||||||
\newcommand{\sigline}[3][4cm]{%
|
\newcommand{\sigline}[3][4cm]{%
|
||||||
\begin{tabular}[t]{@{}c@{}}%
|
\begin{tabular}[t]{@{}c@{}}%
|
||||||
|
|||||||
Reference in New Issue
Block a user