-
Notifications
You must be signed in to change notification settings - Fork 41
/
latexonly.tex
149 lines (132 loc) · 3.95 KB
/
latexonly.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
\usepackage{geometry}
\geometry{
%paperwidth=6.0in,
%paperheight=9.0in,
width=5.5in,
height=8.5in,
hmarginratio=1:1, % 3:2 for binding offset
vmarginratio=1:1,
includehead=true,
headheight=15pt
}
% index with headings
\usepackage{imakeidx}
\makeindex[options= -s headings.ist]
% paragraph spacing
\setlength{\parindent}{0pt} % 17.62482pt
\setlength{\parskip}{12pt plus 4pt minus 4pt} % 0.0pt plus 1.0pt
\linespread{1.05}
\def\arraystretch{1.5}
% list spacing
\setlength{\topsep}{5pt plus 2pt minus 3pt} % 10.0pt plus 4.0pt minus 6.0pt
\setlength{\partopsep}{-6pt plus 2pt minus 2pt} % 3.0pt plus 2.0pt minus 2.0pt
\setlength{\itemsep}{0pt} % 5.0pt plus 2.5pt minus 1.0pt
% these are copied from tex/latex/base/book.cls
% all I changed is afterskip
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{0.7ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{0.3ex \@plus .2ex}%
{\normalfont\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{0.3ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\makeatother
% table of contents vertical spacing
\usepackage{tocloft}
\setlength\cftparskip{8pt plus 4pt minus 4pt}
% balanced index with TOC entry
\usepackage[totoc]{idxlayout}
% The following line adds a little extra space to the column
% in which the Section numbers appear in the table of contents
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{3.0em}}
\makeatother
% customize page headers
\usepackage{fancyhdr}
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]{\markboth{Chapter \thechapter ~~ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection ~~ #1}}
\lhead[\fancyplain{}{\bfseries\thepage}]%
{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]%
{\fancyplain{}{\bfseries\thepage}}
\cfoot{}
%\usepackage[mmddyyyy]{datetime}
%\rfoot{\textcolor{gray}{\tiny \thetitle, \theversion, \today}}
%% tweak spacing of figures and captions
%\usepackage{floatrow}
%\usepackage{caption}
%\captionsetup{
% font=small,
% labelformat=empty,
% justification=centering,
% skip=4pt
%}
% colors for code listings and output
\usepackage{xcolor}
\definecolor{bgcolor}{HTML}{FAFAFA}
\definecolor{comment}{HTML}{007C00}
\definecolor{keyword}{HTML}{0000FF}
\definecolor{strings}{HTML}{B20000}
% syntax highlighting in code listings
\usepackage{textcomp}
\usepackage{listings}
\lstset{
language=java,
basicstyle=\ttfamily,
backgroundcolor=\color{bgcolor},
commentstyle=\color{comment},
keywordstyle=\color{keyword},
stringstyle=\color{strings},
columns=fullflexible,
emph={label}, % keyword?
keepspaces=true,
showstringspaces=false,
upquote=true,
xleftmargin=15pt, % \parindent
framexleftmargin=3pt,
aboveskip=\parskip,
belowskip=\parskip
}
% code listing environments
\lstnewenvironment{code}
{\minipage{\linewidth}}
{\endminipage}
\lstnewenvironment{stdout}
{\lstset{commentstyle=,keywordstyle=,stringstyle=}\minipage{\linewidth}}
{\endminipage}
% interactive code listing
\lstnewenvironment{trinket}[2][400]
{\minipage{\linewidth}}
{\endminipage}
% inline syntax formatting
\newcommand{\java}[1]{\lstinline{#1}}%{
% prevent hyphens in names
\hyphenation{DrJava}
\hyphenation{GitHub}
\hyphenation{Javadoc}
% pdf hyperlinks, table of contents, and document properties
\usepackage{hyperref}
\hypersetup{%
pdftitle={\thetitle: \thesubtitle},
pdfauthor={\theauthors},
pdfsubject={\theversion},
pdfkeywords={},
bookmarksopen=false,
bookmarksnumbered=true,
colorlinks=true,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=blue
}
% add dot after numbers in pdf bookmarks
\makeatletter
\renewcommand{\Hy@numberline}[1]{#1. }
\makeatother