Skip to content

Commit 3f4bb37

Browse files
author
gh-actions
committed
auto commit from showyourwork tests
1 parent 68cdfee commit 3f4bb37

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

.github/workflows/build.yml

+9
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17+
- name: Install TinyTex for matplotlib LaTeX rendering
18+
id: tinytex
19+
shell: bash -l {0}
20+
run: |
21+
wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh
22+
sudo ~/bin/tlmgr install type1cm cm-super
23+
1724
- name: Build the article PDF
25+
1826
id: build
1927
uses: showyourwork/showyourwork-action@v1
2028
with:
2129
showyourwork-spec: git+https://github.com/showyourwork/showyourwork.git@2898ce68e999a76ee87a23c31d34d2e9448509d2#egg=showyourwork
2230
env:
2331
SANDBOX_TOKEN: ${{ secrets.SANDBOX_TOKEN }}
2432
OVERLEAF_TOKEN: ${{ secrets.OVERLEAF_TOKEN }}
33+

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
</a>
1616
</p>
1717

18-
An open source scientific article created using the [showyourwork](https://github.com/showyourwork/showyourwork) workflow.
18+
*This is an automatically generated test for [showyourwork](https://github.com/showyourwork/showyourwork) generated from the file [test_latex.py](https://github.com/showyourwork/showyourwork/blob/main/tests/integration/test_latex.py).*
19+
20+
Test rendering TeX in matplotlib.

src/scripts/test_figure.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
# Ensure ~/bin is in the PATH so matplotlib can find latex
3+
import os
4+
from pathlib import Path
5+
os.environ["PATH"] += os.pathsep + str(Path.home() / "bin")
6+
7+
import matplotlib.pyplot as plt
8+
import paths
9+
plt.rcParams.update({"text.usetex": True})
10+
fig = plt.figure(figsize=(7, 6))
11+
plt.plot([0, 1], [0, 1])
12+
plt.xlabel(r'$\alpha \beta \frac{1}{2} \exp{-x^2}$')
13+
fig.savefig(paths.figures / 'test_figure.pdf', bbox_inches='tight')
14+

src/tex/ms.tex

+10
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,14 @@ \section{Introduction}
5454

5555
\bibliography{bib}
5656

57+
\begin{figure}[ht!]
58+
\script{test_figure.py}
59+
\begin{centering}
60+
\includegraphics[width=\linewidth]{figures/test_figure.pdf}
61+
\caption{A test figure.}
62+
\label{fig:test_figure}
63+
\end{centering}
64+
\end{figure}
65+
5766
\end{document}
67+

0 commit comments

Comments
 (0)