Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/thinkbayes2
Path: blob/master/book/latexonly.tex
1901 views
1
\sloppy
2
%\setlength{\topmargin}{-0.375in}
3
%\setlength{\oddsidemargin}{0.0in}
4
%\setlength{\evensidemargin}{0.0in}
5
6
% Uncomment these to center on 8.5 x 11
7
%\setlength{\topmargin}{0.625in}
8
%\setlength{\oddsidemargin}{0.875in}
9
%\setlength{\evensidemargin}{0.875in}
10
11
%\setlength{\textheight}{7.2in}
12
13
\setlength{\headsep}{3ex}
14
\setlength{\parindent}{0.0in}
15
\setlength{\parskip}{1.7ex plus 0.5ex minus 0.5ex}
16
\renewcommand{\baselinestretch}{1.02}
17
18
% see LaTeX Companion page 62
19
\setlength{\topsep}{-0.0\parskip}
20
\setlength{\partopsep}{-0.5\parskip}
21
\setlength{\itemindent}{0.0in}
22
\setlength{\listparindent}{0.0in}
23
24
% see LaTeX Companion page 26
25
% these are copied from
26
% /usr/local/teTeX/share/texmf/tex/latex/base/book.cls
27
% all I changed is afterskip
28
29
\makeatletter
30
31
\renewcommand{\section}{\@startsection
32
{section} {1} {0mm}%
33
{-3.5ex \@plus -1ex \@minus -.2ex}%
34
{0.7ex \@plus.2ex}%
35
{\normalfont\Large\bfseries}}
36
\renewcommand\subsection{\@startsection {subsection}{2}{0mm}%
37
{-3.25ex\@plus -1ex \@minus -.2ex}%
38
{0.3ex \@plus .2ex}%
39
{\normalfont\large\bfseries}}
40
\renewcommand\subsubsection{\@startsection {subsubsection}{3}{0mm}%
41
{-3.25ex\@plus -1ex \@minus -.2ex}%
42
{0.3ex \@plus .2ex}%
43
{\normalfont\normalsize\bfseries}}
44
45
% The following line adds a little extra space to the column
46
% in which the Section numbers appear in the table of contents
47
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{3.0em}}
48
\setcounter{tocdepth}{1}
49
50
\makeatother
51
52
\newcommand{\adjustpage}[1]{\enlargethispage{#1\baselineskip}}
53
54
55
% Note: the following command seems to cause problems for Acroreader
56
% on Windows, so for now I am overriding it.
57
%\newcommand{\clearemptydoublepage}{
58
% \newpage{\pagestyle{empty}\cleardoublepage}}
59
\newcommand{\clearemptydoublepage}{\cleardoublepage}
60
61
%\newcommand{\blankpage}{\pagestyle{empty}\vspace*{1in}\newpage}
62
\newcommand{\blankpage}{\vspace*{1in}\newpage}
63
64
% HEADERS
65
66
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
67
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}
68
69
\lhead[\fancyplain{}{\bfseries\thepage}]%
70
{\fancyplain{}{\bfseries\rightmark}}
71
\rhead[\fancyplain{}{\bfseries\leftmark}]%
72
{\fancyplain{}{\bfseries\thepage}}
73
\cfoot{}
74
75
\pagestyle{fancyplain}
76
77
% colors for code listings and output
78
\definecolor{bgcolor}{HTML}{FAFAFA}
79
\definecolor{comment}{HTML}{007C00}
80
\definecolor{keyword}{HTML}{0000FF}
81
\definecolor{strings}{HTML}{B20000}
82
83
% syntax highlighting in code listings
84
\lstset{
85
language=python,
86
basicstyle=\ttfamily,
87
backgroundcolor=\color{bgcolor},
88
commentstyle=\color{comment},
89
keywordstyle=\color{keyword},
90
stringstyle=\color{strings},
91
columns=fullflexible,
92
emph={label}, % keyword?
93
keepspaces=true,
94
showstringspaces=false,
95
upquote=true,
96
xleftmargin=15pt, % \parindent
97
framexleftmargin=3pt,
98
aboveskip=\parskip,
99
belowskip=\parskip
100
}
101
102
% code listing environments
103
\lstnewenvironment{code}
104
{\minipage{\linewidth}}
105
{\endminipage}
106
107
\lstnewenvironment{stdout}
108
{\lstset{commentstyle=,keywordstyle=,stringstyle=}\minipage{\linewidth}}
109
{\endminipage}
110
111
% inline syntax formatting
112
\newcommand{\py}[1]{\lstinline{#1}}%{
113
114
% the following is a brute-force way to prevent the headers
115
% from getting transformed into all-caps
116
\renewcommand\MakeUppercase{}
117
118
% Exercise environment
119
\newtheoremstyle{myex}% name
120
{9pt}% Space above
121
{9pt}% Space below
122
{}% Body font
123
{}% Indent amount (empty = no indent, \parindent = para indent)
124
{\bfseries}% Thm head font
125
{}% Punctuation after thm head
126
{0.5em}% Space after thm head: " " = normal interword space;
127
% \newline = linebreak
128
{}% Thm head spec (can be left empty, meaning `normal')
129
130
\theoremstyle{myex}
131
132