Skip to content

Latex #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/latex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Convert Notebooks to LaTeX
on:
push

permissions:
contents: write

jobs:
convert:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install jupyter and nbconvert
run: |
python -m pip install --upgrade pip
pip install jupyter nbconvert

- name: Install pandoc
run: |
sudo apt-get install pandoc

- name: Install LateX
run: |
sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-plain-generic

- name: Create artifact directory
run: |
mkdir -p artifacts/latex
rm -rf artifacts/latex/* # Clean any existing files

- name: Convert notebooks to LaTeX
run: |
# Find all notebooks in the repository
NOTEBOOKS=$(find . -name "*.ipynb" -not -path "*/\.*" -not -path "*/artifacts/*")

# Convert each notebook
for nb in $NOTEBOOKS; do
echo "Converting $nb to LaTeX..."

# Get the base name without path and extension
base_name=$(basename "$nb" .ipynb)

# Convert to Rmd in the artifacts directory
jupyter nbconvert --to latex "$nb" --output "artifacts/latex/${base_name}"

# Do not activate this for now as more work is required to make it work
# xelatex artifacts/latex/${base_name}.tex -o artifacts/latex/${base_name}.pdf
done

- name: GitHub Pages action
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: latex-files # The branch the action should deploy to.
folder: artifacts/latex # The folder the action should deploy.
Loading