📜 ⬆️ ⬇️

Bachelor's degree in LaTeX, or DSTU 3008-95 in 150 lines

image
Hello. Recently, I was also overtaken by a turning point in student life - a bachelor thesis. Among the many formal details of this remarkable phenomenon, norm control is particularly noticeable. No, I understand and strongly support that standards are necessary , including standards for the design of an academic text. Just our standards, unlike Western ones, are quite idiotic. They do not save either ink or paper, they do not simplify the search for literature on the nomenclature, and complicate the reading of the name. Not to mention that the text of the standard is designed and described by people working in the editor Microsoft Word. Again, I have nothing against Word, it is a powerful system. But the technical text in it is inconvenient to type, and in terms of flexibility, it loses many times to the immortal creation of Donald Knut - LaTeX.

So, my diploma writing began with the fact that I spent 4 hours on setting up the preamble under the norms of the Ukrainian design standard DSTU 3008-95. As far as I know, it almost completely corresponds to the Russian GOST. I knew that there were ready-made solutions (for example, disser ), but after a couple of samples I preferred to customize every detail on my own. For training. The training was a success - I learned the abyss of new things about LaTeX, this monster cannot be fully learned :-)

Under the cut, I will fully describe the process of setting up each specific detail and using them when writing, as well as various trivia, simplifying the writing of the diploma even more. Immediately I warn you: somewhere my decisions may seem crutches. Somewhere they are not too universal. I know, understand, accept and welcome criticism and suggestions in the comments ;-)

Stocking


Let's start with the blank. I assume that you have installed the distribution kit ( MiKTeX on Windows or any similar on Linux / Mac) and configured PsCyr Cyrillic fonts according to the instructions . Do not forget to include the installation of additional packages "on the fly" - you will need a lot of them :)
')
The standard involves writing the entire text in 14 font Times New Roman with one and a half intervals. The last one is Microsoft Word terminology :) To create its analogue in LaTeX, we connect the extsizes package, which adds 14pt to the document class parameters, and configure everything else as written below:
\ documentclass [ a4paper,14pt,russian ]{ extreport }

\usepackage { extsizes }
\usepackage { cmap } % pdf
\usepackage [ T2A ]{ fontenc }
\usepackage [ utf8 ]{ inputenc }
\usepackage [ russian ]{ babel }
\usepackage { pscyr }

\usepackage { graphicx } %
\usepackage { amssymb,amsfonts,amsmath,amsthm } %
\usepackage { indentfirst } %
\usepackage [ usenames,dvipsnames ]{ color } %
\usepackage { makecell }
\usepackage { multirow } %
\usepackage { ulem } %

\linespread { 1.3 } %
\renewcommand { \rmdefault }{ ftm } % Times New Roman
\frenchspacing

\begin { document }

\end { document }
The installation of \linespread{1.3} (increase the line spacing by 1.3 times) approximately corresponds to what the Word world calls the “one and a half spacing”. The cmap package includes in the resulting PDF (I use pdfLaTeX) a symbol table, so that it becomes possible to copy and search Cyrillic text in PDF without distorting the encodings. As for the source files, I store them in UTF-8 encoding; for your usual settings, change the value of the parameter during inputenc . I will comment on the purpose of the remaining packages a little later, when I will discuss directly the writing of the diploma, and not the preamble with the design.

Pagination


Pagination should be in the upper right corner. In my case, it begins with # 5, since the first 4 pages are occupied by the title page, the task sheet, the calendar plan, and other bureaucracy. Forms for them were sent to doc / docx, and they are much easier to print as is, rather than waste time simulating this design in LaTeX;)

fancyhdr connect the fancyhdr package, designed for the designation of page headers and footers, and turn off all defaults in it. The page becomes absolutely clean, except for the number ( \thepage ) in the right corner of the header.
\usepackage { fancyhdr }
\pagestyle { fancy }
\fancyhf { }
\fancyhead [ R ]{ \thepage
}
\fancyheadoffset { 0mm }
\fancyfootoffset { 0mm }
\setlength { \headheight }{ 17pt }
\renewcommand { \headrulewidth }{ 0pt }
\renewcommand { \footrulewidth }{ 0pt }
\fancypagestyle { plain }{
\fancyhf {
}
\rhead { \thepage
}}
\setcounter { page }{ 5 } % â„–5
It is worth noting that the first page of the chapter (chapter) uses the plain page style by default. It also has to be redefined in terms of fancyhdr , so that numbers are put on the first pages of chapters (see the \fancypagestyle ).

Captions under images and tables


Let's set up the signature format, for which we first of all enable the caption package. Since I love detailed illustrations with several interconnected parts, we will also include the subcaption package. According to the standard, the name of the picture is located below the picture, and the name of the table is above the table. You will have to keep track of these locations by yourself (see below), but the package can be prompted about this law so that it optimizes the allocation of empty space accordingly.
\usepackage [ tableposition=top ]{ caption }
\usepackage { subcaption }
\DeclareCaptionLabelFormat { gostfigure }{ #2 }
\DeclareCaptionLabelFormat { gosttable }{ #2 }
\DeclareCaptionLabelSeparator { gost }{ ~---~ }
\captionsetup { labelsep=gost }
\captionsetup [ figure ]{ labelformat=gostfigure }
\captionsetup [ table ]{ labelformat=gosttable }
\renewcommand { \thesubfigure }{ \asbuk { subfigure }}
Here, using the \DeclareCaptionLabelFormat new custom signature format is set up, which is then assigned to all the figures and tables in the document. Its first parameter # 1 is the standard text of the label (I preferred not to configure it as a separate line, but to write explicitly without using # 1), the second parameter # 2 is the figure / table number.
\DeclareCaptionLabelSeparator adjusts the separator between the caption label and its text itself, which you specify. In our case, this is the middle dash.

We should also comment on the last line. Since I sometimes divide illustrations into subparts, which allows us to make a package subfigure , these subparts must be numbered. It is accepted to number them in small letters in order - however, in our case it should be Cyrillic letters, not Latin! The Cyrillic representation of the counters (by analogy with the well-known representations of arabic , roman , latin , etc.) has already been implemented in the babel package. It is called, respectively, \asbuk for small Cyrillic letters, and \Asbuk for large.

I will give an example of a typical design of the picture:
\begin { figure }[ ht ]
\centering
\begin { subfigure }[ b ]{ 0.3 \textwidth }
\centering
$$ \begin { array }{ l }
F \to x \ ;| \ ; y \ ;| \ ; (S) \\
T \to F \ ;| \ ; T \ast F \\
S \to T \ ;| \ ; S + T \\
\end { array } $
$
\ caption { }
\end { subfigure
} %
\begin { subfigure }[ b ]{ 0.6 \textwidth }
\centering
\includegraphics [ scale=0.7 ]{ parseTree.png }
\ caption { }
\end { subfigure
}

\ caption { (a) $G$ ;
() $x+y \ast y$ $G$ .
}
\ label { fig_parsetree }
\end { figure }
And tables:
\begin { table }[ ht ]
\ caption { }
\ label { tab_weight }
\centering
\begin { tabular }{ |c|c|c|c|c|c|c|c|c| }
\ hline \multirow { 2 }{ * }{ $x_i$ } & \multicolumn { 4 }{ c| }{ $x_j$ } &
\multicolumn { 2 }{ c| }{ } & \multicolumn { 2 }{ c| }{ } \\
\cline { 2-9 } & $X_1$ & $X_2$ & $X_3$ & $X_4$ & $w_i$ &
${ K_ \text { }} _i$ & $w_i$ & ${ K_ \text { }} _i$ \\
\ hline $X_1$ & 1 & 1 & 1.5 & 1.5 & 5 & 0.31 & 19 & 0.32 \\
\ hline $X_2$ & 1 & 1 & 1.5 & 1.5 & 5 & 0.31 & 19 & 0.32 \\
\ hline $X_3$ & 0.5 & 0.5 & 1 & 0.5 & 2.5 & 0.16 & 9.25 & 0.16 \\
\ hline $X_4$ & 0.5 & 0.5 & 1.5 & 1 & 3.5 & 0.22 & 12.25 & 0.20 \\
\ hline \multicolumn { 5 }{ |c| }{ : } & 16 & 1 & 59.5 & 1 \\
\ hline
\end { tabular }
\end { table }
It is worth noting the use of the \multirow and \multicolumn commands to create beautiful tables. They correspond to the HTML <table> parameters: rowspan and colspan , respectively. True, the first requires the connection of the multirow package.

The result of the design is shown below.
For the picture:


For the table:


Headlines


Headings according to DSTU 3008-95 standard are just a song. Or rather, a sad thought. All the requirements for aligning the headings were decorated by a certain creative soul in terms of Word: one line is missing, two lines are here, and there is a one and a half interval, and here is double ... As a result, after some time spent trying to come up with a beautiful solution, I had to pick up all constants indents and spacing manually and hardcoding them in pixel points. I believe that this is the most disgusting programming style to which I resorted for my entire “career”. Although in this case LaTeX has nothing to do with programming :)

To format the header use the package titlesec . According to the standard, chapters (the same sections) are written in the center, preceded by the line “Chapter N”, and the subsections and paragraphs are numbered within the chapter, and aligned by paragraph indent. Everything is typed in bold, with chapter headings also in upper case.

Title \titleformat configured by the \titleformat . She has the following options:

These commands allow you to achieve all the necessary design, except for the mandatory capitalization of the text of the title of the chapter. The \MakeUppercase works exclusively with one parameter, and it cannot be used like \bffamily to switch the print format "from now and forever to the end of the group". Thus, I was able to apply it to capitalize the title tags (the words “Chapter” or “Appendix”), but I had to print the caption text myself. Do not worry, pressing the Forbidden Button several times was not so scary :)
\usepackage { titlesec }

\titleformat { \chapter }[ display ]
{ \filcenter }
{ \MakeUppercase { \chaptertitlename } \thechapter }
{ 8pt }
{ \bfseries }{ }

\titleformat { \section
}
{ \normalsize \bfseries }
{ \thesection }
{ 1em }{ }

\titleformat { \subsection
}
{ \normalsize \bfseries }
{ \thesubsection }
{ 1em }{ }

%
\titlespacing* { \chapter }{ 0pt }{ -30pt }{ 8pt }
\titlespacing* { \section }{ \parindent }{ *4 }{ *4 }
\titlespacing* { \subsection }{ \parindent }{ *4 }{ *4 }
Notice the \parindent in the indentation setting for subsections, forcing them to align by paragraph indent.

And this is how it all looks like when printing ordinary \chapter and \section :


Fields


Setting the page margins is the easiest of today's tasks:
\usepackage { geometry }
\geometry { left=3cm }
\geometry { right=1.5cm }
\geometry { top=2.4cm }
\geometry { bottom=2.4cm }


Lists


The requirements for lists in the standard are as follows:

Unfortunately, LaTeX loves to surround the itemize and enumerate environments itemize huge amount of space, creating a special inter-paragraph indent for them. To overcome this vicious habit, you can use the enumitem package and give it the nolistsep option, which disables all additional indents. However, enumitem does not know anything about the new representation of asbuk counters, which I mentioned above, so you need to point it at the command \AddEnumerateCounter . Its third parameter is an example of the widest representation (the package will be oriented to this width when printing). For some reason (groundlessly) it seems to me that the widest letter of the Cyrillic alphabet in Times New Roman is exactly “m”. In any case, a person who creates a numbered list from “a” to “m” or below, deserves close attention of health authorities, as for me :)
\usepackage { enumitem }
\ makeatletter
\AddEnumerateCounter { \asbuk }{ \@asbuk }{ ) }
\ makeatother
\setlist { nolistsep }
\renewcommand { \labelitemi }{ - }
\renewcommand { \labelenumi }{ \asbuk { enumi } ) }
\renewcommand { \labelenumii }{ \arabic { enumii } ) }


Table of contents


The table of contents is the second most painful stage of the preamble setting process. It has to be set up according to the model, the standard is not too verbose about it. The consequence of setting the pattern is another pile of “magic constants” among the intervals.

The list of various trifles that should be considered includes:

Fortunately, there is a tocloft package. I am not going to copy his documentation into the text of this note, it includes countless commands that literally customize every pixel in the table of contents. All these commands are substitutions in the style of "but type this between the text of the subsection title and the beginning of the dotted line." I use in the preamble 9 such commands, which, by and large, customize the look of the table of contents:
\usepackage { tocloft }
\renewcommand { \cfttoctitlefont }{ \hspace { 0.38 \textwidth } \bfseries \MakeUppercase }
\renewcommand { \cftbeforetoctitleskip }{ -1em }
\renewcommand { \cftaftertoctitle }{ \ mbox { } \hfill \\ \ mbox { } \hfill { \footnotesize . } \vspace { -2.5em }}
\renewcommand { \cftchapfont }{ \normalsize \bfseries \MakeUppercase { \chaptername } }
\renewcommand { \cftsecfont }{ \hspace { 31pt }}
\renewcommand { \cftsubsecfont }{ \hspace { 11pt }}
\renewcommand { \cftbeforechapskip }{ 1em }
\renewcommand { \cftparskip }{ -1mm }
\renewcommand { \cftdotsep }{ 1 }
\setcounter { tocdepth }{ 2 } % — subsection
These commands set up all the necessary little things from the above list, except for one. Special sections will have to be treated in a special way.

Special sections (abstract, introduction, list of abbreviations, conclusions, references)

The listed sections are designed especially. First, each of them begins with a new page. This is not a problem - \newpage knows the \newpage command. Secondly, their title is drawn up in the center of the page in bold upper case letters ... and separated from the text by two lines. And finally, on top of this nonsense, special sections are in the table of contents at the chapter level, but they are not numbered and are not chapters. Feel like someone had nothing to do?

The command \chapter* is not suitable for obvious reasons: the chapters started by it are not included in the table of contents. In addition, you need to somehow arrange a double line break before the text - well, do not write the same \newline manually every time?

We're not looking for easy ways. I decided to create my own section view. As it turned out, this is not so difficult.
To define a section (I called it likechapter ), for a start it is worth defining the appropriate design command. Arrange the centering and capitalization of the section name - just spit. What I did - the \likechapterheading prints the section name passed to it as it should.
\newcommand { \empline }{ \ mbox { } \newline }
\newcommand { \likechapterheading }[ 1 ]{
\begin { center
}
\ textbf { \MakeUppercase { #1 }}
\end { center }
\empline }
However, the section must also be included in the table of contents and aligned to the level of the chapter. And here it is already necessary to twist a little.

Theoretically, adding a new line to the table of contents is done with the \addcontentsline . It has three parameters:
  1. The type of list to add a line to. In our case, this is toc - table of contents (table of contents).
  2. The level at which to place the line.
  3. String text to add.

With the first and third everything is clear. But as a second one, one cannot simply write “chapter”, since the obliging tocloft , which we set up a little higher, will type the word “Chapter” in front of the line. Only one way out - go to the end and define your own section level.

When LaTeX prints a certain level in the table of contents, it calls the internal command \l@XXX , where XXX is the name of the level (chapter, section, etc.). This command has two parameters - header text and page number. The purpose of the command is to print directly the table of contents with a dotted line, indents and all relying. If we want to define our own level view, we only need to define such a command for our level name. Then, in processing the command, \addcontentsline will look at its second parameter, find among its definitions the corresponding \l@XXX , where XXX is the substituted second parameter, and thus will finish printing the line in the table of contents.

It remains to define the command \l@likechapter (simultaneously setting up for it the period between points in the dotted line, as in tocloft ), and to finish the definition of the \likechapter :
\ makeatletter
\renewcommand { \@dotsep }{ 2 }
\newcommand { \l @likechapter }[ 2 ]{ { \bfseries \@dottedtocline { 0 }{ 0pt }{ 0pt }{ #1 }{ #2 }}}
\ makeatother
\newcommand { \likechapter }[ 1 ]{
\likechapterheading { #1
}
\addcontentsline { toc }{ likechapter }{ \MakeUppercase { #1 }}}

Now you can and look at the result of works. Here is the beginning of the table of contents:


There is no special section to show, I suppose. This is just bold capitalized text centered on the page, printed using the \likechapter{} .

Bibliography


When making links to sources, I decided not to use BibTeX, which I regretted a thousand times later. The need to carefully manually arrange all these slashes, periods, commas and a dash when describing the next issue of the magazine simply kills. But, unfortunately, I did not use BibTeX before, and the desire to end the preamble was already exhausted with setting up its design. It's a pity.

By the way, I am sure that already configured BibTeX files in the already mentioned disser project almost completely solve this problem.

But for now, here we are looking specifically at my preamble. For the layout of the list of references, I used the good old environment of thebibliography and the \bibitem in their pure form. For their small setup, it was necessary to do the following:
\usepackage [ square,numbers,sort&compress ]{ natbib }
\renewcommand { \bibnumfmt }[ 1 ]{ #1. \hfill } % —
\renewcommand { \bibsection }{ \likechapter { }} %
\setlength { \bibsep }{ 0pt }
Now the heading "List of references" is made out like likechapter, and is appropriately placed in the table of contents. The natbib package beautifully compresses numbers when referring to something like "[2, 6-9]".

Counter of pages, pictures, tables, sources


The standard requires that the abstract to work begin with the line "Thesis: 107 p., 14 fig., 19 tab., 2 applications, 28 sources". Naturally, LaTeX would not be the best layout system of modernity if it did not have the means of automatically counting all these quantities and inserting the necessary number into the text with a command.

Let's start with the pages. Here the situation is easiest: we include the lastpage package, and in the text we simply refer to the new LastPage tag LastPage by it using \pageref* :
\usepackage { lastpage }
% ...
: \pageref * { LastPage } ~., ...

With the figures and tables could help package totcount , which was written for such purposes - to count the number of different objects in the document. Unfortunately, as of now, it has a serious drawback: counters are usually reset at the end of each chapter with non-through numbering, so the output in the case of a document like report rather than article is not the total number of drawings, but only the number of drawings in last chapter. The author is notified of the bug, but while it works, it was necessary to find a workaround.

The recipe was found in the vast StackOverflow. We define our own counter for each type of objects, and then we write the value of this counter into the aux-file (at the end of the compilation, with the \AtEndDocument ). At the next compilation, it will be taken from the file, and the command determined by us will substitute the necessary number into the text. Thus, after two launches of pdfLaTeX, we get the text with the correct counter value.
\newcounter { totfigures }
\newcounter { tottables }
\ makeatletter
\AtEndDocument { %
\addtocounter { totfigures }{ \value { figure }} %
\addtocounter { tottables }{ \value { table }} %
\immediate \write \@mainaux { %
\string \gdef \string \totfig { \number \value { totfigures }} %
\string \gdef \string \tottab { \number \value { tottables }} %
} %
}
\ makeatother
% ...
: \pageref * { LastPage } ~., \totfig ~., \tottab ~...

This solution has a fatal flaw: you have to manually increase the counter value on each figure or table. You can slightly simplify your life by adding to the counter the number of figures / tables only at the end of each chapter (from the corresponding system counter), but you will still have a copy-paste on the code. This process, however, can be automated.

Automation is engaged in the etoolbox package. In it (among other things) there is a wonderful command \pretocmd , which allows you to assign some additional code to the definition of any command in front. In this case, we want the value of the counter to change before any call \chapter .
\usepackage { etoolbox }
\pretocmd { \chapter }{ \addtocounter { totfigures }{ \value { figure }}}{ }{ }
\pretocmd { \chapter
}{ \addtocounter { tottables }{ \value { table }}}{ }{ }
I note that manually changing the counter commands still has to be called twice. Once at the very end of the document (see above \AtEndDocument ). And once before the start of applications that are classified as chapters, but not called up using \chapter (see below).

Finally, you can do the same with sources: define a counter, automatically increment it and dump it into aux-file at the end of the compilation. Only this time the command \bibitem will have to \bibitem :
\newcounter { totreferences }
\pretocmd { \bibitem }{ \addtocounter { totreferences }{ 1 }}{ }{ }

Now, do not forget to add the same line to the \AtEndDocument (see above):
\string \gdef \string \totref { \number \value { totreferences }} %
and you can write in the text " \totref ~ sources ..."

Applications


With applications had to tinker. First of all, because of the table of contents: it was impossible to configure the tocloft so that it printed the word “Chapter” for the chapter, and the word “Appendix” for the application, despite the fact that it is stated as \chapter . At the same time, printing the necessary word in the title itself is obtained without any problems, thanks to the command \chaptertitlename defined in the package titlesec .

Without further ado, I made a crutch. I decided to design the applications as ... paragraphs. Anyway, I never used the real paragraphs in the text. It was a small matter - to configure the display of \paragraph in the title is identical to \chapter , and add the corresponding line to the table of contents at the level of likechapter.
\usepackage [ title,titletoc ]{ appendix }

\titleformat { \paragraph }[ display ]
{ \filcenter }
{ \MakeUppercase { \chaptertitlename } \thechapter }
{ 8pt }
{ \bfseries }{ }
\titlespacing* { \paragraph
}{ 0pt }{ -30pt }{ 8pt }

\newcommand { \append }[ 1 ]{
\clearpage
\stepcounter { chapter
}
\paragraph { \MakeUppercase { #1 }}
\empline
\addcontentsline { toc }{ likechapter }{ \MakeUppercase { \chaptertitlename ~ \Asbuk { chapter }\ ;#1 }}}

Now it can be used like this:
\begin { appendices }
\renewcommand \thechapter { \Asbuk { chapter }}
\setcounter { chapter }{ 0 }

\append { }
...
\end { appendices }

Pay attention to the intolerable lightness of being: applications are essentially paragraphs, are listed in the table of contents as like adapters, but at the same time, I use chapter counter for counting them, because in fact applications are chapters :) As a representation of a counter \Asbuk taken, since applications are usually numbered in capital Cyrillic letters.

Now more detail on how to arrange each of the two mandatory applications specified in the thesis work of the bachelor.

Appendix A: Illustrative report material

The first mandatory application is the presentation slides. I created the presentation in Microsoft Power Point, here I have no complaints against a great product yet. It may come soon in life a turning point, when I will do the presentation in LaTeX, but so far I'm not at that stage. The main reason is that a large number of formulas in the presentation I type in LaTeX-like markup language, built-in in Microsoft Office versions 2007 and above;)

So, the presentation is ready, saved to the pptx file next to the diploma sources.How would you now automatically insert it into your diploma PDF right when compiled? The method was found, and very simple. Convert the presentation to PDF and paste this PDF inside the generated with the help of a wonderful package pdfpages.

I decided to display two slides per page, surrounded by frames. In the process, we had to take into account two points. Firstly, the pages with the application also need to be numbered - so you need to remember to give commands to the package fancyhdrso that it works on the included pages. Secondly, the first page of the application contains not only the first two slides of the presentation, but also the title “Appendix A”. Both the first and the second difficulty are solved by the parameter pagecommandpresent in the options list of our main team \includepdf. Ready source code:
\usepackage { pdfpages }
% ...
\includepdfset { nup=1x2,frame=true,delta=10mm 10mm,noautoscale=true }
\includepdf [ pages=1-2,scale=0.55,offset=10mm -20mm,pagecommand={ \append { }} ]{ defence.pdf }
\includepdf [ pages=3-,scale=0.55,offset=10mm 0mm,pagecommand={ \fancyhead [ R ]{ \thepage }}]{ defence.pdf }

And the result:


Appendix B: Software Product Code

The inserted source code wants to highlight and print in a small monospaced font so that it does not occupy a good half of the diploma and does not waste paper on itself. In applications this is allowed.

With the backlight of the source code is an excellent package listings. He just needs a little help: specify in which font to print the code (option basicstyle), ask to transfer the words in lines (option breaklines), and correct the set of keywords of the programming language (option morekeywords) - it recognizes C # 2.0, and I wrote in C # 4.0. The package will cope with everything else itself, even load the source code from the file next to it.
\usepackage { listings }
%...
\append { }
\lstset { language= [ Sharp ] C,
morekeywords= { yield,var,get,set,from,select,partial
} ,
breaklines=true,
basicstyle= \footnotesize \ttfamily }
\linespread { 1 } %
\lstinputlisting { MyCoolProjectClass.cs }


Workspace organization


The translation of the DSTU 3008-95 standard on LaTeX is now complete. The last few lines in my preamble relate to how it turned out most convenient to organize work with numerous sections and subsections in the thesis work.

The whole document, of course, is broken down into many files — one tex file per subsection. Each chapter will be stored in a separate subfolder, with the name like chapter_ProgramSynthesis. This folder will chapter_ProgramSynthesis.texcontain a file containing the assembly of subsections of the chapter, the actual files sec_XXX.texwith specific subsections, and all the necessary additional materials (for example, pictures).

To include the chapter file in the body of the main document and allow it, in turn, to include subfiles and search for the path to the materials in its subfolder, use the package import. It has a great command \subimportthat takes two parameters - a folder that temporarily becomes a file search path, and a directly include file. To include chapters in a diploma, we define an auxiliary team, and we can now easily refer to chapters by name.

In the main file diploma.tex:
\usepackage { import }
\newcommand { \includechapter }[ 1 ]{ \subimport { chapter_#1/ }{ chapter_#1 }}
\newcommand { \inputintro }{ \ input { sec_Intro } \newpage }
% ...
\includechapter { ProgramSynthesis }


In the file chapter_ProgramSynthesis/chapter_ProgramSynthesis.tex:
\chapter { PROGRAM SYNTHESIS }

\inputintro
\ input { sec_Basics }
\ input { sec_Stages }
\ input { sec_Example }
\ input { sec_Conclusions }

Files sec_Basics.texand others are in the same subfolder chapter_ProgramSynthesis. The link to the pictures from the same subfolder occurs directly - see the example of the definition of the illustration at the beginning of the article. I determined the

command \inputintrofrom pure perfectionism: since I always call the “Introduction” subsection sec_Intro.texand start a new page after it, why write duplicate code? :-)

Conclusion


At this titanic description of the 150-line preamble can be considered complete. Once again: I do not suppose that all this work should be used in a “pure” form as a standard for compliance with the standard - it is much easier to use ready-made solutions. But I hope that as you read this article, many LaTeX enthusiasts will learn a lot of new interesting tools and opportunities, enrich the piggy bank of tools with useful packages, and, perhaps, take note of another method.

In the end, we love LaTeX precisely for this unlimited power, isn't it? ;) Have a nice layout!

UPD: All along the link .

Source: https://habr.com/ru/post/144648/


All Articles