File: latex_elements.py

package info (click to toggle)
gcc-12-doc 12.2.0-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 26,004 kB
  • sloc: perl: 479; python: 301; makefile: 239; cpp: 17
file content (69 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (8)
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
65
66
67
68
69
# 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
'''

with open('copyright.tex', 'r') as fd:
    copyright = fd.read()

TOC = r'''
\cleardoublepage
%s
\cleardoublepage
\tableofcontents
\cleardoublepage\pagestyle{plain}
''' % copyright

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'}'])