on master help sign in
TechDoc/TechDoc.cls
472 lines 13 kB history raw
1% creator: ilyakooo0
2% extra credit: dashared
3% version: 1.0.4
5\NeedsTeXFormat{LaTeX2e}
7\ProvidesClass{TechDoc}
9\LoadClass[a4paper, 12pt]{article}
11\RequirePackage{geometry}
12\RequirePackage{listings}
13\RequirePackage{fancyhdr}
14\RequirePackage{setspace}
15\RequirePackage{titlesec}
16\RequirePackage{graphicx}
17\RequirePackage[T2A]{fontenc}
18\RequirePackage[utf8]{inputenc}
19\RequirePackage[unicode]{hyperref}
20\RequirePackage{array}
21\RequirePackage{color}
22\RequirePackage{textcomp}
23\RequirePackage{lastpage}
24\RequirePackage{longtable}
25\RequirePackage{multirow}
26\RequirePackage{indentfirst}
27\RequirePackage{enumitem}
28\RequirePackage{tocloft}
29\RequirePackage{caption}
30\RequirePackage{etoolbox}
31\RequirePackage{iflang}
33\setcounter{secnumdepth}{4}
35\titleformat{\paragraph}
36{\normalfont\normalsize\bfseries}{\theparagraph}{0mm}{.~}
37\titlespacing*{\paragraph}
38{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
40%% Languages
42\AddEnumerateCounter{\asbuk}{\@asbuk}{\cyrm}
43\renewcommand{\theenumi}{(\asbuk{enumi})}
44\renewcommand{\labelenumi}{\asbuk{enumi})}
47\setenumerate[1]{label={\arabic*)}}
48\setenumerate[2]{label={--}}
49\setenumerate[3]{label={\asbuk*)}}
51\DeclareUnicodeCharacter{306}{{\color{red} \textbf{По всей видимости либо ты откуда-то не очень хорошо скопировал, либо у тебя с вводом что-то не то, потому что буква Й у тебя состоит из двух скаляров юникода. Удали этот Й и напечатай его заново. (Выйди и зайди нормально)} }}
53\RequirePackage[russian,english]{babel}
55\titlelabel{\thetitle.~}
57\lstset{
58 basicstyle=\small\ttfamily,
59 tabsize=4,
60 breaklines=true,
61 columns=flexible
64\hypersetup{
65 colorlinks,
66 citecolor=black,
67 filecolor=black,
68 linkcolor=black,
69 urlcolor=black,
70 unicode=true
73\geometry{left=20mm, right=10mm, top=25mm, bottom=25mm, headheight=25mm}
75\DeclareCaptionLabelSeparator{emdash}{ --- }
76\captionsetup{
77 justification=centering,
78 singlelinecheck=false,
79 labelsep=emdash
83 %% Header
85\pagestyle{fancy}
86\fancyhf{}
87\fancyhead[C]{
88\begin{tabular}{c}
89 \thepage \\ \@documentCode
90\end{tabular}
92\renewcommand\headrulewidth{0pt}
94\newcommand{\@foot}{
95 \vspace{-7mm}
96 \footnotesize{
97 \begin{tabular}{|p{0.30\linewidth}|p{0.14\linewidth}|p{0.15\linewidth}|p{0.14\linewidth}|p{0.14\linewidth}|}
98 \hline
99 & & & & \\ \hline
100 \IfLanguageName{english}{Change}{Изм.} & \IfLanguageName{english}{Page}{Лист} & \IfLanguageName{english}{Document num.}{\textnumero~докум.} & \IfLanguageName{english}{Signature}{Подп.} & \IfLanguageName{english}{Date}{Дата}\\
101 \hline
102 \footnotesize{\@documentCode}& & & &\\
103 \hline
104 \IfLanguageName{english}{inv. num. of orig.}{Инв. \textnumero~подл.} & \IfLanguageName{english}{Sig. and date}{Подп. и дата} & \IfLanguageName{english}{inv. num.}{Взам. инв. \textnumero} & \IfLanguageName{english}{inv. num. of copy}{Инв. \textnumero~дубл.}& \IfLanguageName{english}{Sig. and date}{Подп. и дата} \\
105 \hline
106 \end{tabular}
107 }
110\cfoot{
111\@foot
114\setcounter{page}{2}
116%% TOC
118\tocloftpagestyle{fancy}
119\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
121\setcounter{tocdepth}{2}
123%% Title page
125\renewcommand{\@title}{\color{red}{TODO}}
126\renewcommand{\title}[1]{
127 \renewcommand{\@title}{#1}
130\newcommand{\@institute}{
131 \IfLanguageName{english}
132 {national research university\\<<higher school of economics>>}
133 {правительство российской федерации\\
134 национальный исследовательский университет \\
135 «высшая школа экономики»}}
136\newcommand{\institute}[1]{
137 \renewcommand{\@institute}{#1}
140\newcommand{\@faculty}{
141 \IfLanguageName{english}
142 {Faculty of Computer Science}
143 {Факультет компьютерных наук\\
144 Департамент программной инженерии}}
145\newcommand{\faculty}[1]{
146 \renewcommand{\@faculty}{#1}
149\newcommand{\@academicTeacherTitle}{{\color{red}{TODO}}}
150\newcommand{\@academicTeacherName}{{\color{red}{TODO}}}
151\newcommand{\academicTeacher}[2]{
152 \renewcommand{\@academicTeacherTitle}{#1}
153 \renewcommand{\@academicTeacherName}{#2}
156\newcommand{\@academicSupervisorName}{\IfLanguageName{english}{V. V. Shilov}{В. В. Шилов}}
157\newcommand{\@academicSupervisorTitle}{
158 \IfLanguageName{english}
159 {Academic supervisor of the <<software engineering>> programme, PhD}
160 {Академический руководитель образовательной программы «Программная инженерия»
161 профессор департамента программной инженерии, канд. техн. наук}}
162\newcommand{\academicSupervisor}[2]{
163 \renewcommand{\@academicSupervisorTitle}{#1}
164 \renewcommand{\@academicSupervisorName}{#2}
167\newcommand{\@documentTitle}{{\color{red}{TODO}}}
168\newcommand{\documentTitle}[1]{
169 \renewcommand{\@documentTitle}{#1}
172\newcommand{\@documentCode}{{\color{red}{TODO}}}
173\newcommand{\documentCode}[1]{
174 \renewcommand{\@documentCode}{#1}
177\renewcommand{\@author}{{\color{red}{TODO}}}
178\newcommand{\@authorTitle}{{\color{red}{TODO}}}
179\renewcommand{\author}[2]{
180 \renewcommand{\@authorTitle}{#1}
181 \renewcommand{\@author}{#2}
184\newcommand{\@year}{2018}
185\renewcommand{\year}[1]{
186 \renewcommand{\@year}{#1}
189\newcommand{\@city}{\IfLanguageName{english}{Moscow}{Москва}}
190\newcommand{\city}[1]{
191 \renewcommand{\@city}{#1}
194\newcommand{\@titleTable}{
195\reversemarginpar\marginpar{\rotatebox{90}{\begin{tabular}{|p{25mm}|p{35mm}|p{25mm}|p{25mm}|p{35mm}|}
196 \hline
197 \rule{0mm}{5mm}\IfLanguageName{english}{inv. num. of orig.}{Инв. \textnumero~подл} & \IfLanguageName{english}{Sig. and date}{Подп. и дата} & \IfLanguageName{english}{inv. num}{Взам. инв. \textnumero}& \IfLanguageName{english}{inv. num. of copy}{Инв. \textnumero~дубл.}&\IfLanguageName{english}{Sig. and date}{Подп. и дата}\\
198 \hline
199 \rule{0mm}{7mm}& & & & \\
200 \hline
201\end{tabular}}}
204\titleformat{\subsection}{\normalfont\large\bfseries\raggedright}{\thesubsection.~}{0mm}{}
205\titleformat{\subsubsection}{\normalfont\normalsize\bfseries\raggedright}{\thesubsubsection.~}{0mm}{}
206\titleformat{\paragraph}{\normalfont\normalsize\bfseries\raggedright}{\theparagraph.~}{0mm}{}
208\newcommand{\@startAdditions}{
209 \setcounter{section}{0}
210 \renewcommand{\sectionbreak}{}
211 \titleformat{\section}[block]{\Large\bfseries\filcenter}{}{0mm}{}
212 \renewcommand{\@startAdditions}{}
215\newcounter{@tempSection}
217\newcommand{\addition}[1]{%
218 \clearpage
219 \newpage
220 \@startAdditions
221 \stepcounter{section}
222 \begin{flushright}
223 \Large \textbf{\textsc{\IfLanguageName{english}{appendix}{приложение} \asbuk{section}}}
224 \end{flushright}
225 \setcounter{@tempSection}{\arabic{section}}
226 \setcounter{secnumdepth}{0}
227 \section[Приложение \Asbuk{@tempSection}]{#1}
228 \setcounter{secnumdepth}{4}
231\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
233\newcommand{\@LU}{
234 \begin{center}
235 \textsc{\textbf{\@institute}}
236 \par\vspace{5mm}
237 \upshape\mdseries
238 \@faculty
240 \par\vspace{10mm}
242 \begin{tabular}[h!]{P{0.45\textwidth} P{0.45\textwidth}}
244 \textit{\IfLanguageName{english}{COORDINATED}{СОГЛАСОВАНО}} & \textsl{\IfLanguageName{english}{APPROVED}{УТВЕРЖДАЮ}}\\
245 & \\
246 \@academicTeacherTitle & \@academicSupervisorTitle \\
247 & \\
248 \underline{\hspace{4cm}} \@academicTeacherName & \underline{\hspace{4cm}} \@academicSupervisorName \\
249 <<\underline{\hspace{1cm}}>> \underline{\hspace{3cm}} \@year{} \IfLanguageName{english}{}{г.} & <<\underline{\hspace{1cm}}>> \underline{\hspace{3cm}} \@year{} \IfLanguageName{english}{}{г.}\\
250 \end{tabular}
253 \vspace{15mm}
254 {\LARGE{\textsc{\textbf{\MakeLowercase{\@title}}}}}
256 \vspace{6mm}
258 \textbf{\@documentTitle}
260 \vspace{6mm}
262 \textbf{\textsc{\IfLanguageName{english}{Approval Sheet}{Лист Утверждения}}}
264 \vspace{6mm}
266 \textbf{\@documentCode{}-ЛУ}
268 \end{center}
271 \vfill
272 \hfill
273 \begin{tabular}{c}
274 \\
275 \IfLanguageName{english}{Author}{Исполнитель}: \@authorTitle
276 \\
277 \underline{\hspace{4cm}} \@author
278 \\
279 <<\underline{\hspace{1cm}}>> \underline{\hspace{4cm}} \@year\IfLanguageName{english}{}{~г.}
280 \end{tabular}
282 \@titleTable
284 \vspace{30mm}
286 \begin{center}
287 \@city~\@year
288 \end{center}
290 \vspace{-20mm}
293\newcommand{\noLU}{
294 \renewcommand{\@LU}{}
297\renewcommand{\maketitle}{
298 \pagestyle{empty}
299 \clearpage
301 \begin{titlepage}
303 \@LU
305 \newpage
307 \textbf{\textsc{\IfLanguageName{english}{Approved}{Утверждён}}}
309 \textbf{\@documentCode{}-ЛУ}
311 \vspace{40mm}
313 \begin{center}
314 {\LARGE{\textsc{\textbf{\MakeLowercase{\@title}}}}}
316 \vspace{6mm}
318 \textbf{\@documentTitle}
320 \vspace{6mm}
322 \textbf{\@documentCode}
324 \vspace{6mm}
326 \textbf{\IfLanguageName{english}{\pageref{LastPage} pages}{Листов \pageref{LastPage}}}
328 \end{center}
330 \vfill
332 \@titleTable
334 \vspace{80mm}
336 \begin{center}
337 \@city~\@year
338 \end{center}
340 \vspace{-20mm}
342 \end{titlepage}
344 \pagestyle{fancy}
346 \setcounter{page}{2}
350\newcommand{\registrationList}{%
351 \clearpage
352 \newpage
354 \@startAdditions
356 % \setcounter{secnumdepth}{0}
357 \section*{\IfLanguageName{english}{Change registration sheet}{Лист регистрации изменений}}
358 % \setcounter{secnumdepth}{4}
360 \cfoot{}
362 \begin{tabular}{|p{0.05\linewidth}|p{0.04\linewidth}|p{0.06\linewidth}|p{0.06\linewidth}|p{0.06\linewidth}|p{0.1\linewidth}|p{0.1\linewidth}|p{0.12\linewidth}|p{0.05\linewidth}|p{0.05\linewidth}|}
364 \hline
365 \multirow{2}{*}{\IfLanguageName{english}{\shortstack[l]{Cha-\\nge}}{Изм.}} & \multicolumn{4}{c|}{\IfLanguageName{english}{Page number}{Номера листов}} & \IfLanguageName{english}{Total number of pages}{Всего листов в документе} & \IfLanguageName{english}{Document number}{\textnumero{} доку-мента} & \IfLanguageName{english}{Number of accompanying documents and date}{Входящий \textnumero{} сопрово-дит.~докум. и дата} & \IfLanguageName{english}{Sig-na-ture}{Под-пись} & \IfLanguageName{english}{Date}{Дата} \\ [5ex] \cline{2-5}
366 & \IfLanguageName{english}{Mo-di-fied}{из-ме-нен-ных} & \IfLanguageName{english}{Re-pla-ced}{заме-нен-ных} & \IfLanguageName{english}{Ad-ded}{но-вых} & \IfLanguageName{english}{An-nul-led}{анну-лиро-ван-ных} & & & & & \\[10ex]
367 \hline
368 & & & & & & & & & \\[5ex]
369 \hline
370 & & & & & & & & & \\[5ex]
371 \hline
372 & & & & & & & & & \\[5ex]
373 \hline
374 & & & & & & & & & \\[5ex]
375 \hline
376 & & & & & & & & & \\[5ex]
377 \hline
378 & & & & & & & & & \\[5ex]
379 \hline
380 & & & & & & & & & \\[5ex]
381 \hline
382 & & & & & & & & & \\[5ex]
383 \hline
384 & & & & & & & & & \\[5ex]
385 \hline
386 & & & & & & & & & \\[5ex]
387 \hline
388 & & & & & & & & & \\[5ex]
389 \hline
390 & & & & & & & & & \\[5ex]
391 \hline
392 & & & & & & & & & \\[5ex]
393 \hline
394 \end{tabular}
396 \newpage
397 \cfoot{
398 \@foot
399 }
403%% Code
405\newcommand{\programmingLanguage}[1]{
406 \lstset{language=#1}
409%% [#1]: ref id
410%% #2: file
411%% #3: caption
412\newcommand{\floatCode}[3][]{
413\begin{figure}[hbp]
414 \lstinputlisting [frame=single] {#2}
415 \ifblank{#3}{}{\caption{#3}}
416 \ifblank{#1}{}{\label{#1}}
417\end{figure}
420\newcommand{\code}[1]{%
421 \lstinputlisting[frame=single,basicstyle=\footnotesize\ttfamily]{#1}
424\renewcommand{\code}[2]{%
425 \lstinputlisting [frame=single, basicstyle=\footnotesize\ttfamily, caption={#2}, captionpos=b] {#1}
428\newcommand{\lcode}[1]{
429 \begin{lstlisting}%
430#1
431 \end{lstlisting}%
434% [#1]: caption
435% #2: file
436% #3: label
437\newcommand{\image}[3][]{
438\begin{figure}[hbp]
439 \includegraphics{#2}
440 \ifblank{#1}{}{\caption{#1}}
441 \ifblank{#3}{}{\label{#3}}
442\end{figure}
445\newcommand{\img}[1]{%
446 \begin{figure}[b]%
447 \centering%
448 \includegraphics[width=0.6\textwidth,height=0.6\textheight,keepaspectratio]{#1}%
449 \caption{}%
450 \label{#1}%
451 \end{figure}%
452 \ref{#1}%
454\newcommand{\imgs}[2]{%
455 \begin{figure}[bp]%
456 \centering%
457 \includegraphics[width=0.45\textwidth,height=0.45\textwidth,keepaspectratio]{#1}%
458 \hspace{0.05\textwidth}%
459 \includegraphics[width=0.45\textwidth,height=0.45\textwidth,keepaspectratio]{#2}%
460 \caption{}%
461 \label{#1=#2}%
462 \end{figure}%
463 \ref{#1=#2}%
466\titleformat{\section}[block]{\Large\bfseries\filcenter}{\thesection.}{0mm}{~}
468\newcommand{\sectionsAreChapters}{
469 \titleformat{\section}[block]{\Large\bfseries\filcenter}{\IfLanguageName{english}{Chapter}{Глава} \thesection.}{0mm}{~}
472\newcommand{\sectionbreak}{\clearpage}