-
Notifications
You must be signed in to change notification settings - Fork 1
/
header.tex
80 lines (71 loc) · 2.45 KB
/
header.tex
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
% e-book
\documentclass[oneside,10pt]{book}
%% screen paper layout (A5 landscape)
\usepackage[paperwidth=118.8mm,paperheight=68.2mm,margin=2mm]{geometry}
%% font setup for screen reading
\renewcommand{\familydefault}{\sfdefault}\normalfont
%% hyperlinks pdf style
\usepackage[unicode,colorlinks=true]{hyperref}
%% fix heading styles for tiny paper
\usepackage{titlesec}
\titleformat{\chapter}{\Large\bfseries}{\thechapter.}{1em}{}
\titleformat{\section}{\large\bfseries}{\thesection.}{1em}{}
% graphics
\usepackage[pdftex]{graphicx}
\newcommand{\fig}[2]{\noindent\includegraphics[#2]{#1}}
% xcolor fixes
\usepackage{xcolor}
\definecolor{red}{rgb}{0.7,0,0} % R
\definecolor{green}{rgb}{0,0.6,0} % G
\definecolor{blue}{rgb}{0,0,0.7} % B
\definecolor{darkblue}{rgb}{0,0,0.3} % DB
% Cyrillization
%% \usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
%% \usepackage[cp1251]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{indentfirst}
% relative sectioning
\usepackage{ifthen}
\newcounter{secdepth}\setcounter{secdepth}{0}
\newcommand{\secup}{\addtocounter{secdepth}{1}}
\newcommand{\secdown}{\addtocounter{secdepth}{-1}}
\newcommand{\secrel}[1]{
\ifthenelse{\equal{\value{secdepth}}{0}}{\part{#1}}{}
\ifthenelse{\equal{\value{secdepth}}{-1}}{\chapter{#1}}{}
\ifthenelse{\equal{\value{secdepth}}{-2}}{\section{#1}}{}
\ifthenelse{\equal{\value{secdepth}}{-3}}{\subsection{#1}}{}
\ifthenelse{\equal{\value{secdepth}}{-4}}{\subsubsection{#1}}{}
}
\newcommand{\secly}[1]{\section*{#1} \addcontentsline{toc}{section}{#1} \refstepcounter{section}}
\newcommand{\subsecly}[1]{\subsection*{#1} \addcontentsline{toc}{subsection}{#1} \refstepcounter{subsection}}
% computer-related markup: manuals, listings, CS
%% listings
\usepackage{verbatim}
\usepackage{listings}
\lstset{
basicstyle=\small,
frame=single,
numbers=left,numberstyle=\small,numbersep=2mm,
tabsize=4,
keywordstyle=\textbf,
commentstyle=\color{blue}\textbf
}
\newcommand{\lst}[2]{\lstinputlisting[title=#2]{#1}}
%% languages
\newcommand{\st}{\texttt{Smalltalk}}
\newcommand{\ci}{$C$}
%% program elements
\newcommand{\class}[1]{\textbf{\texttt{#1}}}
\newcommand{\fn}[1]{\texttt{#1}}
\newcommand{\var}[1]{\texttt{#1}}
\newcommand{\file}[1]{\texttt{#1}}
% [nosep] option in lists/enums
\usepackage{enumitem}
% frame box
\usepackage{framed}
% misc
\newcommand{\email}[1]{$<$\href{mailto:#1}{#1}$>$}
\renewcommand{\emph}[1]{\textcolor{blue}{#1}}
\newcommand{\term}[1]{\textcolor{green}{#1}}
\newcommand{\note}[1]{\,\footnote{\ #1}}