Skip to content

Commit

Permalink
auto commit from showyourwork tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gh-actions committed Sep 11, 2024
1 parent 20cfe7e commit 3c7c246
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ jobs:
with:
fetch-depth: 0

- name: Install TinyTex for matplotlib LaTeX rendering
id: tinytex
shell: bash -l {0}
run: |
wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh
sudo ~/bin/tlmgr install type1cm cm-super
- name: Build the article PDF

id: build
uses: showyourwork/showyourwork-action@v1
with:
Expand All @@ -23,3 +31,4 @@ jobs:
SANDBOX_TOKEN: ${{ secrets.SANDBOX_TOKEN }}
OVERLEAF_EMAIL: ${{ secrets.OVERLEAF_EMAIL }}
OVERLEAF_PASSWORD: ${{ secrets.OVERLEAF_PASSWORD }}

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
</a>
</p>

An open source scientific article created using the [showyourwork](https://github.com/showyourwork/showyourwork) workflow.
*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).*

Test rendering TeX in matplotlib.
14 changes: 14 additions & 0 deletions src/scripts/test_figure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Ensure ~/bin is in the PATH so matplotlib can find latex
import os
from pathlib import Path
os.environ["PATH"] += os.pathsep + str(Path.home() / "bin")

import matplotlib.pyplot as plt
import paths
plt.rcParams.update({"text.usetex": True})
fig = plt.figure(figsize=(7, 6))
plt.plot([0, 1], [0, 1])
plt.xlabel(r'$\alpha \beta \frac{1}{2} \exp{-x^2}$')
fig.savefig(paths.figures / 'test_figure.pdf', bbox_inches='tight')

10 changes: 10 additions & 0 deletions src/tex/ms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ \section{Introduction}

\bibliography{bib}

\begin{figure}[ht!]
\script{test_figure.py}
\begin{centering}
\includegraphics[width=\linewidth]{figures/test_figure.pdf}
\caption{A test figure.}
\label{fig:test_figure}
\end{centering}
\end{figure}

\end{document}

0 comments on commit 3c7c246

Please sign in to comment.