aboutsummaryrefslogtreecommitdiff
path: root/doc/diploma/gost
diff options
context:
space:
mode:
Diffstat (limited to 'doc/diploma/gost')
-rw-r--r--doc/diploma/gost/gost-7-32-bibliography.sty57
-rw-r--r--doc/diploma/gost/gost-7-32-captions.sty33
-rw-r--r--doc/diploma/gost/gost-7-32-counters.sty43
-rw-r--r--doc/diploma/gost/gost-7-32-headings.sty105
-rw-r--r--doc/diploma/gost/gost-7-32-lists.sty23
-rw-r--r--doc/diploma/gost/gost-7-32-tables.sty31
-rw-r--r--doc/diploma/gost/gost-7-32-toc.sty54
-rw-r--r--doc/diploma/gost/gost-7-32.cls62
8 files changed, 408 insertions, 0 deletions
diff --git a/doc/diploma/gost/gost-7-32-bibliography.sty b/doc/diploma/gost/gost-7-32-bibliography.sty
new file mode 100644
index 0000000..dca60fa
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-bibliography.sty
@@ -0,0 +1,57 @@
1\ProvidesPackage{gost-7-32-bibliography}[2022/01/28 GOST 7.32-2017]
2
3\def\UrlBreaks{\do\/\do-}
4\RequirePackage{url}
5
6\newdimen\bibindent
7\renewenvironment{thebibliography}[1]{
8 \chapter*{\bibname}\addcontentsline{toc}{chapter}{\bibname}%
9 \list{\@biblabel{\@arabic\c@enumiv}}%
10 {\settowidth\labelwidth{\@biblabel{#1}}%
11 \leftmargin\labelwidth
12 \advance\leftmargin\labelsep
13 \@openbib@code
14 \usecounter{enumiv}%
15 \let\p@enumiv\@empty
16 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
17 \sloppy\clubpenalty4000\widowpenalty4000%
18 \sfcode`\.\@m
19}{
20 \setcounter{totalbib}{\c@enumiv}%
21 \def\@noitemerr
22 {\@latex@warning{Empty `thebibliography' environment}}%
23 \endlist
24}
25\renewcommand\@biblabel{}%
26\setlength\bibindent{1.5em}
27
28% Точки после номеров в библиографии. Несовместимо с natbib! -- Коротков И.
29%\makeatletter
30\renewcommand*{\@biblabel}[1]{\hfill#1.}
31
32
33%
34% Remove References header completely
35% Stolen from original article.cls
36%
37\makeatletter
38\renewenvironment{thebibliography}[1]{%
39% \usection{\refname}%
40% \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
41 \list{\@biblabel{\@arabic\c@enumiv}}%
42 {\settowidth\labelwidth{\@biblabel{#1}}%
43 \leftmargin\labelwidth
44 \advance\leftmargin\labelsep
45 \@openbib@code
46 \usecounter{enumiv}%
47 \let\p@enumiv\@empty
48 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
49 \sloppy
50 \clubpenalty4000
51 \@clubpenalty \clubpenalty
52 \widowpenalty4000%
53 \sfcode`\.\@m}
54 {\def\@noitemerr
55 {\@latex@warning{Empty `thebibliography' environment}}%
56 \endlist}
57\makeatother
diff --git a/doc/diploma/gost/gost-7-32-captions.sty b/doc/diploma/gost/gost-7-32-captions.sty
new file mode 100644
index 0000000..b086953
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-captions.sty
@@ -0,0 +1,33 @@
1\ProvidesPackage{gost-7-32-captions}[2022/01/28 GOST 7.32-2017]
2
3\RequirePackage{caption}
4\RequirePackage{subcaption}
5\RequirePackage{capt-of}
6
7%
8% Table caption aligned to the left with dash as a separator
9%
10\captionsetup[table]{labelsep=endash, skip=0.5em, justification=raggedright, singlelinecheck=off}
11
12%
13% Dash as separator in figure caption and centering
14%
15\captionsetup[figure]{labelsep=endash, justification=centering}
16
17%
18% Listing caption
19%
20\captionsetup[listing]{labelsep=endash, skip=0.5em, singlelinecheck=off, position=above}
21
22\addto\captionsrussian{\renewcommand{\figurename}{Рис.}}
23\addto\captionsrussian{\renewcommand{\lstlistingname}{Рис.}}
24%% \addto\captionsrussian{\captionsetup[listing]{name=Рис.}}
25
26%% NOTE(cmmm): breaks 'figure' counter
27%% \makeatletter
28%% \AtBeginDocument{%
29%% \let\c@figure\c@listing
30%% \let\thefigure\thelisting
31%% \let\ftype@listing\ftype@figure
32%% }
33%% \makeatother
diff --git a/doc/diploma/gost/gost-7-32-counters.sty b/doc/diploma/gost/gost-7-32-counters.sty
new file mode 100644
index 0000000..07c88af
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-counters.sty
@@ -0,0 +1,43 @@
1\ProvidesPackage{gost-7-32-counters}[2022/01/29 GOST 7.32-2017]
2
3%
4% Values for capital russian letters counter
5%
6\makeatletter
7\newcommand\AlphRus[1]{%
8 \expandafter \@AlphRus \csname c@#1\endcsname
9}
10
11\newcommand\@AlphRus[1]{%
12 \ifcase #1%
13 \or А\or Б\or В\or Г\or Д\or Е\or Ж\or И\or К\or
14 Л\or М\or Н\or П\or Р\or С\or Т\or У\or Ф\or
15 Х\or Ц\or Ш\or Щ\or Э\or Ю\or Я%
16 \else \@ctrerr
17\fi
18}
19\makeatother
20
21%
22% Values for lowercase russian letters counter
23%
24\makeatletter
25\newcommand\alphRus[1]{%
26 \expandafter \@alphRus \csname c@#1\endcsname
27}
28
29\newcommand\@alphRus[1]{%
30 \ifcase #1%
31 \or а\or б\or в\or г\or д\or е\or ж\or и\or к\or
32 л\or м\or н\or п\or р\or с\or т\or у\or ф\or
33 х\or ц\or ш\or щ\or э\or ю\or я%
34 \else \@ctrerr
35\fi
36}
37\makeatother
38
39% Increment figure counter when using lstlisting
40\makeatletter
41\let\c@lstlisting\c@figure
42\let\ftype@listings\ftype@figure
43\makeatother
diff --git a/doc/diploma/gost/gost-7-32-headings.sty b/doc/diploma/gost/gost-7-32-headings.sty
new file mode 100644
index 0000000..e30e054
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-headings.sty
@@ -0,0 +1,105 @@
1\ProvidesPackage{gost-7-32-headings}[2022/01/28 GOST 7.32-2017]
2
3\RequirePackage{titlesec}
4\RequirePackage{titling}
5\RequirePackage{setspace}
6
7\RequirePackage{gost-7-32-counters}
8
9%
10% Set custom formatting to well-known LaTeX commands: section, subsection and subsubsection
11%
12\titleformat{\section}[block]{\centering\large\setstretch{1}\bfseries}{\thesection.}{0.5em}{}
13\titlespacing*{\section}{0cm}{0cm}{0.5cm}
14\newcommand{\sectionbreak}{\clearpage}
15
16\titleformat{\subsection}[block]{\normalsize\bfseries\raggedright}{\thesubsection}{0.5em}{}
17\titlespacing{\subsection}{0cm}{0.5cm}{0.5cm}
18
19\titleformat{\subsubsection}[block]{\normalsize\bfseries\raggedright}{\thesubsubsection}{0.5em}{}
20\titlespacing{\subsubsection}{0.0cm}{0.5cm}{0.5cm}
21
22\makeatletter
23\let\oldsection\section
24\newcommand{\@sectionnostar}[1]{\phantomsection\oldsection*{#1}}
25\newcommand{\@sectionstar}[1]{\oldsection{#1}}
26\renewcommand{\section}{\sectionbreak\@ifstar{\@sectionnostar}{\@sectionstar}}
27
28\let\oldsubsection\subsection
29\newcommand{\@subsectionnostar}[1]{\phantomsubsection\oldsubsection*{#1}}
30\newcommand{\@subsectionstar}[1]{\oldsubsection{#1}}
31\renewcommand{\subsection}{\@ifstar{\@subsectionnostar}{\@subsectionstar}}
32\makeatother
33
34%
35% Make special headings, that have their own formatting rules:
36% - centered
37% - all-caps
38% - bold
39%
40% Only three of them must appear in TOC: introduction, conclusion and references
41%
42\newcommand{\introduction}{
43 \addcontentsline{toc}{section}{ВВЕДЕНИЕ}
44 \begin{center}
45 \bfseries\large
46 ВВЕДЕНИЕ
47 \end{center}
48}
49
50\newcommand{\conclusion}{
51 \addcontentsline{toc}{section}{ЗАКЛЮЧЕНИЕ}
52 \begin{center}
53 \bfseries\large
54 ЗАКЛЮЧЕНИЕ
55 \end{center}
56}
57
58\newcommand{\references}{
59 \addcontentsline{toc}{section}{СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ}
60 \begin{center}
61 \bfseries\large
62 СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ
63 \end{center}
64}
65
66\newcommand{\essay}{
67 \begin{center}
68 \bfseries\large
69 РЕФЕРАТ
70 \end{center}
71}
72
73\newcommand{\definitions}{
74 \begin{center}
75 \bfseries\large
76 ОПРЕДЕЛЕНИЯ
77 \end{center}
78}
79
80\newcommand{\abbreviations}{
81 \begin{center}
82 \bfseries\large
83 ОБОЗНАЧЕНИЯ И СОКРАЩЕНИЯ
84 \end{center}
85}
86
87\newcommand{\defsabbrs}{
88 \begin{center}
89 \bfseries\large
90 ОПРЕДЕЛЕНИЯ, ОБОЗНАЧЕНИЯ И СОКРАЩЕНИЯ
91 \end{center}
92}
93
94%
95% Appendices headings. Appendices have autoincrementing number,
96% that is represented with russian letter.
97% This heading must appear in TOC
98%
99\newcounter{appendixcnt}
100\setcounter{appendixcnt}{1}
101
102\renewcommand{\appendix}[1]{
103 \addcontentsline{toc}{section}{ПРИЛОЖЕНИЕ \AlphRus{appendixcnt}. #1}
104 \stepcounter{appendixcnt}
105}
diff --git a/doc/diploma/gost/gost-7-32-lists.sty b/doc/diploma/gost/gost-7-32-lists.sty
new file mode 100644
index 0000000..3b2a47e
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-lists.sty
@@ -0,0 +1,23 @@
1\ProvidesPackage{gost-7-32-lists}[2022/01/28 GOST 7.32-2017]
2
3\RequirePackage[inline]{enumitem}
4\RequirePackage{gost-7-32-counters}
5
6\AddEnumerateCounter*{\alphRus}{\c@alphRus}{1}
7
8%% \setlist{nosep, labelindent=\parindent}
9\setlist{nosep}
10
11\setlist[itemize, 1]{label=\textendash}
12\setlist[itemize, 2]{label=\textbullet}
13\setlist[itemize, 3]{label=\textbullet}
14
15\setlist[enumerate, 2]{label=\alphRus*)}
16
17\newlist{displayitem}{itemize*}{1}
18\setlist[displayitem]{
19 before={\unskip:\newline\vspace*{\itemsep}\hspace*{\dimexpr\labelindent+\leftmargin-\labelsep-\labelwidth\relax}},
20 itemjoin={;\newline\vspace*{\itemsep}\hspace*{\dimexpr\labelindent+\leftmargin-\labelsep-\labelwidth\relax}},
21 label={\textendash},
22 after={\unskip.\endgraf\noindent},
23}
diff --git a/doc/diploma/gost/gost-7-32-tables.sty b/doc/diploma/gost/gost-7-32-tables.sty
new file mode 100644
index 0000000..c3954c3
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-tables.sty
@@ -0,0 +1,31 @@
1\ProvidesPackage{gost-7-32-tables}[2022/01/28 GOST 7.32-2017]
2
3\RequirePackage{booktabs}
4\RequirePackage{xltabular}
5\renewcommand\tabularxcolumn[1]{m{#1}} % for vertical centering text
6
7%
8% Center-aligned column with automatic width
9%
10\newcolumntype{C}{>{\centering\arraybackslash}X}
11
12%
13% Right-aligned column with automatic width
14%
15\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
16
17%
18% Table with designations
19%
20\newenvironment{designations}{
21 \noindent
22 \tabularx{\textwidth}{@{}
23 >{\raggedright \arraybackslash \hsize=0.25\hsize}X
24 >{\centering \arraybackslash \hsize=0.05\hsize}X
25 >{\arraybackslash \hsize=0.70\hsize}X
26 }
27}{
28 \endtabularx
29}
30
31\newcommand{\designation}[2]{#1 &---& #2. \\}
diff --git a/doc/diploma/gost/gost-7-32-toc.sty b/doc/diploma/gost/gost-7-32-toc.sty
new file mode 100644
index 0000000..0f03386
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32-toc.sty
@@ -0,0 +1,54 @@
1\ProvidesPackage{gost-7-32-toc}[2022/01/28 GOST 7.32-2017]
2
3\RequirePackage{tocloft}
4\RequirePackage[
5 bookmarks=true,
6 colorlinks=true,
7 unicode=true,
8 urlcolor=black,
9 linkcolor=black,
10 anchorcolor=black,
11 citecolor=black,
12 menucolor=black,
13 filecolor=black,
14 hidelinks
15]{hyperref}
16
17\RequirePackage{etoolbox}
18
19\addto\captionsrussian{%
20 \renewcommand{\contentsname}{СОДЕРЖАНИЕ}%
21}
22
23% Intercept \section* to inject a hyperref anchor right at its location
24\makeatletter
25\pretocmd{\@ssect}{\phantomsection}{}{}
26\makeatother
27
28%
29% Set custom font styles
30%
31\renewcommand{\cftsecfont}{\normalfont}
32\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
33\renewcommand{\cftsecpagefont}{\normalsize}
34\renewcommand{\cftaftertoctitle}{\hfill\hfill}
35\renewcommand{\cfttoctitlefont}{\hfill\normalfont\large\bfseries}
36\titleformat{\tableofcontents}[block]{\centering\large\bfseries}{\thesection}{0.5em}{}
37\titlespacing{\tableofcontents}{0cm}{0cm}{1cm}
38
39% \renewcommand{\cftsecpresnum}{Глава }
40% \renewcommand{\cftsecaftersnum}{.}
41% \renewcommand{\cftsubsecaftersnum}{.}
42% \renewcommand{\cftsubsubsecaftersnum}{.}
43%
44% Set indents and line spacing
45%
46\cftsetindents{sec}{0pt}{3em}
47\cftsetindents{subsec}{0pt}{3em}
48\cftsetindents{subsubsec}{0pt}{3em}
49% \setlength{\cftsecindent}{0pt}
50% \setlength{\cftsubsecindent}{0pt}
51% \setlength{\cftsubsubsecindent}{0pt}
52\setlength{\cftbeforesecskip}{0cm}
53\setlength{\cftbeforesubsecskip}{0cm}
54\setlength{\cftbeforesubsubsecskip}{0cm}
diff --git a/doc/diploma/gost/gost-7-32.cls b/doc/diploma/gost/gost-7-32.cls
new file mode 100644
index 0000000..912e5c6
--- /dev/null
+++ b/doc/diploma/gost/gost-7-32.cls
@@ -0,0 +1,62 @@
1\NeedsTeXFormat{LaTeX2e}
2\ProvidesClass{gost-7-32}[2022/01/28 GOST 7.32-2017]
3
4%
5% Supported font sizes: 12pt, 14pt
6%
7\DeclareOption{12pt}{\PassOptionsToClass{\CurrentOption}{extarticle}}
8\DeclareOption{14pt}{\PassOptionsToClass{\CurrentOption}{extarticle}}
9
10\ProcessOptions\relax
11
12%
13% Set A4 paper format
14%
15\LoadClass[a4paper]{extarticle}
16
17%
18% Use 1.5 line spacing
19%
20\RequirePackage{setspace}
21\onehalfspacing
22% \singlespacing % or \setstretch{1} for 1 line spacing
23
24%
25% First paragraph indentation
26%
27\RequirePackage{indentfirst}
28\setlength{\parindent}{12.5mm}
29
30%
31% Page margin
32%
33\RequirePackage[
34 left=3cm,
35 right=1cm,
36 top=2cm,
37 bottom=2cm,
38 footskip=1cm,
39]{geometry}
40
41%
42% Use TMR-like font
43%
44\RequirePackage{fontspec}
45\RequirePackage{xunicode}
46\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase,Mapping=tex-text}
47\setmainfont{Times New Roman}
48
49%
50% Use russian language
51%
52\RequirePackage[main=russian, english]{babel}
53
54%
55% gost-7-32 packages
56%
57\RequirePackage{gost-7-32-headings}
58\RequirePackage{gost-7-32-toc}
59\RequirePackage{gost-7-32-lists}
60\RequirePackage{gost-7-32-bibliography}
61\RequirePackage{gost-7-32-captions}
62\RequirePackage{gost-7-32-tables}