Skip to content

Commit 9953945

Browse files
authored
Merge pull request #185 from ktaletsk/issue-122
Update documentation and Binder with c.LatexConfig.run_times
2 parents 1fd753e + 093117f commit 9953945

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ by setting
8989
c.LatexConfig.bib_command = '<custom_bib_command>'
9090
```
9191

92+
To render references (`\ref{...}`), such as equation or chapter numbers, you would
93+
need to compile in multiple passes by setting
94+
95+
```python
96+
c.LatexConfig.run_times = 2
97+
```
98+
9299
### Security and customizing shell escapes
93100

94101
LaTeX files have the ability to run arbitrary code by triggering external

binder/jupyter_notebook_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c.LatexConfig.run_times = 2

binder/start

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
import sys
3+
import shutil
4+
import os
5+
6+
argv = sys.argv[1:] + ['--config', 'binder/jupyter_notebook_config.py']
7+
print(argv)
8+
9+
with open('startup_args.txt', 'w') as fid:
10+
fid.write(str(argv))
11+
12+
os.execv(shutil.which(argv[0]), argv)

sample.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ \section{Introduction}
2222
\begin{equation}
2323
\rho \left( \frac{\partial \mathbf{u}}{\partial t} + \mathbf{u} \cdot \nabla \mathbf{u} \right) =
2424
-\nabla P + \eta \nabla^2 \mathbf{u} + \rho \mathbf{g}.
25+
\label{eq:NavierStokes}
2526
\end{equation}
2627
\\
2728
\\
@@ -36,6 +37,8 @@ \section{Introduction}
3637
\end{tabular}
3738
\end{center}
3839

40+
We can reference equations by their numbers, i.e. Equation (\ref{eq:NavierStokes}).
41+
3942
\subsection{We can add new subsections}
4043
And we can include images, such as the Jupyter logo:
4144
\begin{center}

0 commit comments

Comments
 (0)