diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9cb0402..14822fa 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -57,22 +57,30 @@ jobs: sudo apt install -qq ghostscript fonts-freefont-otf # https://stackoverflow.com/a/69012150 sed -ri 's#^(\s*baseurl:).*#\1 ${{ steps.pages.outputs.base_url }}/'$SITE_PREFIX'#g' _config.yml jupyter-book build --builder dirhtml --warningiserror --nitpick --keep-going . - jupyter-book build --builder latex . - # insert PDF cover + jupyter-book build --builder latex --warningiserror --nitpick --keep-going . cd _build/latex - curl -fsSLO https://static.premai.io/book/cover.pdf - sed -i -r \ - -e 's/(\\documentclass.*)letterpaper(.*)/\1a4paper\2/' \ - -e 's/(\\usepackage\{geometry\})/\1\n\\usepackage\{pdfpages\}/' \ - -e 's/\\sphinxmaketitle/\\includepdf\[pages=-\]\{cover.pdf\}/' \ - -e 's/\\sphinxtableofcontents//' \ + # fix contrib.rocks + mv state-of-open-source-ai contrib-rocks.svg + convert contrib-rocks.svg contrib-rocks.png || : + sed -ri 's/(.*includegraphics\{\{)state-of-open-source-ai(\}\}.*)/\1contrib-rocks.png\2/g' book.tex + # fix undefined in FreeFont + sed -ri \ + -e 's/[🆕🌈🎉💪💬💻📝📥🔠🔌🛠␂↔️⚙️]//g' \ + -e 's/🔴/☒/g' \ + -e 's/🟡/☐/g' \ + -e 's/🟢/☑/g' \ book.tex + # insert PDF cover + curl -fsSLO https://static.premai.io/book/cover.pdf env: {PYTHONPATH: .} - uses: xu-cheng/latex-action@v3 with: working_directory: _build/latex root_file: book.tex args: -pdf -dvi- -ps- -file-line-error -f -interaction=nonstopmode + latexmk_use_xelatex: true + env: + XINDYOPTS: -L english -C utf8 -M sphinx.xdy continue-on-error: true - name: prepare _site pages run: | diff --git a/_config.yml b/_config.yml index 57a8ded..eef358a 100644 --- a/_config.yml +++ b/_config.yml @@ -80,7 +80,6 @@ parse: - tasklist sphinx: extra_extensions: - - sphinxemoji.sphinxemoji - sphinx_last_updated_by_git - sphinx_subfigure # custom (local *.py files) @@ -132,6 +131,16 @@ sphinx: html_last_updated_fmt: '%d %b %Y' jblatex_show_tocs: false bibtex_reference_style: label + latex_elements: + papersize: a4paper + # requires https://static.premai.io/book/cover.pdf + extrapackages: \usepackage{pdfpages} + maketitle: \includepdf[pages=-]{cover.pdf} + tableofcontents: '' + # fix citations in figure captions (https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/276) + preamble: | + \usepackage{etoolbox} + \AtBeginEnvironment{figure}{\pretocmd{\hyperlink}{\protect}{}{}} bibtex_bibfiles: [references.bib] # citations latex: # for PDF builds latex_documents: diff --git a/index.md b/index.md index efcca19..1f76f0b 100644 --- a/index.md +++ b/index.md @@ -84,11 +84,9 @@ Spot something outdated or missing? Want to start a discussion? We welcome any o ### Formatting -````{note} -```{eval-rst} -Don't worry about making it perfect, it's fine to open a (`draft `_) PR and `allow edits from maintainers `_ to fix it |:heart:| +```{note} +Don't worry about making it perfect, it's fine to open a ([draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests)) PR and [allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) to fix it ♥ ``` -```` - [Quickstart](https://jupyterbook.org/en/stable/reference/cheatsheet.html) - [Full reference](https://jupyterbook.org/en/stable/content/myst.html) diff --git a/requirements.txt b/requirements.txt index d5a91b2..7a66122 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ jupyter-book -sphinxemoji sphinx-last-updated-by-git # TODO: remove after https://github.com/executablebooks/jupyter-book/pull/2048 docutils!=0.18.*,!=0.19.*,!=0.20.0