File: latex_elements.py

package info (click to toggle)
gprbuild 2021.0.0.0778b109-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,776 kB
  • sloc: ada: 70,235; makefile: 452; sh: 396; python: 222; ansic: 151; cpp: 89; fortran: 62; xml: 13
file content (64 lines) | stat: -rw-r--r-- 1,284 bytes parent folder | download | duplicates (10)
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
# define some latex elements to be used for PDF output

PAGE_BLANK = r'''
\makeatletter
\def\cleartooddpage{%%
   \cleardoublepage%%
}
\def\cleardoublepage{%%
\clearpage%%
   \if@twoside%%
      \ifodd\c@page%%
         %% nothing to do
      \else%%
         \hbox{}%%
         \thispagestyle{plain}%%
         \vspace*{\fill}%%
         \begin{center}%%
         \textbf{\em This page is intentionally left blank.}%%
         \end{center}%%
         \vspace{\fill}%%
         \newpage%%
         \if@twocolumn%%
            \hbox{}%%
            \newpage%%
         \fi%%
      \fi%%
   \fi%%
}
\makeatother
'''

TOC_DEPTH = r'''
\pagenumbering{arabic}
\setcounter{tocdepth}{3}
'''

TOC_CMD = r'''
\makeatletter
\def\tableofcontents{%%
    \pagestyle{plain}%%
    \chapter*{\contentsname}%%
    \@mkboth{\MakeUppercase{\contentsname}}%%
            {\MakeUppercase{\contentsname}}%%
    \@starttoc{toc}%%
}
\makeatother
'''

TOC = r'''
\cleardoublepage
\tableofcontents
\cleardoublepage\pagestyle{plain}
'''

LATEX_HYPHEN = r'''
\hyphenpenalty=5000
\tolerance=1000
'''


def doc_settings(full_document_name, version):
    return '\n'.join([
        r'\newcommand*{\GNATFullDocumentName}[0]{' + full_document_name + r'}',
        r'\newcommand*{\GNATVersion}[0]{' + version + r'}'])