Sharedsupport / show jupyter pdf / example.texOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
1
2
% Default to the notebook output style
3
4
5
6
7
% Inherit from the specified cell style.
8
9
10
11
12
13
\documentclass[11pt]{article}
14
15
16
17
\usepackage[T1]{fontenc}
18
% Nicer default font (+ math font) than Computer Modern for most use cases
19
\usepackage{mathpazo}
20
21
% Basic figure setup, for now with no caption control since it's done
22
% automatically by Pandoc (which extracts ![](path) syntax from Markdown).
23
\usepackage{graphicx}
24
% We will generate all images so they have a width \maxwidth. This means
25
% that they will get their normal width if they fit onto the page, but
26
% are scaled down if they would overflow the margins.
27
\makeatletter
28
\def\maxwidth{\ifdim\[email protected]@width>\linewidth\linewidth
29
\else\[email protected]@width\fi}
30
\makeatother
31
\let\Oldincludegraphics\includegraphics
32
% Set max figure width to be 80% of text width, for now hardcoded.
33
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}}
34
% Ensure that by default, figures have no caption (until we provide a
35
% proper Figure object with a Caption API and a way to capture that
36
% in the conversion process - todo).
37
\usepackage{caption}
38
\DeclareCaptionLabelFormat{nolabel}{}
39
\captionsetup{labelformat=nolabel}
40
41
\usepackage{adjustbox} % Used to constrain images to a maximum size
42
\usepackage{xcolor} % Allow colors to be defined
43
\usepackage{enumerate} % Needed for markdown enumerations to work
44
\usepackage{geometry} % Used to adjust the document margins
45
\usepackage{amsmath} % Equations
46
\usepackage{amssymb} % Equations
47
\usepackage{textcomp} % defines textquotesingle
48
% Hack from http://tex.stackexchange.com/a/47451/13684:
49
\AtBeginDocument{%
50
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
51
}
52
\usepackage{upquote} % Upright quotes for verbatim code
53
\usepackage{eurosym} % defines \euro
54
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
55
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
56
\usepackage{fancyvrb} % verbatim replacement that allows latex
57
\usepackage{grffile} % extends the file name processing of package graphics
58
% to support a larger range
59
% The hyperref package gives us a pdf with properly built
60
% internal navigation ('pdf bookmarks' for the table of contents,
61
% internal cross-reference links, web links for URLs, etc.)
62
\usepackage{hyperref}
63
\usepackage{longtable} % longtable support required by pandoc >1.10
64
\usepackage{booktabs} % table support for pandoc > 1.12.2
65
\usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
66
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
67
% normalem makes italics be italics, not underlines
68
69
70
71
72
% Colors for the hyperref package
73
\definecolor{urlcolor}{rgb}{0,.145,.698}
74
\definecolor{linkcolor}{rgb}{.71,0.21,0.01}
75
\definecolor{citecolor}{rgb}{.12,.54,.11}
76
77
% ANSI colors
78
\definecolor{ansi-black}{HTML}{3E424D}
79
\definecolor{ansi-black-intense}{HTML}{282C36}
80
\definecolor{ansi-red}{HTML}{E75C58}
81
\definecolor{ansi-red-intense}{HTML}{B22B31}
82
\definecolor{ansi-green}{HTML}{00A250}
83
\definecolor{ansi-green-intense}{HTML}{007427}
84
\definecolor{ansi-yellow}{HTML}{DDB62B}
85
\definecolor{ansi-yellow-intense}{HTML}{B27D12}
86
\definecolor{ansi-blue}{HTML}{208FFB}
87
\definecolor{ansi-blue-intense}{HTML}{0065CA}
88
\definecolor{ansi-magenta}{HTML}{D160C4}
89
\definecolor{ansi-magenta-intense}{HTML}{A03196}
90
\definecolor{ansi-cyan}{HTML}{60C6C8}
91
\definecolor{ansi-cyan-intense}{HTML}{258F8F}
92
\definecolor{ansi-white}{HTML}{C5C1B4}
93
\definecolor{ansi-white-intense}{HTML}{A1A6B2}
94
95
% commands and environments needed by pandoc snippets
96
% extracted from the output of `pandoc -s`
97
\providecommand{\tightlist}{%
98
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
99
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
100
% Add ',fontsize=\small' for more characters per line
101
\newenvironment{Shaded}{}{}
102
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
103
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
104
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
105
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
106
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
107
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
108
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
109
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
110
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
111
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
112
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
113
\newcommand{\RegionMarkerTok}[1]{{#1}}
114
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
115
\newcommand{\NormalTok}[1]{{#1}}
116
117
% Additional commands for more recent versions of Pandoc
118
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
119
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
120
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
121
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
122
\newcommand{\ImportTok}[1]{{#1}}
123
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
124
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
125
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
126
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
127
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
128
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
129
\newcommand{\BuiltInTok}[1]{{#1}}
130
\newcommand{\ExtensionTok}[1]{{#1}}
131
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
132
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
133
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
134
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
135
136
137
% Define a nice break command that doesn't care if a line doesn't already
138
% exist.
139
\def\br{\hspace*{\fill} \\* }
140
% Math Jax compatability definitions
141
\def\gt{>}
142
\def\lt{<}
143
% Document parameters
144
\title{example}
145
146
147
148
149
% Pygments definitions
150
151
\makeatletter
152
\def\[email protected]{\let\[email protected]=\relax \let\[email protected]=\relax%
153
\let\[email protected]=\relax \let\[email protected]=\relax%
154
\let\[email protected]=\relax \let\[email protected]=\relax}
155
\def\[email protected]#1{\csname PY@tok@#1\endcsname}
156
\def\[email protected]#1+{\ifx\relax#1\empty\else%
157
\[email protected]{#1}\expandafter\[email protected]\fi}
158
\def\[email protected]#1{\[email protected]{\[email protected]{\[email protected]{%
159
\[email protected]{\[email protected]{\[email protected]{#1}}}}}}}
160
\def\PY#1#2{\[email protected]\[email protected]#1+\relax+\[email protected]{#2}}
161
162
\expandafter\def\csname PY@tok@gd\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
163
\expandafter\def\csname PY@tok@gu\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
164
\expandafter\def\csname PY@tok@gt\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
165
\expandafter\def\csname PY@tok@gs\endcsname{\let\[email protected]=\textbf}
166
\expandafter\def\csname PY@tok@gr\endcsname{\def\[email protected]##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
167
\expandafter\def\csname PY@tok@cm\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
168
\expandafter\def\csname PY@tok@vg\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
169
\expandafter\def\csname PY@tok@vi\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
170
\expandafter\def\csname PY@tok@vm\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
171
\expandafter\def\csname PY@tok@mh\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
172
\expandafter\def\csname PY@tok@cs\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
173
\expandafter\def\csname PY@tok@ge\endcsname{\let\[email protected]=\textit}
174
\expandafter\def\csname PY@tok@vc\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
175
\expandafter\def\csname PY@tok@il\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
176
\expandafter\def\csname PY@tok@go\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
177
\expandafter\def\csname PY@tok@cp\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
178
\expandafter\def\csname PY@tok@gi\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
179
\expandafter\def\csname PY@tok@gh\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
180
\expandafter\def\csname PY@tok@ni\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
181
\expandafter\def\csname PY@tok@nl\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
182
\expandafter\def\csname PY@tok@nn\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
183
\expandafter\def\csname PY@tok@no\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
184
\expandafter\def\csname PY@tok@na\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
185
\expandafter\def\csname PY@tok@nb\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
186
\expandafter\def\csname PY@tok@nc\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
187
\expandafter\def\csname PY@tok@nd\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
188
\expandafter\def\csname PY@tok@ne\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
189
\expandafter\def\csname PY@tok@nf\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
190
\expandafter\def\csname PY@tok@si\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
191
\expandafter\def\csname PY@tok@s2\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
192
\expandafter\def\csname PY@tok@nt\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
193
\expandafter\def\csname PY@tok@nv\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
194
\expandafter\def\csname PY@tok@s1\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
195
\expandafter\def\csname PY@tok@dl\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
196
\expandafter\def\csname PY@tok@ch\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
197
\expandafter\def\csname PY@tok@m\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
198
\expandafter\def\csname PY@tok@gp\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
199
\expandafter\def\csname PY@tok@sh\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
200
\expandafter\def\csname PY@tok@ow\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
201
\expandafter\def\csname PY@tok@sx\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
202
\expandafter\def\csname PY@tok@bp\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
203
\expandafter\def\csname PY@tok@c1\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
204
\expandafter\def\csname PY@tok@fm\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
205
\expandafter\def\csname PY@tok@o\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
206
\expandafter\def\csname PY@tok@kc\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
207
\expandafter\def\csname PY@tok@c\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
208
\expandafter\def\csname PY@tok@mf\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
209
\expandafter\def\csname PY@tok@err\endcsname{\def\[email protected]##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
210
\expandafter\def\csname PY@tok@mb\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
211
\expandafter\def\csname PY@tok@ss\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
212
\expandafter\def\csname PY@tok@sr\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
213
\expandafter\def\csname PY@tok@mo\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
214
\expandafter\def\csname PY@tok@kd\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
215
\expandafter\def\csname PY@tok@mi\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
216
\expandafter\def\csname PY@tok@kn\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
217
\expandafter\def\csname PY@tok@cpf\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
218
\expandafter\def\csname PY@tok@kr\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
219
\expandafter\def\csname PY@tok@s\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
220
\expandafter\def\csname PY@tok@kp\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
221
\expandafter\def\csname PY@tok@w\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
222
\expandafter\def\csname PY@tok@kt\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
223
\expandafter\def\csname PY@tok@sc\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
224
\expandafter\def\csname PY@tok@sb\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
225
\expandafter\def\csname PY@tok@sa\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
226
\expandafter\def\csname PY@tok@k\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
227
\expandafter\def\csname PY@tok@se\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
228
\expandafter\def\csname PY@tok@sd\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
229
230
\def\PYZbs{\char`\\}
231
\def\PYZus{\char`\_}
232
\def\PYZob{\char`\{}
233
\def\PYZcb{\char`\}}
234
\def\PYZca{\char`\^}
235
\def\PYZam{\char`\&}
236
\def\PYZlt{\char`\<}
237
\def\PYZgt{\char`\>}
238
\def\PYZsh{\char`\#}
239
\def\PYZpc{\char`\%}
240
\def\PYZdl{\char`\$}
241
\def\PYZhy{\char`\-}
242
\def\PYZsq{\char`\'}
243
\def\PYZdq{\char`\"}
244
\def\PYZti{\char`\~}
245
% for compatibility with earlier versions
246
\def\PYZat{@}
247
\def\PYZlb{[}
248
\def\PYZrb{]}
249
\makeatother
250
251
252
% Exact colors from NB
253
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
254
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}
255
256
257
258
259
% Prevent overflowing lines due to hard-to-break entities
260
\sloppy
261
% Setup hyperref package
262
\hypersetup{
263
breaklinks=true, % so long urls are correctly broken across lines
264
colorlinks=true,
265
urlcolor=urlcolor,
266
linkcolor=linkcolor,
267
citecolor=citecolor,
268
}
269
% Slightly bigger margins than the latex defaults
270
271
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
272
273
274
275
\begin{document}
276
277
278
\maketitle
279
280
281
282
283
\begin{Verbatim}[commandchars=\\\{\}]
284
{\color{incolor}In [{\color{incolor}3}]:} \PY{k}{print}\PY{p}{(}\PY{l+s+s2}{\PYZdq{}}\PY{l+s+s2}{Use show fails}\PY{l+s+s2}{\PYZdq{}}\PY{p}{)}
285
\PY{n}{show}\PY{p}{(}\PY{l+m+mi}{2}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{)}
286
\end{Verbatim}
287
288
\begin{Verbatim}[commandchars=\\\{\}]
289
Use show fails
290
291
\end{Verbatim}
292
293
But Markdon works: \(\frac{2}{3}\)
294
295
296
% Add a bibliography block to the postdoc
297
298
299
300
\end{document}
301