-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcormensol.sty
More file actions
234 lines (196 loc) · 8.93 KB
/
cormensol.sty
File metadata and controls
234 lines (196 loc) · 8.93 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
\ProvidesPackage{cormensol}
\RequirePackage{fancyhdr}
\RequirePackage{tocloft}
\RequirePackage{titlesec}
\RequirePackage{amsmath}
\RequirePackage{tikz}
% odpowiedni wygląd liczników
\def\thechapter{\arabic{chapter}} % podrozdział
\def\thesection{\bfseries\thechapter.\arabic{section}.} % zadanie
\def\thesubsubsection{(\alph{subsubsection})} % punkt zadania
\def\theparagraph{\thechapter-\arabic{paragraph}} % problem
\def\thesubparagraph{(\alph{subparagraph})} % punkt problemu
% definicje czcionek i separatorów w spisie treści
\renewcommand{\cfttoctitlefont}{\Huge\sffamily\bfseries}
\renewcommand{\cftpartfont}{\large\sffamily\bfseries}
\renewcommand{\cftpartpagefont}{\large\sffamily\bfseries}
\renewcommand{\cftchapaftersnum}{.}
\renewcommand{\cftchapfont}{\sffamily\bfseries}
\renewcommand{\cftchappagefont}{\sffamily\bfseries}
\renewcommand{\cftsecfont}{\sffamily}
\renewcommand{\cftsecleader}{\sffamily\cftdotfill{\cftsecdotsep}}
\renewcommand{\cftsecpagefont}{\sffamily}
\renewcommand{\cftaftertoctitleskip}{3cm}
% zwiększenie pudełka zawierającego numer strony w spisie treści
\renewcommand{\@pnumwidth}{1.7em}
% zwiększenie pudełka zawierającego numer rozdziału w spisie treści
\setlength{\cftchapnumwidth}{1.7em}
% zwiększenie wcięcia numeru podrozdziału w spisie treści
\setlength{\cftsecindent}{1.7em}
% zwiększenie pudełka zawierającego numer podrozdziału w spisie treści
\setlength{\cftsecnumwidth}{2.6em}
% głębokość numerowania wewnątrz spisu treści
\setcounter{tocdepth}{1}
% głębokość numerowania sekcji
\setcounter{secnumdepth}{5}
% definicja zawartości nagłówków i stopek
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\small\sffamily\bfseries #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\small\sffamily\thesection\ {\mdseries #1}}{}}
\fancyhead[LE]{\small\sffamily\bfseries\thepage}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\leftmark}
\fancyhead[RO]{\small\sffamily\bfseries\thepage}
\fancyfoot[C]{}
% zredefiniowanie stylu plain używanego na pierwszych stronach części i rozdziału
\fancypagestyle{plain}{%
\fancyhf{} % usuń wszystkie nagłówki i stopki z tych stron
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
% redefinicja części, która sprawia, że części rozpoczynają się na nieparzystych stronach
\let\originalpart=\part
\def\part{\cleardoublepage\originalpart}
% zmiana wyglądu nagłówka części
\renewcommand{\@part}[2][default]{%
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
{%
\interlinepenalty \@M
\normalfont
\noindent\hskip0pt\leaders\hrule height1pt \hskip10pt plus1filll \hspace{15pt}\huge\sffamily\partname\nobreakspace\bfseries\thepart
\par
\vskip 40\p@
\raggedleft\Huge \bfseries\sffamily #2\par
\vskip 40\p@
\rule{\textwidth}{1pt}
}%
\@endpart%
}
% redefinicja rozdziału, która przywraca styl licznika subsekcji na styl numerów zadań
\let\originalchapter=\chapter
\renewcommand{\chapter}[1]{%
\originalchapter{#1}
\setcounter{subsection}{0}
\def\thesubsection{\thechapter.\arabic{section}-\arabic{subsection}}
\fancyhead[LE]{\small\sffamily\bfseries\thepage}
\fancyhead[LO]{\rightmark}
}
% zmiana wyglądu nagłówka rozdziału
\renewcommand{\@makechapterhead}[1]{%
{%
\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\sffamily \@chapapp\nobreakspace\bfseries\thechapter \hspace{15pt}\null\nobreak\leaders\hrule height1pt \hskip10pt plus1filll\
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries\sffamily #1\par
\vspace{5pt}
\if@mainmatter
\rule{\textwidth}{1pt}
\nobreak
\vskip 20\p@
\else
\nobreak
\vskip 40\p@
\fi
}%
}
% definicja czcionek i odstępów dla section (podrozdziału)
\titleformat{\section}[hang]{\Large\sffamily}{\thesection}{1.6ex}{}
\titlespacing*{\section}{0pt}{2\baselineskip}{0.5\baselineskip}
% definicja czcionek i odstępów dla subsection (rozwiązania zadania)
\titleformat{name=\subsection,page=odd}[runin]{\sffamily\bfseries}{\thesubsection.}{1em}{}
\titleformat{name=\subsection,page=even}[runin]{\sffamily\bfseries}{\thesubsection.}{1em}{}
\titlespacing{\subsection}{0pt}{1.25\baselineskip}{1em}
% pakiet titlesec nie pozwala na ponowną redefinicję formatu dla subsection,
% dlatego problemy będą składane jako paragraph, a punkty problemów jako subparagraph
\titleformat{\paragraph}[hang]{\sffamily\bfseries}{\theparagraph.}{1em}{}
\titlespacing*{\paragraph}{0pt}{1.5\baselineskip}{1em}
\titleformat{\subparagraph}[runin]{\sffamily\bfseries}{\thesubparagraph}{1em}{}
\titlespacing{\subparagraph}{0pt}{\baselineskip}{1em}
% definicja czcionek i odstępów dla subsubsection (podrozwiązania)
\titleformat{\subsubsection}[runin]{\sffamily\bfseries}{\thesubsubsection}{1em}{}
\titlespacing{\subsubsection}{0pt}{\baselineskip}{1em}
% polecenie tworzące podrozdział
\newcommand\subchapter{\section}
% polecenie tworzące rozwiązanie zadania
\newcommand{\exercise}{\subsection{}\label{sol:\thesubsection}}
% polecenie tworzące podrozwiązanie
\newcommand{\subexercise}{\subsubsection{}}
% polecenie rozpoczynające sekcję problemów
\newcommand\problems{%
\section*{\sffamily\mdseries Problemy}
\addcontentsline{toc}{section}{Problemy}
\fancyhead[LE]{\small\sffamily\bfseries\thepage}
\fancyhead[LO]{\small\sffamily Problemy}
}
% polecenie tworzące problem wraz z jego tytułem
\newcommand{\problem}[1]{\paragraph{#1}\label{sol:\theparagraph}}
% polecenie wstawiające podproblem
\newcommand{\subproblem}{\subparagraph{}}
% czcionka tytułu spisu treści
\renewcommand{\contentsname}{\sffamily\bfseries Spis treści}
% czcionka tytułu bibliografii
\renewcommand{\bibname}{\sffamily\bfseries Bibliografia}
% niełamliwy dywiz
\newcommand{\nbhyphen}{\protect\nobreakdash-\hspace{0pt}}
% niełamliwy podwójny dywiz
\newcommand{\nbendash}{\protect\nobreakdash--\hspace{0pt}}
% odnośnik do zadania
\newcommand{\refExercise}[1]{zad.\ \mbox{\ref{sol:#1}}}
% odnośnik do problemu
\newcommand{\refProblem}[1]{\mbox{\ref{sol:#1}}}
% komentarz do treści zadania
\newcommand{\note}[1]{\emph{#1}\bigskip}
% ujemny odstęp kasujący \bigskip
\newcommand{\bignegskip}{\vspace{-\bigskipamount}}
% poprawione polecenie \id dla jednoznakowych identyfikatorów
\renewcommand{\id}[1]{\ensuremath{\mathit{\text@hyphens#1}}}
% seria poleceń do atrybutów obiektów (zapożyczone z clrscode3e.sty)
% kilka definicji:
% i-string to identyfikator, który umieszczamy w \id, np. złożone z jednej lub kilku liter nie-greckich lub podkreśleń
% x-string to identyfikator, który nie powinien być umieszczany w \id, np. złożony z jednej lub kilku liter greckich lub zawierający indeks
% pojedyncza nie-grecka litera może być zarówno i-stringiem, jak i x-stringiem
% poszczególne definicje służą do składania atrybutów dla każdej kombinacji stringów (xi, xx, ix, ii)
% w drugim wydaniu Podręcznika atrybuty składane są jednak w odwrotnej kolejności, dlatego np. użycie \attribix{current}{h}
% spowoduje wyświetlenie h[current], gdzie current zostanie złożone z użyciem \id (i-string), a h -- bez \id (x-string)
\newcommand{\attribxi}[2]{\ensuremath{\id{#2}[#1]}}
\newcommand{\attribxx}[2]{\ensuremath{#2[#1]}}
\newcommand{\attribix}[2]{\ensuremath{#2[\id{#1}]}}
\newcommand{\attribii}[2]{\ensuremath{\id{#2}[\id{#1}]}}
\newcommand{\attrib}[2]{\attribxi{#1}{#2}}
% polecenia służące do kaskadowego składania atrybutów, zakładając, że pierwszy element jest x-stringiem, a kolejne -- i-stringami
\newcommand{\attribb}[3]{\attribxi{\attribxi{#1}{#2}}{#3}}
\newcommand{\attribbb}[4]{\attribxi{\attribb{#1}{#2}{#3}}{#4}}
% definicja nowych operatorów matematycznych
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\E}{E}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\I}{I}
% domyślne style dla wszystkich rysunków
\tikzset{
light grayed/.style = {fill=black!20},
med grayed/.style = {fill=black!40},
dark grayed/.style = {fill=black!60},
blackened/.style = {fill=black, text=white, font=\bfseries},
cell/.style = {draw, inner sep=0pt, minimum size=5mm, text height=1.5ex},
array/.style = {matrix of nodes, column sep=-\pgflinewidth, row sep=-\pgflinewidth, nodes={cell}, nodes in empty cells},
index node/.style = {font=\scriptsize, inner sep=0pt, minimum size=3mm, text height=1.5ex},
arrow/.style = {->, >={stealth[bend]}, draw},
subpicture label/.style = {font=\small\bfseries\sffamily},
level/.style = {level distance=10mm, sibling distance=60mm/2^#1},
tree node/.style = {align=center, inner sep=-1pt, minimum size=5mm, text height=1.5ex, text depth=.1ex, circle, draw, light grayed},
outer/.style = {draw=none, fill=none, inner sep=0pt},
halved path/.style 2 args = {decorate, decoration={show path construction,
lineto code={
\draw[#1] (\tikzinputsegmentfirst) -- ($(\tikzinputsegmentfirst) ! 0.5 ! (\tikzinputsegmentlast)$);
\draw[#2] ($(\tikzinputsegmentfirst) ! 0.5 ! (\tikzinputsegmentlast)$) -- (\tikzinputsegmentlast);
}
}},
very densely dashed/.style = {dash pattern=on 1.5pt off 1pt}
}