forked from PhilippeSigaud/D-templates-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdtemplates.tex
123 lines (93 loc) · 2.52 KB
/
dtemplates.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
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
\documentclass[10pt,a4paper]{article}
% Font packages
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
% Misc.
\usepackage{datetime}% hmm, \yyyymmdd
\usepackage{graphicx}% \includegraphics(}
\usepackage{makeidx} % for the index
\usepackage{framed} % for the \aparte command
\usepackage{minted} % for code highlighting
\usepackage{changepage}
\makeindex
%\yyyymmdd
%%%% Redefinitions for minted / dcode %%%%%%%%%%%%%%
% line numbering style
\renewcommand{\theFancyVerbLine}{
\sffamily
\textcolor[rgb]{0.4,0.4,0.9}{\scriptsize \arabic{FancyVerbLine}}}
% syntax highlighting style
\usemintedstyle{borland}
% dcode environment: highlighting D code
\newminted[dcode]{d}
{
frame=leftline,
xleftmargin=-3pt,
}
% ndcode environment: + line numbering
\newminted[ndcode]{d}
{
linenos,
numbersep = 2pt,
frame=leftline,
}
%%%% Formatting commands %%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{shadecolor}{rgb}{0.8,0.8,0.9}
\definecolor{darkblue}{rgb}{0.0, 0.0, 0.5}
\newcommand{\D}[1]{\texttt{\color{darkblue}#1}}
\newcommand{\DD}[1]{\texttt{#1}}
\newcommand{\TODO}[1]{{\color{red}\textsc{Todo:\ }#1}}
\newcommand{\std}[1]{\href{http://www.dlang.org/phobos/std_#1.html}{\DD{std.}\DD{#1}}\index{Phobos}\index{std@\DD{std}!#1@\DD{#1}}}
\newcommand{\stdanchor}[2]{\href{http://www.dlang.org/phobos/std_#1.html\##2}{\DD{std.}\DD{#1.}\DD{#2}}\index{Phobos}\index{std@\DD{std}!#1@\DD{#1}!#2@\DD{#2}}}
\setlength\fboxsep{8pt}
\newcommand{\aparte}[2]
{
\vspace{10pt}
\noindent
\fbox{
\begin{minipage}[c]{0.9\textwidth}
{\large\textbf{ #1}}\vspace{6pt}\newline
#2
\end{minipage}
}
\vspace{10pt}
\newline
}
\newcommand{\unfinished}[1]
{{\color{red}
\aparte{This section is still a Work In Progress:}{#1}
}}
%%%%%%%% Hyperlinks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdftex]{hyperref}
\hypersetup{
pdftitle={D Templates: A Tutorial},
pdfauthor={Philippe Sigaud},
pdfsubject={A tutorial on D templates},
pdfcreator={TeXworks},
pdfproducer={pdflatex},
pdfkeywords={D} {template} {tutorial},
colorlinks=true,
linkcolor=red,
urlcolor=darkblue
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frenchspacing
\title{D Templates: A Tutorial}
\author{Philippe Sigaud}
\date{\today}
\maketitle
\tableofcontents
\input{templates_intro}
\input{templates_basics}
\input{templates_advanced}
\input{templates_around}
\input{templates_examples}
\input{templates_appendix}
\newpage
\phantomsection
\addcontentsline{toc}{part}{Index}
\printindex
\end{document}