summaryrefslogtreecommitdiffstats
path: root/common/rtemsstyle.sty
blob: e55bb932ea52169479061ef829dc60d7b5a6bab8 (plain) (blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
\definecolor{TitleColor}{rgb}{0,0,0}
\definecolor{InnerLinkColor}{rgb}{0,0,0}
\definecolor{OuterLinkColor}{rgb}{1.0,0.5,0.0}

\newenvironment{underscoresplit}{\let\underscore\_
  \renewcommand{\_}{\discretionary{\underscore}{}{\underscore}}}{}

\let\oldtabulary\tabulary
\let\endoldtabulary\endtabulary

\renewenvironment{tabulary}{\underscoresplit\oldtabulary}{\endoldtabulary\endunderscoresplit}

\let\oldprintindex\printindex

\renewenvironment{printindex}{\underscoresplit\oldprintindex}

\usepackage{minted}
\fvset{
breaklines=true,
breakanywhere=true,
linenos,
numbersep=5pt,
gobble=0,
}

\renewcommand{\maketitle}{%
  \begin{titlepage}%
    \let\footnotesize\small
    \let\footnoterule\relax
    \ifsphinxpdfoutput
      \begingroup
      % This \def is required to deal with multi-line authors; it
      % changes \\ to ', ' (comma-space), making it pass muster for
      % generating document info in the PDF file.
      \def\\{, }
      \pdfinfo{
        /Author (\@author)
        /Title (\@title)
      }
      \endgroup
    \fi
    \begin{flushright}%
      %\sphinxlogo%
      {\center
        \vspace*{3cm}
      	\includegraphics{logo.pdf}
        \vspace{3cm}
	\par
        {\rm\Huge \@title \par}%
        {\em\LARGE \py@release\releaseinfo \par}
        {\large
          \copyright Copyright \rtemscopyright \par
         \py@authoraddress \par
        }}%
    \end{flushright}%\par
    \@thanks
  \end{titlepage}%
  \cleardoublepage%
  \setcounter{footnote}{0}%
  \let\thanks\relax\let\maketitle\relax
  %\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
}

\fancypagestyle{normal}{
  \fancyhf{}
  \fancyfoot[LE,RO]{{\thepage}}
  \fancyfoot[LO]{{\nouppercase{\rightmark}}}
  \fancyfoot[RE]{{\nouppercase{\leftmark}}}
  \fancyhead[LE,RO]{{\@title, \py@release}}
  \fancyhead[RE,LO]{{\chaptername\:\thechapter\:Section\:\thesection}}
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.4pt}
}

\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[LE,RO]{{\thepage}}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0.4pt}
}

\titleformat{\section}{\Large}%
            {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor}
\titleformat{\subsection}{\large}%
            {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
\titleformat{\subsubsection}{}%
            {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
\titleformat{\paragraph}{\large}%
            {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor}

\ChNameVar{\raggedleft\normalsize}
\ChNumVar{\raggedleft \bfseries\Large}
\ChTitleVar{\raggedleft \rm\Huge}

\usepackage{enumitem}
\setlist[description]{style=nextline,leftmargin=10pt}

\let\oldsection\section
\renewcommand\section{\clearpage\oldsection}

\usepackage{titlesec}
\setcounter{secnumdepth}{8}

\renewcommand\thepart{\@Roman\c@part}
\renewcommand\part{%
   \pagestyle{normal}
   \if@noskipsec \leavevmode \fi
   \cleardoublepage
   \vspace*{6cm}%
   \@afterindentfalse
   \secdef\@part\@spart}

% fonts
\usepackage{charter}
\usepackage{rtemsextrafonts}

\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    {\parindent \z@ %\center
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >\m@ne
       \rm\Large \partname~\thepart
       \par\nobreak
     \fi
     \MakeUppercase{\rm\Huge #2}%
     \markboth{}{}\par}%
    \nobreak
    \vskip 8ex
    \@afterheading}
\def\@spart#1{%
    {\parindent \z@ %\center
     \interlinepenalty \@M
     \normalfont
     \huge \bfseries #1\par}%
     \nobreak
     \vskip 3ex
     \@afterheading}