Skip to content

Commit

Permalink
changed latex tagging convention
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jul 12, 2017
1 parent 19d8f80 commit 897d362
Show file tree
Hide file tree
Showing 8 changed files with 365 additions and 230 deletions.
80 changes: 56 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See ![notebooks/Example.ipynb](converted/Example.pdf) and ![converted/Example.pd
- [Latex Metadata Tags](#latex-metadata-tags)
- [Captions in a Markdown cell](#captions-in-a-markdown-cell)
- [Citations and Bibliography](#citations-and-bibliography)
- [Live Slideshows](#live-slideshows)
- [Dealing with external data](#dealing-with-external-data)
- [Miscellaneous](#miscellaneous)
- [Acknowledgements](#acknowledgements)
Expand Down Expand Up @@ -152,28 +153,37 @@ c.Exporter.template_file = 'created.tplx'

## Latex Metadata Tags

All information additional information, used to specify how a particular notebook/cell in latex is represented, is stored in the metadata under:

```json
{
"doc": {}
}
```

### Document Tags

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

```json
{
"latex_titlepage": {
"latex_doc": {
"titlepage": {
"author": "Authors Name",
"email": "authors@email.com",
"supervisors": [
"First Supervisor",
"Second Supervisor"
"First Supervisor",
"Second Supervisor"
],
"title": "Main-Title",
"subtitle": "Sub-Title",
"tagline": "A tagline for the report.",
"institution": [
"Institution1",
"Institution2"
"Institution1",
"Institution2"
],
"logo": "logo_example"
}
}
}
```

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

```json
{
"latex_toc": true,
"latex_listfigures": true,
"latex_listtables": true,
"latex_listcode": true,
"latex_doc": {
"toc": true,
"listfigures": true,
"listtables": true,
"listcode": true,
}
}
```

### Cell Tags

To **output ignore a markdown cell**:
To **ignore any cell**:

```json
{
"latex_ignore" : true
"latex_doc": {
"ignore" : true
}
}
```

To **output a code block**:

```json
{
"latex_code": {
"latex_doc": {
"code": {
"asfloat": true,
"caption": "",
"label": "code:example_sym",
"widefigure": false,
"placement": "H"
},
}
}
}
```

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

```json
{
"latex_figure": {
"caption": "Figure caption.",
"label": "fig:flabel",
"placement": "H",
"widefigure": false
}
"latex_doc": {
"figure": {
"caption": "Figure caption.",
"label": "fig:flabel",
"placement": "H",
"widefigure": false
}
}
}
```

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

```json
{
"latex_table": {
"latex_doc": {
"table": {
"caption": "Table caption.",
"label": "tbl:tlabel",
"placement": "H",
"alternate": "gray!20"
}
}
}
```

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

```json
{
"latex_equation": {
"latex_doc": {
"equation": {
"label": "eqn:elabel"
}
}
}
```

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

```json
{
"latex_caption": "fig:example_mpl"
"latex_doc": {
"caption": "fig:example_mpl"
}
}
```

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

```json
{
"latex_figure": {
"latex_doc": {
"figure": {
"caption": "",
"label": "fig:example_mpl"
}
}
}
```

Expand Down Expand Up @@ -337,6 +363,12 @@ Can use:

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

## Live Slideshows

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:

[![RISE Demo](https://img.youtube.com/vi/sXyFa_r1nxA/0.jpg)](https://www.youtube.com/watch?v=sXyFa_r1nxA)

## Dealing with external data

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:
Expand Down
Binary file modified converted/Example.pdf
Binary file not shown.
62 changes: 31 additions & 31 deletions converted/Example.tex
Original file line number Diff line number Diff line change
Expand Up @@ -452,23 +452,21 @@






\begingroup
\let\cleardoublepage\relax
\let\clearpage\relax\tableofcontents\listoffigures\listoftables\listof{codecell}{List of Code}
\endgroup
\begingroup
\let\cleardoublepage\relax
\let\clearpage\relax\tableofcontents\listoffigures\listoftables\listof{codecell}{List of Code}
\endgroup






\section{Markdown}\label{markdown}


\subsection{General}\label{general}


Some markdown text.

A list:
Expand All @@ -492,8 +490,10 @@ \subsection{General}\label{general}
something else
\end{enumerate}


\subsection{References and Citations}\label{references-and-citations}


References to \cref{fig:example}, \cref{tbl:example},
\cref{eqn:example_sympy} and \cref{code:example_mpl}.

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

A html citation.\cite{kirkeminde_thermodynamic_2012}


\subsection{Todo notes}\label{todo-notes}


\todo[inline]{an inline todo}

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


\section{Images and Figures}\label{images-and-figures}


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




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

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




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

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




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

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


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


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


\begin{codecell}
\ifdefined\kycodecexampleumpl
\caption{\kycodecexampleumpl}
Expand All @@ -600,7 +603,6 @@ \subsection{Displaying a plot with its
plt.legend();
\end{lstlisting}\end{codecell}


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

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

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


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


\begin{codecell}[H]
\ifdefined\kycodecexampleupd
\caption{\kycodecexampleupd}
Expand All @@ -632,19 +636,18 @@ \subsection{Displaying a plot with its
\end{lstlisting}\end{codecell}



\begin{table}[H]


\ifdefined\kytblcexample
\caption{\kytblcexample}
\else
\caption{An example of a table created with pandas dataframe.}
\fi
\label{tbl:example}

\ifdefined\kytblcexample
\caption{\kytblcexample}
\else
\caption{An example of a table created with pandas dataframe.}
\fi
\label{tbl:example}

\centering\rowcolors{2}{gray!20}{white}
\begin{tabular}{lllrr}
\centering\rowcolors{2}{gray!20}{white}
\begin{tabular}{lllrr}
\toprule
{} & a & b & c & d \\
\midrule
Expand All @@ -654,7 +657,7 @@ \subsection{Displaying a plot with its
\bottomrule
\end{tabular}

\end{table}
\end{table}



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


\begin{equation}\label{eqn:example_ipy}
a = b+c
\end{equation}
a = b+c
\end{equation}




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


\begin{codecell}[H]
\ifdefined\kycodecexampleusym
\caption{\kycodecexampleusym}
Expand All @@ -689,18 +693,14 @@ \section{Equations (with ipython or
\end{lstlisting}\end{codecell}



\begin{equation}\label{eqn:example_sympy}
\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)
\end{equation}
\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)
\end{equation}











Expand Down

0 comments on commit 897d362

Please sign in to comment.