From d9d65f8eb98bbe604f826695ee529bcfcda341d3 Mon Sep 17 00:00:00 2001 From: Konstantin Taletskiy Date: Wed, 29 Sep 2021 16:25:53 -0700 Subject: [PATCH 1/4] Add notebook_config and enable multi-pass compile --- binder/jupyter_notebook_config.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 binder/jupyter_notebook_config.py diff --git a/binder/jupyter_notebook_config.py b/binder/jupyter_notebook_config.py new file mode 100644 index 0000000..efb43b4 --- /dev/null +++ b/binder/jupyter_notebook_config.py @@ -0,0 +1 @@ +c.LatexConfig.run_times = 2 \ No newline at end of file From 631230821d5bf15cac23cb1fb42d91df31da714c Mon Sep 17 00:00:00 2001 From: Konstantin Taletskiy Date: Wed, 29 Sep 2021 16:38:47 -0700 Subject: [PATCH 2/4] Add start script for Binder --- binder/start | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 binder/start diff --git a/binder/start b/binder/start new file mode 100644 index 0000000..7336366 --- /dev/null +++ b/binder/start @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import sys +import shutil +import os + +argv = sys.argv[1:] + ['--config', 'binder/jupyter_notebook_config.py'] +print(argv) + +with open('startup_args.txt', 'w') as fid: + fid.write(str(argv)) + +os.execv(shutil.which(argv[0]), argv) \ No newline at end of file From 6dec587a60a9ab40fa365fbb772f101947bf1ec0 Mon Sep 17 00:00:00 2001 From: Konstantin Taletskiy Date: Wed, 29 Sep 2021 17:02:50 -0700 Subject: [PATCH 3/4] Update sample to include references --- sample.tex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sample.tex b/sample.tex index 790ef67..2e74d75 100644 --- a/sample.tex +++ b/sample.tex @@ -22,6 +22,7 @@ \section{Introduction} \begin{equation} \rho \left( \frac{\partial \mathbf{u}}{\partial t} + \mathbf{u} \cdot \nabla \mathbf{u} \right) = -\nabla P + \eta \nabla^2 \mathbf{u} + \rho \mathbf{g}. +\label{eq:Navier–Stokes} \end{equation} \\ \\ @@ -36,6 +37,8 @@ \section{Introduction} \end{tabular} \end{center} +We can reference equations by their numbers, i.e. Equation (\ref{eq:Navier–Stokes}). + \subsection{We can add new subsections} And we can include images, such as the Jupyter logo: \begin{center} From 093117ff06229f1f39c1306d0884ec5ea1503f73 Mon Sep 17 00:00:00 2001 From: Konstantin Taletskiy Date: Wed, 29 Sep 2021 17:04:44 -0700 Subject: [PATCH 4/4] Update docs to introduce c.LatexConfig.run_times --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 73b492f..9758ffc 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,13 @@ by setting c.LatexConfig.bib_command = '' ``` +To render references (`\ref{...}`), such as equation or chapter numbers, you would +need to compile in multiple passes by setting + +```python +c.LatexConfig.run_times = 2 +``` + ### Security and customizing shell escapes LaTeX files have the ability to run arbitrary code by triggering external