We continue the topic LaTeX + diploma.
It took me to write a diploma. Time is running out, the requirements are tough. The material is, the text is almost ready, it is necessary to make out. I sat down, thought, and decided that I definitely didn’t want to do manual layout. From the experience of participating in various olympiads, it was recalled that it is better to lose an hour, but to make a decision, which then passes the tests, than to immediately do something and therefore frantically redo it. Plus, I still wanted to do a close study of Latex and the company.
')
Set the task
Initial conditions:
Computer Acer Aspire One. A very good machine for a student, it should be noted. Netbooks in Europe are called student computers.
The operating system is Linpus (read Fedora 8).
Versco's system - Latex in the implementation of teTex, now collapsed.
It is required to receive within a week the text of a diploma drawn up according to all the rules of an educational institution.
The rules of registration are:
- Headset Times New Roman;
- Font size 12pt;
- one and a half interval;
- indent from heading 6pt;
- first level headings (i.e. chapter titles) are turned off in the center;
- headers of subsequent levels are turned off to the left with a mandatory indentation;
- coinciding with the indent of the main text;
- Applications are numbered from 1;
- the words "CONTENTS", "INTRODUCTION" are written in capital letters (ie, literally as it is typed in this sentence);
- all headlines are included in the content.
After a brief analysis, the disser package was chosen as the basis for publication. The most important thing that bribed it was the feeling of integrity and the presence of a file for the build (i.e. Makefile).
Installation
At first, the author wanted to install TeXLive, but it did not work out. For some reason the installer did not start, and since the author is not strong in perl, there was no desire to understand. TeTeX was installed from packages using yum.
It should be noted that this process did not take place quickly, the benefit of GPRS-Internet from Megafon is not a quick pleasure (this is not a stone in the Megaphone garden, but a connotation of fact. GPRS-Internet is slow!)
After that, the disser packages and associated packages were installed from CTAN (www.ctan.org). How were the packages to be installed determined? Experimentally.
The body of the thesis.tex document is written \ usepackage {which_package}, then the command is given
make; make pdf
and checks for an error like "not found what__package.sty". If there is such an error, this package was downloaded from the Internet, installed (with the obligatory execution of the
sudo texhash
) and the process was repeated. I must say that the author has installed quite a lot of packages before understanding what he needs and what you can stop at, so I deliberately do not provide a list of packages that have been installed.
About Wednesday should be said separately.
In my case (ie, in the above configuration), the installation of teTeX occurred in the / usr / share / texmf directory (hereinafter $ TEXMF) with the rights rw-rrr--, i.e. A simple user can only read, but not write. And the installation of Latex packages takes place in the $ TEXMF / tex / latex / directory and on. Therefore, the entire contents of the packages are not available (we do not work as root!) The disser package was installed, respectively, in the $ TEXMF / tex / latex / disser directory, and its documentation in $ TEXMF / doc / latex / disser.
The documentation for the disser package provides examples of various works - PhD, doctoral and master's theses, as well as the work of a bachelor. They are contained in the templates directory. If there was a right to write, then it would be possible to run make directly in the directory, for example, bachelor and get a dvi-file on output.
But since there is no right to write, the examples were copied to the ~ / Documents directory and the work was done there.
Changes were made to the Makefile (the absolute path was specified in the include directive) so that you can make make copies in the copy.
Then the actual layout process began.
Assembly diploma
The text was originally planned for utf-8 encoding, but later it turned out that BiBTeX cannot process library files in this encoding, and it is impossible to combine the two encodings in one project. Maybe this is possible, but the whole project turned out to be cheaper to impose in cp1251.
Typing was done in the geany editor, which required only syntax highlighting and the ability to work in cp1251 encoding. An important fact was the ability to work in full screen mode (all interface elements are disabled, except for the menu bar), since the computer screen is small.
The disser package involves splitting a document into small, logically related portions. So, the introduction and conclusion are in separate files, intro.tex and concl.tex respectively. The chapters are in the files 1.tex, 2.tex, 3.tex, etc. Applications in app-1.tex, app-2.tex, etc.
The document is assembled by specifying the following lines between \ begin {document} and \ end {document} in the thesis.tex (main document) file:
\input{intro}
\input{1}
\input{2}
\input{3}
\input{concl}
\input{app-1}
\input{app-2}
...
The table of contents, according to the requirements, is at the beginning of the document and begins on page 2. The title page for the thesis was issued (printed separately), so there was no need to typeset it and include it in the document. To disable the title page in the title of the document was indicated notitlepage, i.e.
\ documentclass [notitlepage, ...] {disser}
where dots are replaced by other options.
Sheet size is set by the geometry package:
\usepackage[
a4paper, includefoot,
left=3cm, right=1cm, top=2cm, bottom=1.5cm,
headsep=1cm, footskip=1cm
]{geometry}
Header customization
It should be noted that in the disser package, the elements of the text are very well configured; titles of chapters, sections, subsections, etc.
For example, the following commands are available for formatting a chapter name:
\thechapteralign
\thechapterfont
\prethechapter
\postthechapter
\chapteralign
\chapterfont
\beforechapter
\afterchapter
Commands determine the design of different parts of the header: \ thechapteralign - switch off the number, \ thechapterfont - font of the number, \ prethechapter - text before the number, \ postthechapter - text after the number, \ chapteralign - off text of the title, \ chapterfont - font of the text of the title, \ beforechapter - indent to title, \ afterchapter - indent after title.
The same series of commands is also for the design of the title in the table of contents.
A similar setting is made for each level of headings. Details are in the disser.pdf file.
Such a partition allows, for example, to do this:
Chapter 1.
Analysis of the current state
and specify a different design for the number and for the title text.
As a result, the following commands appeared for the diploma in the preamble of the document (only the chapter setting is shown):
\renewcommand{\thechapterfont}{\normalsize\bfseries} %
\renewcommand{\prethechapter}{} % ""
\renewcommand{\postthechapter}{.~} %
\renewcommand{\chapterfont}{\normalsize\bfseries} %
\renewcommand{\tocprethechapter}{} % ""
Recompile and get properly designed chapter headers.
Other headlines
By default, all headers in the disser package are typed in a larger font than the main text. According to the requirements, headings should be typed in the same size as the main text (12), in bold.
Therefore, in the preamble we write:
\renewcommand{\chapterfont}{\normalsize\bfseries}
\renewcommand{\sectionfont}{\normalsize\bfseries}
\renewcommand{\subsectionfont}{\normalsize\bfseries}
\renewcommand{\subsubsectionfont}{\normalsize\bfseries}
\renewcommand{\appendixfont}{\normalsize\bfseries}
Headings of the second and subsequent levels should have the same indention as the main text, i.e. section number should not protrude to the left with respect to paragraph indent.
To do this, we include commands in the preamble (the main text is indented 1 cm)
\renewcommand{\sectionindent}{1cm}
\renewcommand{\subsectionindent}{1cm}
The distance from the title to the text must be at least 6 points:
\renewcommand{\aftersection}{6pt plus .1pt}
Since there were many places in the diploma where several headings of different levels were followed in succession, the author went for a certain violation in favor of the visual component and reduced the size of the indent for the third level headings to three points:
\renewcommand{\aftersubsection}{3pt plus .1pt}
The “plus .1pt” expression allows Latex to slightly move the headings in the vertical direction when the page is being laid out, which on several pages leads to a more attractive result.
Header Text
According to the requirements headings are typed in capital letters. Fix it turned out to be quite simple. In the preamble we indicate
\renewcommand{\introname}{}
\renewcommand{\pretheappendix}{\protect{}~} %
\renewcommand{\tocpretheappendix}{\protect{}~} %
\renewcommand{\conclusionname}{}
For some reason, the "CONTENTS" and "BIBLIOGRAPHIC LIST" had to be inserted into the body of the document, the latter immediately before the bibliography.
Numbering
The diploma in requirements begins with the title page, after which there is a table of contents. The table of contents is printed on page 2 and on. This is done using the command
\setcounter{page}{2}
immediately before \ tableofcontents.
Applications are numbered from number 1. By default, the disser package offers application numbering with the letter “A” (Cyrillic). To change the format of numbers in the preamble, the command is written
\renewcommand{\theappendix}{\arabic{chapter}} %
In addition, the text "APPENDIX 1" is turned off to the right. This is done by the team
\renewcommand{\theappendixalign}{\hfill}
in the preamble. The \ hfill command fills all the free space of a line, “crushing” what stands before and after it in different directions of the line.
Table of contents
The table of contents should include headings of all levels. By default, the disser package includes only chapters and sections in the table of contents. Subsections - not included.
To fix the preamble, add the command
\setcounter{tocdepth}{2}
In the case of the author’s diploma, this was enough, since the headings below the subsection were not used. If this is not the case, then you need to specify 3 or even 4 in the command above.
Text break commands (chapter, section, etc.) have an optional parameter that allows you to specify text that will be included in the table of contents. This is useful for wrapping lines in the case of long headers. Team
\section[ \\]{\\ }
allows you to make different headlines in the text and in the table of contents.
Applications in the table of contents begin with the word "ANNEXES", which refers to the same page as the first application, i.e.
ANNEXES ....................... 51
ANNEX 1. Summary table .... 51
This is done simply. In the text of the first application (in the app-1.tex file) two commands are added to the beginning:
\clearpage
\addcontentsline{toc}{chapter}{}
\ clearpage is needed for the commands \ addcontentsline and \ chapter to be on the same page.
Bibliographic list
The disser package uses the bibtex8 command to generate a bibliography. In the teTeX distribution, this command does not exist, at least in those repositories that are connected by default.
Therefore, the author downloaded the utility source code and compiled it on his own, then placed it in the / usr / bin directory next to the bibtex utility, and put the gost705.bst file used by the disser package in the directory with the diploma.
Font Times New Roman / 12 pt
The normal controller did not miss the default cm-super font. So I had to plug in the PsCyr package in order for the text to be typed by Times New Roman. I categorically do not like this font, but this is a formality, so I had to do it as indicated.
For some reason, when specifying the 12pt option in \ documentclass, Latex refused to change the font size. It was necessary to sequentially (with reassembly of the diploma) specify the font 8pt, 9pt, 11pt and then 12pt. After that, the font has become the right size.
Final provisions
It should be noted that the total time spent on all experiments and setting was about 3 days. This is in view of the fact that the author’s knowledge of Latex had previously been rather superficial.
The author obtained basic information from the books of K. V. Vorontsov “Latex2e in examples”, S.. Lviv's “Set and layout in the Latex system” and, of course, the documentation for the disser package, however scanty it may be.
The advantages of Latex for works of this kind are enormous - the reference device allows you not to care about the order in which the applications, bibliography, tables, figures, etc. go; The work is carried out with simple text files, therefore loss of formatting due to problems inside MS Word / OO Writer is impossible in principle; high printing quality; done transparent work with mathematics.
Problems, of course, also exist, but they are leveled by the advantages: difficulties with formatting long tables, difficult work with drawings, especially large-format ones; not always obvious ways to deal with problem areas in the text (hanging lines, words, overfull, underfull), etc. In general, for quality work in Latex, you need a little more knowledge in printing and programming than with a simple layout in Word / Writer. But it's worth it.
Fish text of the main diploma file using the disser package:
\documentclass[bachelor,subf,12pt,notitlepage]{disser}
\usepackage{pscyr}
\usepackage[
a4paper, mag=1000, includefoot,
left=3cm, right=1cm, top=2cm, bottom=1.5cm, headsep=1cm, footskip=1cm
]{geometry}
\usepackage[T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{multirow}
\usepackage{longtable}
\ifpdf\usepackage[pdftex]{graphicx}\else\usepackage{graphicx}\fi
\usepackage{comment}
\ifpdf\usepackage{epstopdf}\usepackage{pdfpages}\fi
\graphicspath{{fig/}}
\renewcommand{\thechapterfont}{\normalsize\bfseries} %
\renewcommand{\prethechapter}{} % ""
\renewcommand{\postthechapter}{.~} %
\renewcommand{\appendixfont}{\normalsize\bfseries}
\renewcommand{\chapterfont}{\normalsize\bfseries}
\renewcommand{\sectionfont}{\normalsize\bfseries}
\renewcommand{\subsectionfont}{\normalsize\bfseries}
\renewcommand{\subsubsectionfont}{\normalsize\bfseries}
\renewcommand{\tocprethechapter}{} % ""
\renewcommand{\theappendixalign}{\hfill} % ""
\renewcommand{\theappendix}{\arabic{chapter}} %
\renewcommand{\pretheappendix}{\protect{}~} % ""
\renewcommand{\tocpretheappendix}{\protect{}~} % ""
\renewcommand{\introname}{}
\renewcommand{\sectionindent}{1cm}
\renewcommand{\subsectionindent}{1cm}
\renewcommand{\aftersection}{6pt plus .1pt}
\renewcommand{\aftersubsection}{3pt plus .1pt}
\renewcommand{\conclusionname}{}
\renewcommand{\bibname}{ }
\setcounter{tocdepth}{2}
\begin{document}
\setcounter{page}{2}
\renewcommand{\contentsname}{}
% ----------------------------------------------------------------
\tableofcontents
% ----------------------------------------------------------------
\input{intro}
\input{1}
\input{2}
\input{3}
\input{concl}
% ----------------------------------------------------------------
\appendix
\renewcommand{\sectionfont}{\normalsize\bfseries}
\renewcommand{\theappendixfont}{\normalsize\bfseries}
\input{app-1}
\input{app-2}
\input{app-3}
\input{app-4}
\renewcommand{\bibname}{ }
\bibliography{thesis}
\bibliographystyle{gost705}
\end{document}