aboutsummaryrefslogtreecommitdiff
path: root/doc/gost/gost-7-32-headings.sty
blob: a412d4aa2daf5146f58ca9c3e4e390ad12eb2ed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

\ProvidesPackage{gost-7-32-headings}[2022/01/28 GOST 7.32-2017]

\RequirePackage{titlesec}
\RequirePackage{titling}
\RequirePackage{setspace}

\RequirePackage{gost-7-32-counters}

\setcounter{secnumdepth}{5}

%
% Set custom formatting to well-known LaTeX commands: section, subsection and subsubsection
%
\titleformat{\section}[block]{\centering\large\setstretch{1}\bfseries}{\thesection}{0.5em}{}
\titlespacing*{\section}{0cm}{0cm}{0.5cm}
\newcommand{\sectionbreak}{\clearpage}

\titleformat{\subsection}[block]{\normalsize\bfseries}{\thesubsection}{0.5em}{}
\titlespacing{\subsection}{0cm}{0.5cm}{0.5cm}

\titleformat{\subsubsection}[block]{\normalsize\bfseries}{\thesubsubsection}{0.5em}{}
\titlespacing{\subsubsection}{0}{0.5em}{0cm}

\titleformat{\paragraph}[block]{\normalsize\bfseries}{\theparagraph}{0.5em}{}
\titlespacing{\paragraph}{0}{0.5em}{0cm}

\titleformat{\subparagraph}[block]{\normalsize\bfseries}{\subtheparagraph}{0.5em}{}
\titlespacing{\subparagraph}{0}{0.5em}{0cm}

\makeatletter
\let\oldsection\section
\newcommand{\@sectionnostar}[1]{\phantomsection\oldsection*{#1}\addcontentsline{toc}{section}{#1}}
\newcommand{\@sectionstar}[1]{\oldsection{#1}}
\renewcommand{\section}{\sectionbreak\@ifstar{\@sectionnostar}{\@sectionstar}}
\makeatother

%
% Make special headings, that have their own formatting rules:
% - centered
% - all-caps
% - bold
%
% Only three of them must appear in TOC: introduction, conclusion and references
%
\newcommand{\introduction}{
    \addcontentsline{toc}{section}{ВВЕДЕНИЕ}
    \begin{center}
        \bfseries\large
        ВВЕДЕНИЕ
    \end{center}
}

\newcommand{\conclusion}{
    \addcontentsline{toc}{section}{ЗАКЛЮЧЕНИЕ}
    \begin{center}
        \bfseries\large
        ЗАКЛЮЧЕНИЕ
    \end{center}
}

\newcommand{\references}{
    \addcontentsline{toc}{section}{СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ}
    \begin{center}
        \bfseries\large
        СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ
    \end{center}
}

\newcommand{\essay}{
    \begin{center}
        \bfseries\large
        РЕФЕРАТ
    \end{center}
}

\newcommand{\definitions}{
    \begin{center}
        \bfseries\large
        ОПРЕДЕЛЕНИЯ
    \end{center}
}

\newcommand{\abbreviations}{
    \begin{center}
        \bfseries\large
        ОБОЗНАЧЕНИЯ И СОКРАЩЕНИЯ
    \end{center}
}

\newcommand{\defsabbrs}{
    \begin{center}
        \bfseries\large
        ОПРЕДЕЛЕНИЯ, ОБОЗНАЧЕНИЯ И СОКРАЩЕНИЯ
    \end{center}
}

%
% Appendices headings. Appendices have autoincrementing number, 
% that is represented with russian letter.
% This heading must appear in TOC
%
\newcounter{appendixcnt}
\setcounter{appendixcnt}{1}

\renewcommand{\appendix}[1]{
    \addcontentsline{toc}{section}{ПРИЛОЖЕНИЕ \AlphRus{appendixcnt}. #1}
    \begin{center}
        \bfseries\large
        ПРИЛОЖЕНИЕ \AlphRus{appendixcnt}
        
        #1
    \end{center}
    \stepcounter{appendixcnt}
}