forked from progit/progit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.tex
155 lines (132 loc) · 4.52 KB
/
template.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
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
\documentclass[a4paper]{book}
\usepackage[
%urlbordercolor = {1 1 1},
%linkbordercolor = {1 1 1},
%citebordercolor = {1 1 1},
urlcolor = blue,
colorlinks = true,
citecolor = black,
linkcolor = black]{hyperref}
\usepackage{graphicx}
\usepackage{xltxtra}
\usepackage{fancyhdr}
\usepackage{booktabs}
\usepackage{indentfirst}
\usepackage{framed,color}
\usepackage{caption}
\usepackage{longtable}
\captionsetup{font=bf,position=below}
\usepackage{ctable}
\definecolor{shadecolor}{gray}{0.90}
\setromanfont[Mapping=tex-text,BoldFont=<%= config['bold'] %>]{<%= config['font'] %>}
\setmonofont[Scale=.85]{<%= config['mono'] %>}
\XeTeXlinebreaklocale{<%= lang %>}
<%= config['langrule'] %>
\settowidth{\parindent}{<%= config['indent'] %>}
\title{Pro Git}
\author{Scott Chacon}
\makeatletter
\let\savedauthor=\@author
\let\savedtitle=\@title
\def\imgwidth{.6\linewidth}
\def\maxwidth{\ifdim\Gin@nat@width>\imgwidth\imgwidth
\else\Gin@nat@width\fi}
\makeatother
\title{\textbf{\savedtitle}}
\author{\textbf{\savedauthor}\thanks{<%= config['thanks'] %>}}
\def\w3cdtfymd{\the\year-\ifnum\month<10 0\fi\the\month-\ifnum\day<10 0\fi\the\day}
\date{\w3cdtfymd}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\makeatletter
\setlength\headheight{12\p@}
\setlength\headsep {.25in}
\setlength\topskip {10\p@}
\setlength\footskip{.35in}
\setlength\textwidth{400\p@}
\setlength\@tempdima{\paperheight}
\addtolength\@tempdima{-2in}
\divide\@tempdima\baselineskip
\@tempcnta=\@tempdima
\setlength\textheight{\@tempcnta\baselineskip}
\addtolength\textheight{\topskip}
\setlength\@tempdima {\paperwidth}
\addtolength\@tempdima {-\textwidth}
\setlength\oddsidemargin {\paperwidth}
\addtolength\oddsidemargin {-2.35in}
\addtolength\oddsidemargin {-\textwidth}
\setlength\marginparwidth {0pt}
\@settopoint\oddsidemargin
\@settopoint\marginparwidth
\setlength\evensidemargin {\paperwidth}
\addtolength\evensidemargin{-2.35in}
\addtolength\evensidemargin{-\textwidth}
\@settopoint\evensidemargin
\setlength\topmargin{\paperheight}
\addtolength\topmargin{-2in}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\addtolength\topmargin{-\textheight}
\addtolength\topmargin{-\footskip} % this might be wrong!
\addtolength\topmargin{-.5\topmargin}
\@settopoint\topmargin
\makeatother
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[LE,RO]{\footnotesize\textbf\thepage}}
\pagestyle{plain}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\newcounter{img}[chapter]
\renewcommand{\theimg}{\thechapter.\arabic{img}}
\newcommand{\img}[1]{\begin{figure}[ht!]
\refstepcounter{img}
\label{img:\theimg}
\centering\IfFileExists{figures/\theimg.pdf}{\includegraphics[width=\maxwidth]{figures/\theimg.pdf}}{\includegraphics[width=\maxwidth]{figures/\theimg.png}}
\caption{#1}
\end{figure}}
\newcounter{tab}[chapter]
\renewcommand{\thetab}{\thechapter.\arabic{tab}}
\newcommand{\prechap}{<%= config['prechap'] %>}
\newcommand{\postchap}{<%= config['postchap'] %>}
\newcommand{\presect}{<%= config['presect'] %>}
\newcommand{\postsect}{<%= config['postsect'] %>}
\renewcommand{\chaptermark}[1]{\markboth{\textbf{\prechap \thechapter \postchap}\hspace*{1ex}#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\textbf{\presect \thesection \postsect}\hspace*{1ex}#1}}
\newcommand{\chap}[1]{\newpage\thispagestyle{empty}\chapter{#1}\label{chap:\thechapter}}
\newcommand{\chapref}[1]{\hyperref[chap:#1]{\prechap #1\postchap}}
\newcommand{\imgref}[1]{\hyperref[img:#1]{<%= config['fig'] %>#1}}
\newcommand{\tabref}[1]{\hyperref[tab:#1]{<%= config['tab'] %>#1}}
\newcommand{\e}[1]{$ \times 10^{#1}$}
\renewcommand{\contentsname}{<%= config['con'] %>}
\renewcommand{\figurename}{<%= config['fig'] %>}
\renewcommand{\tablename}{<%= config['tab'] %>}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\bfseries \prechap \thechapter \postchap
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\linespread{1.3}
\begin{document}
\frontmatter
\maketitle
\thispagestyle{empty}
\setcounter{tocdepth}{4}
\tableofcontents\newpage\thispagestyle{empty}
\mainmatter
\fancyhf{}
\fancyhead[LE]{{\small\leftmark}}
\fancyhead[RO]{{\small\rightmark}}
\fancyhead[RE,LO]{{\small\savedauthor\hspace*{1ex}\textbf{\savedtitle}}}
\fancyfoot[LE,RO]{\small\textbf\thepage}
\pagestyle{fancy}
<%= latex %>
\end{document}