This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
/
revtex.tplx
160 lines (133 loc) · 6.15 KB
/
revtex.tplx
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
156
157
158
159
160
((*- extends 'article.tplx' -*))
% See http://blog.juliusschulz.de/blog/ultimate-ipython-notebook#templates
% for some useful tips
%===============================================================================
% Document class
%===============================================================================
((* block docclass *))
\documentclass[10pt,notitlepage,onecolumn,aps,pra]{revtex4-1}
((* endblock docclass *))
%===============================================================================
% Packages
%===============================================================================
((* block packages *))
\usepackage[T1]{fontenc}
\usepackage[breakable]{tcolorbox}
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
\else\Gin@nat@width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
% Set max figure width to be 80% of text width, for now hardcoded.
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}}
% Ensure that by default, figures have no caption (until we provide a
% proper Figure object with a Caption API and a way to capture that
% in the conversion process - todo).
\usepackage{caption}
\DeclareCaptionLabelFormat{nolabel}{}
\captionsetup{labelformat=nolabel}
\usepackage{adjustbox} % Used to constrain images to a maximum size
\usepackage{xcolor} % Allow colors to be defined
\usepackage{enumerate} % Needed for markdown enumerations to work
\usepackage{geometry} % Used to adjust the document margins
\usepackage{amsmath} % Equations
\usepackage{amssymb} % Equations
\usepackage{textcomp} % defines textquotesingle
% Hack from http://tex.stackexchange.com/a/47451/13684:
\AtBeginDocument{%
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
}
\usepackage{upquote} % Upright quotes for verbatim code
\usepackage{eurosym} % defines \euro
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
\usepackage{fancyvrb} % verbatim replacement that allows latex
\usepackage{grffile} % extends the file name processing of package graphics
% to support a larger range
% The hyperref package gives us a pdf with properly built
% internal navigation ('pdf bookmarks' for the table of contents,
% internal cross-reference links, web links for URLs, etc.)
\usepackage{hyperref}
\usepackage{booktabs} % table support for pandoc > 1.12.2
\usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
% normalem makes italics be italics, not underlines
\usepackage{braket}
((* endblock packages *))
%===============================================================================
% Title Page
%===============================================================================
((* block title -*))
((*- endblock title *))
((* block author -*))
((* endblock author *))
((* block maketitle *))
((*- if nb.metadata.get("latex_metadata", {}).get("title", ""): -*))
\title{((( nb.metadata["latex_metadata"]["title"] )))}
((*- else -*))
\title{((( resources.metadata.name | ascii_only | escape_latex )))}
((*- endif *))
((*- if nb.metadata.get("latex_metadata", {}).get("author", ""): -*))
\author{((( nb.metadata["latex_metadata"]["author"] )))}
((*- else -*))
\author{Michael Goerz}
((*- endif *))
((*- if nb.metadata.get("latex_metadata", {}).get("affiliation", ""): -*))
\affiliation{((( nb.metadata["latex_metadata"]["affiliation"] )))}
((*- endif *))
\date{\today}
\maketitle
((* endblock maketitle *))
%===============================================================================
% Input
%===============================================================================
% Input cells can be hidden using the "Hide input" and "Hide input all"
% nbextensions (which set the hide_input metadata flags)
((* block input scoped *))
((*- if cell.metadata.hide_input or nb.metadata.hide_input: -*))
((*- else -*))
((( custom_add_prompt(cell.source | wrap_text(88) | highlight_code(strip_verbatim=True), cell, 'In ', 'incolor') )))
((*- endif *))
((* endblock input *))
%===============================================================================
% Output
%===============================================================================
((* block output_group -*))
((*- if cell.metadata.hide_output: -*))
((*- else -*))
((( super() )))
((*- endif -*))
((* endblock output_group *))
% Display stream ouput with coloring
((* block stream *))
\begin{Verbatim}[commandchars=\\\{\}]
((( output.text | wrap_text(86) | escape_latex | ansi2latex )))
\end{Verbatim}
((* endblock stream *))
%==============================================================================
% Define macro custom_add_prompt() (derived from add_prompt() macro in style_ipython.tplx)
%==============================================================================
((* macro custom_add_prompt(text, cell, prompt, prompt_color) -*))
((*- if cell.execution_count is defined -*))
((*- set execution_count = "" ~ (cell.execution_count | replace(None, " ")) -*))
((*- else -*))
((*- set execution_count = " " -*))
((*- endif -*))
((*- set indention = " " * (execution_count | length + 7) -*))
\begin{Verbatim}[commandchars=\\\{\}]
((( text | add_prompts(first='{\color{' ~ prompt_color ~ '}' ~ prompt ~ '[{\\color{' ~ prompt_color ~ '}' ~ execution_count ~ '}]:} ', cont=indention) )))
\end{Verbatim}
((*- endmacro *))
%==============================================================================
% Bibliography
%==============================================================================
% Insert citations in markdown as e.g.
% <cite data-cite="DevoretS2013">[DevoretS2013]</cite>
% requires file references.bib in current directory (or the file set as "bib" in the latex_metadata)
((* block bibliography *))
\bibliography{((( nb.metadata.get("latex_metadata", {}).get("bib", "references") )))}
((* endblock bibliography *))