Skip to content

Commit

Permalink
Merge pull request #185 from ktaletsk/issue-122
Browse files Browse the repository at this point in the history
Update documentation and Binder with c.LatexConfig.run_times
  • Loading branch information
ktaletsk authored Apr 12, 2022
2 parents 1fd753e + 093117f commit 9953945
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ by setting
c.LatexConfig.bib_command = '<custom_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
Expand Down
1 change: 1 addition & 0 deletions binder/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c.LatexConfig.run_times = 2
12 changes: 12 additions & 0 deletions binder/start
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions sample.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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:NavierStokes}
\end{equation}
\\
\\
Expand All @@ -36,6 +37,8 @@ \section{Introduction}
\end{tabular}
\end{center}

We can reference equations by their numbers, i.e. Equation (\ref{eq:NavierStokes}).

\subsection{We can add new subsections}
And we can include images, such as the Jupyter logo:
\begin{center}
Expand Down

0 comments on commit 9953945

Please sign in to comment.