forked from stsievert/rst-to-ipynb
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathall.rst
252 lines (164 loc) · 3.93 KB
/
all.rst
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# This file is built automatically; don't edit
Code blocks
-----------
.. code:: python
this = 'is a code block'
x = 1
no = 'really!'
p = argwhere(x == 2)
.. code:: python
from pylab import linspace
t = linspace(0, 1)
x = t**2
::
from pylab import *
x = logspace(0, 1)
y = x**2
figure()
plot(x, y)
show()
Support for Python doctest code blocks::
>>> 1+1
2
>>> for x in range(3):
... print x
0
1
2
>>> x = 1
>>> x = 2
Sage code blocks
----------------
Complexité de l'algorithme de tri de Python
===========================================
::
sage: 1+1
2
sage: for x in range(3):
....: print x
0
1
2
Two sage commands without intermediate output get joined in a single
input cell; no output is produced if none is specified::
sage: 1+1
sage: 2+2
sage: 3+3
#. Nested code block A
::
sage: 1+1
#. Nested code block B
::
sage: 1+1
#. Nested code block C (failing: the inner indent should match the itemized text indent)
::
sage: 1+1
.. TOPIC:: A doubly nested sage code block
#. Calculer le plus grand élément d'une liste
::
sage: 1+1
::
sage: def plus_grand_element(liste):
....: """
....: Renvoie le plus grand élément de la liste
....: EXAMPLES::
....: sage: plus_grand_element([7,3,1,10,4,10,2,9])
....: 10
....: sage: plus_grand_element([7])
....: 7
....: """
....: resultat = liste[0]
....: for i in range(1, len(liste)-1):
....: # Invariant: resultat est le plus grand element de liste[:i]
....: assert resultat in liste[:i]
....: assert all(resultat >= x for x in liste[:i])
....: if liste[i] > resultat:
....: resultat = liste[i]
....: return resultat
sage: plus_grand_element([7,3,1,10,4,10,2,9])
10
Foo (Failing).
Bla::
sage: 1+1
Don't forget the mandatory new line after `::` ::
sage: 1+1
.. NOTE::
Blah (Failing)::
sage: 1+1
Foo (Failing)::
sage: 1+1
.. TOPIC:: Note
Blah::
sage: 1+1
Foo::
sage: 1+1
Complexité de l'algorithme de tri de Python
===========================================
.. TOPIC:: Exercice
#. Estimer la complexité de la fonction suivante
::
sage: def fusion(l1, l2):
....: sort(l1+l2)
Images
------
.. image:: hood.jpg
:width: 60 %
List
----
Bullets
~~~~~~~
- b1
- b2
- b3
List
~~~~
1. l1
2. l2
3. l3
Math
----
Inline maths with math role: `x^3+\frac{1+\sqrt{2}}{\pi}`
Inline maths with default role: :math:`x^3+\frac{1+\sqrt{2}}{\pi}`
Inline maths using dollar signs (not supported yet): $x^3+\frac{1+\sqrt{2}}{\pi}$
.. MATH::
x^3+\frac{1+\sqrt{2}}{\pi}
Quote
-----
This is a quote!
Table
-----
A simple table:
+------+------+
| C1 | C2 |
+------+------+
| a | b |
+------+------+
| c | d |
+------+------+
A table with more formatting:
+------+------+
| C1 | C2 |
+======+======+
| a | b |
+------+------+
| c | d |
+------+------+
Topics
------
.. TOPIC:: Definition
Hello, this is a block definition
Some more text
#. An enumeration
.. TOPIC:: Note
A nested topic within the enumeration within a topic
Back to the item
#. Next item
Links
-----
A link: `images <images.ipynb>`_
rst2ipynb implements some very crude support for ref links; the links
below will point to `images.ipynb`, allowing at least to refer to
other documents in the same directory without hardcoding the .ipynb
extension in the source file.
- :ref:`images`
- :ref:`Les Images <images>`