Skip to content

Commit 897d362

Browse files
committed
changed latex tagging convention
1 parent 19d8f80 commit 897d362

File tree

8 files changed

+365
-230
lines changed

8 files changed

+365
-230
lines changed

README.md

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See ![notebooks/Example.ipynb](converted/Example.pdf) and ![converted/Example.pd
1414
- [Latex Metadata Tags](#latex-metadata-tags)
1515
- [Captions in a Markdown cell](#captions-in-a-markdown-cell)
1616
- [Citations and Bibliography](#citations-and-bibliography)
17+
- [Live Slideshows](#live-slideshows)
1718
- [Dealing with external data](#dealing-with-external-data)
1819
- [Miscellaneous](#miscellaneous)
1920
- [Acknowledgements](#acknowledgements)
@@ -152,28 +153,37 @@ c.Exporter.template_file = 'created.tplx'
152153

153154
## Latex Metadata Tags
154155

156+
All information additional information, used to specify how a particular notebook/cell in latex is represented, is stored in the metadata under:
157+
158+
```json
159+
{
160+
"doc": {}
161+
}
162+
```
163+
155164
### Document Tags
156165

157166
For **titlepage**, enter in notebook metadata:
158167

159168
```json
160169
{
161-
"latex_titlepage": {
170+
"latex_doc": {
171+
"titlepage": {
162172
"author": "Authors Name",
163173
"email": "[email protected]",
164174
"supervisors": [
165-
"First Supervisor",
166-
"Second Supervisor"
175+
"First Supervisor",
176+
"Second Supervisor"
167177
],
168178
"title": "Main-Title",
169179
"subtitle": "Sub-Title",
170180
"tagline": "A tagline for the report.",
171181
"institution": [
172-
"Institution1",
173-
"Institution2"
182+
"Institution1",
183+
"Institution2"
174184
],
175185
"logo": "logo_example"
176-
}
186+
}
177187
}
178188
```
179189

@@ -186,34 +196,40 @@ To control the output of **contents tables**:
186196

187197
```json
188198
{
189-
"latex_toc": true,
190-
"latex_listfigures": true,
191-
"latex_listtables": true,
192-
"latex_listcode": true,
199+
"latex_doc": {
200+
"toc": true,
201+
"listfigures": true,
202+
"listtables": true,
203+
"listcode": true,
204+
}
193205
}
194206
```
195207

196208
### Cell Tags
197209

198-
To **output ignore a markdown cell**:
210+
To **ignore any cell**:
199211

200212
```json
201213
{
202-
"latex_ignore" : true
214+
"latex_doc": {
215+
"ignore" : true
216+
}
203217
}
204218
```
205219

206220
To **output a code block**:
207221

208222
```json
209223
{
210-
"latex_code": {
224+
"latex_doc": {
225+
"code": {
211226
"asfloat": true,
212227
"caption": "",
213228
"label": "code:example_sym",
214229
"widefigure": false,
215230
"placement": "H"
216-
},
231+
}
232+
}
217233
}
218234
```
219235

@@ -227,12 +243,14 @@ For **figures**, enter in cell metadata:
227243

228244
```json
229245
{
230-
"latex_figure": {
231-
"caption": "Figure caption.",
232-
"label": "fig:flabel",
233-
"placement": "H",
234-
"widefigure": false
235-
}
246+
"latex_doc": {
247+
"figure": {
248+
"caption": "Figure caption.",
249+
"label": "fig:flabel",
250+
"placement": "H",
251+
"widefigure": false
252+
}
253+
}
236254
}
237255
```
238256

@@ -243,12 +261,14 @@ For **tables**, enter in cell metadata:
243261

244262
```json
245263
{
246-
"latex_table": {
264+
"latex_doc": {
265+
"table": {
247266
"caption": "Table caption.",
248267
"label": "tbl:tlabel",
249268
"placement": "H",
250269
"alternate": "gray!20"
251270
}
271+
}
252272
}
253273
```
254274

@@ -260,9 +280,11 @@ For **equations**, enter in cell metadata:
260280

261281
```json
262282
{
263-
"latex_equation": {
283+
"latex_doc": {
284+
"equation": {
264285
"label": "eqn:elabel"
265286
}
287+
}
266288
}
267289
```
268290

@@ -276,7 +298,9 @@ If a **markdown cell** has the metadata tag:
276298

277299
```json
278300
{
279-
"latex_caption": "fig:example_mpl"
301+
"latex_doc": {
302+
"caption": "fig:example_mpl"
303+
}
280304
}
281305
```
282306

@@ -289,10 +313,12 @@ If a subsequent **figure, table or code** cell has a label matching any stored v
289313

290314
```json
291315
{
292-
"latex_figure": {
316+
"latex_doc": {
317+
"figure": {
293318
"caption": "",
294319
"label": "fig:example_mpl"
295320
}
321+
}
296322
}
297323
```
298324

@@ -337,6 +363,12 @@ Can use:
337363

338364
to make it look better in html, but not specifically available for drag and drop in Zotero
339365

366+
## Live Slideshows
367+
368+
The [Reveal.js - Jupyter/IPython Slideshow Extension (RISE)](https://github.com/damianavila/RISE) notebook extension offers rendering as a Reveal.js-based slideshow, where you can execute code or show to the audience whatever you can show/do inside the notebook itself! Click on the image to see a demo:
369+
370+
[![RISE Demo](https://img.youtube.com/vi/sXyFa_r1nxA/0.jpg)](https://www.youtube.com/watch?v=sXyFa_r1nxA)
371+
340372
## Dealing with external data
341373

342374
A goal for scientific publishing is automated reproducibility of analyses, which the Jupyter notebook excels at. But, more than that, it should be possible to efficiently reproduce the analysis with different data sets. This entails having **one point of access** to a data set within the notebook, rather than having copy-pasted data into variables, i.e. this:

converted/Example.pdf

0 Bytes
Binary file not shown.

converted/Example.tex

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -452,23 +452,21 @@
452452

453453

454454

455-
456-
457-
458-
\begingroup
459-
\let\cleardoublepage\relax
460-
\let\clearpage\relax\tableofcontents\listoffigures\listoftables\listof{codecell}{List of Code}
461-
\endgroup
455+
\begingroup
456+
\let\cleardoublepage\relax
457+
\let\clearpage\relax\tableofcontents\listoffigures\listoftables\listof{codecell}{List of Code}
458+
\endgroup
462459

463460

464461

465462

466463

467-
468464
\section{Markdown}\label{markdown}
469465

466+
470467
\subsection{General}\label{general}
471468

469+
472470
Some markdown text.
473471

474472
A list:
@@ -492,8 +490,10 @@ \subsection{General}\label{general}
492490
something else
493491
\end{enumerate}
494492

493+
495494
\subsection{References and Citations}\label{references-and-citations}
496495

496+
497497
References to \cref{fig:example}, \cref{tbl:example},
498498
\cref{eqn:example_sympy} and \cref{code:example_mpl}.
499499

@@ -504,12 +504,15 @@ \subsection{References and Citations}\label{references-and-citations}
504504

505505
A html citation.\cite{kirkeminde_thermodynamic_2012}
506506

507+
507508
\subsection{Todo notes}\label{todo-notes}
508509

510+
509511
\todo[inline]{an inline todo}
510512

511513
Some text.\todo{a todo in the margins}
512514

515+
513516
\section{Images and Figures}\label{images-and-figures}
514517

515518

@@ -532,7 +535,6 @@ \section{Images and Figures}\label{images-and-figures}
532535

533536

534537

535-
536538
\begin{figure}
537539
\begin{center}\adjustimage{max size={0.9\linewidth}{0.4\paperheight}}{Example_files/Example_10_0.png}\end{center}
538540

@@ -549,7 +551,6 @@ \section{Images and Figures}\label{images-and-figures}
549551

550552

551553

552-
553554
\begin{figure}
554555
\begin{center}\adjustimage{max size={0.9\linewidth}{0.4\paperheight}}{Example_files/Example_11_0.png}\end{center}
555556

@@ -566,7 +567,6 @@ \section{Images and Figures}\label{images-and-figures}
566567

567568

568569

569-
570570
\begin{figure}
571571
\begin{center}\adjustimage{max size={0.9\linewidth}{0.4\paperheight}}{Example_files/Example_12_0.png}\end{center}
572572

@@ -583,10 +583,13 @@ \section{Images and Figures}\label{images-and-figures}
583583
\subsection{Displaying a plot with its
584584
code}\label{displaying-a-plot-with-its-code}
585585

586+
586587
\newcommand{\kyfigcexampleumpl}{A matplotlib figure, with the caption set in the markdowncell above the figure.}
587588

589+
588590
\newcommand{\kycodecexampleumpl}{The plotting code for a matplotlib figure (\cref{fig:example_mpl}).}
589591

592+
590593
\begin{codecell}
591594
\ifdefined\kycodecexampleumpl
592595
\caption{\kycodecexampleumpl}
@@ -600,7 +603,6 @@ \subsection{Displaying a plot with its
600603
plt.legend();
601604
\end{lstlisting}\end{codecell}
602605

603-
604606
\begin{figure}
605607
\begin{center}\adjustimage{max size={0.9\linewidth}{0.4\paperheight}}{Example_files/Example_16_0.pdf}\end{center}
606608

@@ -615,8 +617,10 @@ \subsection{Displaying a plot with its
615617

616618
\section{Tables (with pandas)}\label{tables-with-pandas}
617619

620+
618621
\newcommand{\kycodecexampleupd}{The plotting code for a pandas Dataframe table (\cref{tbl:example}).}
619622

623+
620624
\begin{codecell}[H]
621625
\ifdefined\kycodecexampleupd
622626
\caption{\kycodecexampleupd}
@@ -632,19 +636,18 @@ \subsection{Displaying a plot with its
632636
\end{lstlisting}\end{codecell}
633637

634638

635-
636639
\begin{table}[H]
637640

641+
642+
\ifdefined\kytblcexample
643+
\caption{\kytblcexample}
644+
\else
645+
\caption{An example of a table created with pandas dataframe.}
646+
\fi
647+
\label{tbl:example}
638648

639-
\ifdefined\kytblcexample
640-
\caption{\kytblcexample}
641-
\else
642-
\caption{An example of a table created with pandas dataframe.}
643-
\fi
644-
\label{tbl:example}
645-
646-
\centering\rowcolors{2}{gray!20}{white}
647-
\begin{tabular}{lllrr}
649+
\centering\rowcolors{2}{gray!20}{white}
650+
\begin{tabular}{lllrr}
648651
\toprule
649652
{} & a & b & c & d \\
650653
\midrule
@@ -654,7 +657,7 @@ \subsection{Displaying a plot with its
654657
\bottomrule
655658
\end{tabular}
656659

657-
\end{table}
660+
\end{table}
658661

659662

660663

@@ -667,14 +670,15 @@ \section{Equations (with ipython or
667670

668671

669672
\begin{equation}\label{eqn:example_ipy}
670-
a = b+c
671-
\end{equation}
673+
a = b+c
674+
\end{equation}
672675

673676

674677

675678

676679
\newcommand{\kycodecexampleusym}{The plotting code for a sympy equation (\cref{eqn:example_sympy}).}
677680

681+
678682
\begin{codecell}[H]
679683
\ifdefined\kycodecexampleusym
680684
\caption{\kycodecexampleusym}
@@ -689,18 +693,14 @@ \section{Equations (with ipython or
689693
\end{lstlisting}\end{codecell}
690694

691695

692-
693696
\begin{equation}\label{eqn:example_sympy}
694-
\left(\sqrt{5} i\right)^{\alpha} \left(\frac{1}{2} - \frac{2 i}{5} \sqrt{5}\right) + \left(- \sqrt{5} i\right)^{\alpha} \left(\frac{1}{2} + \frac{2 i}{5} \sqrt{5}\right)
695-
\end{equation}
697+
\left(\sqrt{5} i\right)^{\alpha} \left(\frac{1}{2} - \frac{2 i}{5} \sqrt{5}\right) + \left(- \sqrt{5} i\right)^{\alpha} \left(\frac{1}{2} + \frac{2 i}{5} \sqrt{5}\right)
698+
\end{equation}
696699

697700

698701

699702

700703

701-
702-
703-
704704

705705

706706

0 commit comments

Comments
 (0)