forked from executablebooks/MyST-NB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_complex_outputs_latex.xml
More file actions
182 lines (171 loc) · 10.3 KB
/
test_complex_outputs_latex.xml
File metadata and controls
182 lines (171 loc) · 10.3 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<document source="complex_outputs">
<container cell_index="0" cell_metadata="{'init_cell': True, 'slideshow': {'slide_type': 'skip'}}" classes="cell" exec_count="1" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
import matplotlib.pyplot as plt
import pandas as pd
import sympy as sym
sym.init_printing(use_latex=True)
import numpy as np
from IPython.display import Image, Latex
<section ids="markdown" names="markdown">
<title>
Markdown
<section ids="general" names="general">
<title>
General
<paragraph>
Some markdown text.
<paragraph>
A list:
<bullet_list bullet="-">
<list_item>
<paragraph>
something
<list_item>
<paragraph>
something else
<paragraph>
A numbered list
<enumerated_list enumtype="arabic" prefix="" suffix=".">
<list_item>
<paragraph>
something
<list_item>
<paragraph>
something else
<paragraph>
non-ascii characters TODO
<paragraph>
This is a long section of text, which we only want in a document (not a presentation)
some text
some more text
some more text
some more text
some more text
some more text
some more text
some more text
some more text
<paragraph>
This is an abbreviated section of the document text, which we only want in a presentation
<bullet_list bullet="-">
<list_item>
<paragraph>
summary of document text
<section ids="references-and-citations" names="references\ and\ citations">
<title>
References and Citations
<paragraph>
References to \cref{fig:example}, \cref{tbl:example}, =@eqn:example_sympy and \cref{code:example_mpl}.
<paragraph>
A latex citation.\cite{zelenyak_molecular_2016}
<paragraph>
A html citation.
<raw format="html" xml:space="preserve">
<cite data-cite="kirkeminde_thermodynamic_2012">
(Kirkeminde, 2012)
<raw format="html" xml:space="preserve">
</cite>
<section ids="todo-notes" names="todo\ notes">
<title>
Todo notes
<paragraph>
\todo[inline]{an inline todo}
<paragraph>
Some text.\todo{a todo in the margins}
<section ids="text-output" names="text\ output">
<title>
Text Output
<container cell_index="11" cell_metadata="{'ipub': {'text': {'format': {'backgroundcolor': '\\color{blue!10}'}}}}" classes="cell" exec_count="2" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
print("""
This is some printed text,
with a nicely formatted output.
""")
<container classes="cell_output" nb_element="cell_code_output">
<literal_block classes="output stream" language="myst-ansi" linenos="False" xml:space="preserve">
This is some printed text,
with a nicely formatted output.
<section ids="images-and-figures" names="images\ and\ figures">
<title>
Images and Figures
<container cell_index="13" cell_metadata="{'ipub': {'figure': {'caption': 'A nice picture.', 'label': 'fig:example', 'placement': '!bh'}}}" classes="cell" exec_count="3" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
Image('example.jpg',height=400)
<container classes="cell_output" nb_element="cell_code_output">
<image candidates="{'*': '_build/jupyter_execute/a4c9580c74dacf6f3316a3bd2e2a347933aa4463834dcf1bb8f20b4fcb476ae1.jpg'}" height="400" uri="_build/jupyter_execute/a4c9580c74dacf6f3316a3bd2e2a347933aa4463834dcf1bb8f20b4fcb476ae1.jpg">
<section ids="displaying-a-plot-with-its-code" names="displaying\ a\ plot\ with\ its\ code">
<title>
Displaying a plot with its code
<paragraph>
A matplotlib figure, with the caption set in the markdowncell above the figure.
<paragraph>
The plotting code for a matplotlib figure (\cref{fig:example_mpl}).
<container cell_index="17" cell_metadata="{'ipub': {'code': {'asfloat': True, 'caption': 'a', 'label': 'code:example_mpl', 'widefigure': False}, 'figure': {'caption': '', 'label': 'fig:example_mpl', 'widefigure': False}}}" classes="cell" exec_count="4" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
plt.scatter(np.random.rand(10), np.random.rand(10),
label='data label')
plt.ylabel(r'a y label with latex $\alpha$')
plt.legend();
<container classes="cell_output" nb_element="cell_code_output">
<image candidates="{'*': '_build/jupyter_execute/16832f45917c1c9862c50f0948f64a498402d6ccde1f3a291da17f240797b160.png'}" height="288" uri="_build/jupyter_execute/16832f45917c1c9862c50f0948f64a498402d6ccde1f3a291da17f240797b160.png" width="432">
<section ids="tables-with-pandas" names="tables\ (with\ pandas)">
<title>
Tables (with pandas)
<paragraph>
The plotting code for a pandas Dataframe table (\cref{tbl:example}).
<container cell_index="20" cell_metadata="{'ipub': {'code': {'asfloat': True, 'caption': '', 'label': 'code:example_pd', 'placement': 'H', 'widefigure': False}, 'table': {'alternate': 'gray!20', 'caption': 'An example of a table created with pandas dataframe.', 'label': 'tbl:example', 'placement': 'H'}}}" classes="cell" exec_count="5" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
df = pd.DataFrame(np.random.rand(3,4),columns=['a','b','c','d'])
df.a = [r'$\delta$','x','y']
df.b = ['l','m','n']
df.set_index(['a','b'])
df.round(3)
<container classes="cell_output" nb_element="cell_code_output">
<math_block classes="output text_latex" nowrap="False" number="True" xml:space="preserve">
\begin{tabular}{lllrr}
\toprule
{} & a & b & c & d \\
\midrule
0 & \$\textbackslash delta\$ & l & 0.391 & 0.607 \\
1 & x & m & 0.132 & 0.205 \\
2 & y & n & 0.969 & 0.726 \\
\bottomrule
\end{tabular}
<section ids="equations-with-ipython-or-sympy" names="equations\ (with\ ipython\ or\ sympy)">
<title>
Equations (with ipython or sympy)
<container cell_index="22" cell_metadata="{'ipub': {'equation': {'label': 'eqn:example_ipy'}}}" classes="cell" exec_count="6" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
Latex('$$ a = b+c $$')
<container classes="cell_output" nb_element="cell_code_output">
<math_block classes="output text_latex" nowrap="False" number="True" xml:space="preserve">
a = b+c
<paragraph>
The plotting code for a sympy equation (=@eqn:example_sympy).
<container cell_index="24" cell_metadata="{'ipub': {'code': {'asfloat': True, 'caption': '', 'label': 'code:example_sym', 'placement': 'H', 'widefigure': False}, 'equation': {'environment': 'equation', 'label': 'eqn:example_sympy'}}}" classes="cell" exec_count="7" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
y = sym.Function('y')
n = sym.symbols(r'\alpha')
f = y(n)-2*y(n-1/sym.pi)-5*y(n-2)
sym.rsolve(f,y(n),[1,4])
<container classes="cell_output" nb_element="cell_code_output">
<image candidates="{'*': '_build/jupyter_execute/8c43e5c8cccf697754876b7fec1b0a9b731d7900bb585e775a5fa326b4de8c5a.png'}" uri="_build/jupyter_execute/8c43e5c8cccf697754876b7fec1b0a9b731d7900bb585e775a5fa326b4de8c5a.png">
<container cell_index="25" cell_metadata="{}" classes="cell" exec_count="7" nb_element="cell_code">
<container classes="cell_input" nb_element="cell_code_source">
<literal_block language="ipython3" linenos="False" xml:space="preserve">
from IPython.display import display, Markdown
display(Markdown('**_some_ markdown**'))
<container classes="cell_output" nb_element="cell_code_output">
<paragraph>
<strong>
<emphasis>
some
markdown