{"version":3,"kind":"Article","sha256":"14c7105d9ffa94dd652476478831988414b50fe47c84722624dbe351089856ba","slug":"c-pdfoutput","location":"/content/lessons/6c_pdfoutput.md","dependencies":[],"frontmatter":{"title":"Create a PDF 🌶","numbering":{"title":{"offset":1,"enabled":true}},"content_includes_title":false,"authors":[{"nameParsed":{"literal":"Freek Pols","given":"Freek","family":"Pols"},"name":"Freek Pols","id":"contributors-myst-generated-uid-0"},{"nameParsed":{"literal":"Luuk Fröling","given":"Luuk","family":"Fröling"},"name":"Luuk Fröling","id":"contributors-myst-generated-uid-1"},{"nameParsed":{"literal":"Robert Lanzafame","given":"Robert","family":"Lanzafame"},"name":"Robert Lanzafame","id":"contributors-myst-generated-uid-2"},{"nameParsed":{"literal":"Kirstie Whitaker","given":"Kirstie","family":"Whitaker"},"name":"Kirstie Whitaker","id":"contributors-myst-generated-uid-3"},{"nameParsed":{"literal":"Jim Madge","given":"Jim","family":"Madge"},"name":"Jim Madge","id":"contributors-myst-generated-uid-4"}],"date":"2025-11-02","license":{"content":{"id":"CC-BY-4.0","url":"https://creativecommons.org/licenses/by/4.0/","name":"Creative Commons Attribution 4.0 International","free":true,"CC":true}},"github":"https://github.com/jupyter-book/workshop-template","edit_url":null,"abbreviations":{"JB2":"Jupyter Book 2","CI/CD":"Continuous Integration/Continuous Deployment","GHA":"GitHub Actions","GH":"GitHub","IDE":"Integrated Development Environment","VSC":"Visual Studio Code","CLI":"commmand line interface"},"source_url":"https://github.com/jupyter-book/workshop-template/blob/main/content/lessons/6c_pdfoutput.md","enumerator":"8.3","exports":[{"format":"md","filename":"6c_pdfoutput.md","url":"/build/6c_pdfoutput-14ce37bf088fbbdeb470970755fd07b4.md"}]},"mdast":{"type":"root","children":[{"type":"div","class":"font-light text-sm mb-4 updated-date-container","children":[{"type":"text","value":"Updated: 03 Nov 2025","key":"UDPfrNbRpr"}],"key":"nBQMYGyAm9"},{"type":"block","children":[{"type":"paragraph","position":{"start":{"line":9,"column":1},"end":{"line":9,"column":1}},"children":[{"type":"text","value":"With a general understanding of document creation using MyST and our choice to use Typst for PDF generation, you are ready to create a PDF from your book repository using Jupyter Book.","position":{"start":{"line":9,"column":1},"end":{"line":9,"column":1}},"key":"XFG1lHV2I8"}],"key":"YjI7JDJjr8"},{"type":"paragraph","position":{"start":{"line":11,"column":1},"end":{"line":11,"column":1}},"children":[{"type":"text","value":"In this lesson, we will:","position":{"start":{"line":11,"column":1},"end":{"line":11,"column":1}},"key":"jrf6ZhJMmX"}],"key":"R97ZFkeZqY"},{"type":"list","ordered":false,"spread":false,"position":{"start":{"line":12,"column":1},"end":{"line":17,"column":1}},"children":[{"type":"listItem","spread":true,"position":{"start":{"line":12,"column":1},"end":{"line":12,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Install Typst (or use it within a GitHub Action workflow if working online-only)","position":{"start":{"line":12,"column":1},"end":{"line":12,"column":1}},"key":"yhvPrUFnpf"}],"key":"o8bhZJZNoa"}],"key":"DrZZWvJ1nf"},{"type":"listItem","spread":true,"position":{"start":{"line":13,"column":1},"end":{"line":13,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Generate a PDF using the ","position":{"start":{"line":13,"column":1},"end":{"line":13,"column":1}},"key":"REneP25Gku"},{"type":"inlineCode","value":"lapreprint-typst","position":{"start":{"line":13,"column":1},"end":{"line":13,"column":1}},"key":"tYF6pqIAh6"},{"type":"text","value":" template","position":{"start":{"line":13,"column":1},"end":{"line":13,"column":1}},"key":"CW7tM8woa7"}],"key":"igfDo9PXxU"}],"key":"ScXnPSKvbx"},{"type":"listItem","spread":true,"position":{"start":{"line":14,"column":1},"end":{"line":14,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Set up and use the ","position":{"start":{"line":14,"column":1},"end":{"line":14,"column":1}},"key":"zUk33ZX8vt"},{"type":"inlineCode","value":"plain_typst_book","position":{"start":{"line":14,"column":1},"end":{"line":14,"column":1}},"key":"HpLWkQE3nn"},{"type":"text","value":" template","position":{"start":{"line":14,"column":1},"end":{"line":14,"column":1}},"key":"KVPScBUMnn"}],"key":"BfnO7wwvjP"}],"key":"A4QxgeOoyY"},{"type":"listItem","spread":true,"position":{"start":{"line":15,"column":1},"end":{"line":15,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Modify the GitHub Action workflow to generate a PDF","position":{"start":{"line":15,"column":1},"end":{"line":15,"column":1}},"key":"xysDaDVRB9"}],"key":"t3GRP3fcGY"}],"key":"NCPbMh1dTx"},{"type":"listItem","spread":true,"position":{"start":{"line":16,"column":1},"end":{"line":17,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Explore how the PDF can be customized and shared via the book website","position":{"start":{"line":16,"column":1},"end":{"line":16,"column":1}},"key":"G92MJP1P4x"}],"key":"khLE4HbcOg"}],"key":"LwOfnhFac7"}],"key":"T62vEUeyTw"},{"type":"admonition","kind":"warning","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Warning","key":"gDdIfDtpwG"}],"key":"M7hG6g5heJ"},{"type":"paragraph","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"children":[{"type":"text","value":"To complete this lesson locally, you will need to install Typst. If this is not possible, or you are following the online-only path, you can complete the exercises using GitHub Actions. As before, the exercises in this lesson use ","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"key":"E0z1psy7uq"},{"type":"strong","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"children":[{"type":"text","value":"Locally","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"key":"tc2AvmqxIL"}],"key":"r3bH2guBRx"},{"type":"text","value":" and ","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"key":"MZ0JCXYzwG"},{"type":"strong","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"children":[{"type":"text","value":"Online","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"key":"XHgS925RcH"}],"key":"YfHagX2B4K"},{"type":"text","value":" to distinguish instructions for each case.","position":{"start":{"line":19,"column":1},"end":{"line":19,"column":1}},"key":"CF8uuC4a0l"}],"key":"UEaTNnVWkr"},{"type":"paragraph","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"children":[{"type":"text","value":"This lesson also uses GitHub Actions for ","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"key":"DJprQfjING"},{"type":"emphasis","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"children":[{"type":"text","value":"both","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"key":"idBG6vWory"}],"key":"osXgH0unHp"},{"type":"text","value":" local and online approaches. If you struggle with some of the ","key":"AtxqukMf0I"},{"type":"abbreviation","title":"GitHub Actions","children":[{"type":"text","value":"GHA","key":"c7vFs7Zss4"}],"key":"FpIqdg8e4b"},{"type":"text","value":" exercises below, refer to ","key":"n6GgaoaYyk"},{"type":"link","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"children":[{"type":"text","value":"the previous lesson","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"key":"aOTFst2kF0"}],"identifier":"gha-workflows","label":"gha-workflows","url":"/workflows","internal":true,"dataUrl":"/workflows.json","key":"kPSioa5lL7"},{"type":"text","value":".","position":{"start":{"line":21,"column":1},"end":{"line":21,"column":1}},"key":"jciWJsZoLe"}],"key":"IssMsSzSiN"}],"key":"ICrjWFUI2M"},{"type":"heading","depth":2,"position":{"start":{"line":24,"column":1},"end":{"line":24,"column":1}},"children":[{"type":"text","value":"Install Typst","position":{"start":{"line":24,"column":1},"end":{"line":24,"column":1}},"key":"ISd6dWMhk7"}],"identifier":"install-typst","label":"Install Typst","html_id":"install-typst","implicit":true,"key":"AS3H4xgBZe"},{"type":"paragraph","position":{"start":{"line":26,"column":1},"end":{"line":26,"column":1}},"children":[{"type":"text","value":"To produce a PDF output locally, you need to have Typst installed on your system.","position":{"start":{"line":26,"column":1},"end":{"line":26,"column":1}},"key":"YWXXT19Mko"}],"key":"vU2bxr1O6W"},{"type":"exercise","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Install Typst","position":{"start":{"line":28,"column":1},"end":{"line":28,"column":1}},"key":"ejwr7ETyZw"}],"key":"PGJf7x8Pe3"},{"type":"tabSet","children":[{"type":"tabItem","title":"Locally","children":[{"type":"paragraph","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"children":[{"type":"text","value":"Install Typst using the nstructions available at the ","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"key":"k5IbmLeyVR"},{"type":"link","url":"https://github.com/typst/typst?tab=readme-ov-file#installation","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"children":[{"type":"text","value":"Typst GitHub repo","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"key":"QCj5Oeg196"}],"urlSource":"https://github.com/typst/typst?tab=readme-ov-file#installation","error":true,"key":"QaDurKy73m"},{"type":"text","value":" and Jupyter Book 2 context is provided ","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"key":"zY5zeMz9R7"},{"type":"crossReference","url":"/creating-pdf-documents","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"children":[{"type":"text","value":"here","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"key":"dtDea1w3Xi"}],"urlSource":"xref:myst-guide/creating-pdf-documents#typst-install","remote":true,"remoteBaseUrl":"https://mystmd.org/guide","dataUrl":"/creating-pdf-documents.json","identifier":"typst:install","label":"typst:install","html_id":"typst-install","protocol":"xref:myst","template":"{name}","resolved":true,"key":"nvRDZAd131"},{"type":"text","value":".","position":{"start":{"line":33,"column":1},"end":{"line":33,"column":1}},"key":"CIJDA4jAZX"}],"key":"WlghVBYhFq"},{"type":"paragraph","position":{"start":{"line":35,"column":1},"end":{"line":35,"column":1}},"children":[{"type":"text","value":"Check whether Typst is correctly installed by running the following command in your terminal:","position":{"start":{"line":35,"column":1},"end":{"line":35,"column":1}},"key":"fAyKZzK8ZA"}],"key":"IDnHkRvBkt"},{"type":"code","lang":"console","value":"typst --version","position":{"start":{"line":37,"column":1},"end":{"line":39,"column":1}},"key":"Q0tI1PXgoT"}],"key":"Ed9PVRUb3t"},{"type":"tabItem","title":"Online","children":[{"type":"paragraph","position":{"start":{"line":43,"column":1},"end":{"line":43,"column":1}},"children":[{"type":"text","value":"Until you get to the Lesson “PDF output with ","key":"z2VWDKKAp1"},{"type":"abbreviation","title":"GitHub","children":[{"type":"text","value":"GH","key":"NAFX7wNkyx"}],"key":"q6a4IoRiSk"},{"type":"text","value":" Actions” you won’t be generating PDF’s, but you can still follow the exercise to learn how the template is defined and used in your Jupyter Book.","key":"kNgmI62dfQ"}],"key":"CEN8dPSMbI"}],"key":"EHCAPwnZlJ"}],"key":"yzh71HS5za"}],"enumerated":true,"label":"exercise-TsxjwTLYMC","identifier":"exercise-tsxjwtlymc","enumerator":"1","html_id":"exercise-tsxjwtlymc","key":"AcDXDFv4yT"},{"type":"heading","depth":2,"position":{"start":{"line":49,"column":1},"end":{"line":49,"column":1}},"children":[{"type":"text","value":"Generate a PDF","position":{"start":{"line":49,"column":1},"end":{"line":49,"column":1}},"key":"wJehulf9eS"}],"identifier":"generate-a-pdf","label":"Generate a PDF","html_id":"generate-a-pdf","implicit":true,"key":"K655R4hlNd"},{"type":"paragraph","position":{"start":{"line":51,"column":1},"end":{"line":51,"column":1}},"children":[{"type":"text","value":"Once Typst is installed and available in your terminal it can be used with Jupyter Book to generate a PDF file.","position":{"start":{"line":51,"column":1},"end":{"line":51,"column":1}},"key":"P9BPgUuvg3"}],"key":"ZcGE0lpjUO"},{"type":"exercise","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Generate a PDF of your book","position":{"start":{"line":54,"column":1},"end":{"line":54,"column":1}},"key":"vAF37txtuw"}],"key":"XXPItnggFK"},{"type":"tabSet","children":[{"type":"tabItem","title":"Locally","children":[{"type":"paragraph","position":{"start":{"line":59,"column":1},"end":{"line":59,"column":1}},"children":[{"type":"text","value":"Generate a PDF using the command ","position":{"start":{"line":59,"column":1},"end":{"line":59,"column":1}},"key":"ldJdoeVXSR"},{"type":"inlineCode","value":"jupyter book build --pdf","position":{"start":{"line":59,"column":1},"end":{"line":59,"column":1}},"key":"X3wrsi0cl4"},{"type":"text","value":".","position":{"start":{"line":59,"column":1},"end":{"line":59,"column":1}},"key":"tKby1dp6pn"}],"key":"hKdgWm6S2L"},{"type":"paragraph","position":{"start":{"line":61,"column":1},"end":{"line":61,"column":1}},"children":[{"type":"text","value":"View the PDF and observe how the contents of your website are formatted in the PDF document.","position":{"start":{"line":61,"column":1},"end":{"line":61,"column":1}},"key":"B8t1GAUNOg"}],"key":"wugOlQvBgz"},{"type":"paragraph","position":{"start":{"line":63,"column":1},"end":{"line":63,"column":1}},"children":[{"type":"text","value":"Next, review the contents of the ","position":{"start":{"line":63,"column":1},"end":{"line":63,"column":1}},"key":"qOF9QTZMUz"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":63,"column":1},"end":{"line":63,"column":1}},"key":"CbqzY5g9hn"},{"type":"text","value":" file and answer the following questions:","position":{"start":{"line":63,"column":1},"end":{"line":63,"column":1}},"key":"ZPpCiCF2QP"}],"key":"o46SI4igx4"},{"type":"list","ordered":false,"spread":false,"position":{"start":{"line":64,"column":1},"end":{"line":65,"column":1}},"children":[{"type":"listItem","spread":true,"position":{"start":{"line":64,"column":1},"end":{"line":64,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"What template is being used?","position":{"start":{"line":64,"column":1},"end":{"line":64,"column":1}},"key":"GK110m9ehK"}],"key":"tSvUwJJaaP"}],"key":"XxfkCKlRE9"},{"type":"listItem","spread":true,"position":{"start":{"line":65,"column":1},"end":{"line":65,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Where is the PDF output file saved after being generated?","position":{"start":{"line":65,"column":1},"end":{"line":65,"column":1}},"key":"co8ftVfdE3"}],"key":"f39UgsjTUB"}],"key":"WT2f5Zx4Xe"}],"key":"YXf35F0Vnn"}],"key":"Vvg1KWsH7k"},{"type":"tabItem","title":"Online","children":[{"type":"paragraph","position":{"start":{"line":69,"column":1},"end":{"line":69,"column":1}},"children":[{"type":"text","value":"Review the contents of the ","position":{"start":{"line":69,"column":1},"end":{"line":69,"column":1}},"key":"B0Nkj4mC7A"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":69,"column":1},"end":{"line":69,"column":1}},"key":"Koa11kVUPX"},{"type":"text","value":" file and answer the following questions:","position":{"start":{"line":69,"column":1},"end":{"line":69,"column":1}},"key":"n5owLeNuVf"}],"key":"fJnk3xmeNz"},{"type":"list","ordered":false,"spread":false,"position":{"start":{"line":70,"column":1},"end":{"line":71,"column":1}},"children":[{"type":"listItem","spread":true,"position":{"start":{"line":70,"column":1},"end":{"line":70,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"What template is being used?","position":{"start":{"line":70,"column":1},"end":{"line":70,"column":1}},"key":"zPPqVH1C0U"}],"key":"RA8yXkqgwc"}],"key":"ErCBTxIBsV"},{"type":"listItem","spread":true,"position":{"start":{"line":71,"column":1},"end":{"line":71,"column":1}},"children":[{"type":"paragraph","children":[{"type":"text","value":"Where is the PDF output file saved after being generated?","position":{"start":{"line":71,"column":1},"end":{"line":71,"column":1}},"key":"zhYetdOjgp"}],"key":"qcQGV57e2O"}],"key":"kVyOjmIaYa"}],"key":"tfm4gfgV9n"}],"key":"z2CteVofjU"}],"key":"iwOSelWE2S"}],"enumerated":true,"label":"exercise-ibrg062RIN","identifier":"exercise-ibrg062rin","enumerator":"2","html_id":"exercise-ibrg062rin","key":"apXEdTYjUP"},{"type":"admonition","kind":"tip","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Good practice with PDFs and Git","position":{"start":{"line":76,"column":1},"end":{"line":76,"column":1}},"key":"MmzXU9XRaD"}],"key":"rCP5q9pN0f"},{"type":"paragraph","position":{"start":{"line":77,"column":1},"end":{"line":77,"column":1}},"children":[{"type":"text","value":"Git is not intended for use with binary files like PDF’s. When working with PDF’s locally you may be tempted to commit the generated file to your repository, especially if you intend to share your work online. However, this will lead to unnecessary large Git workspace and is not recommended. For this reason the ","position":{"start":{"line":77,"column":1},"end":{"line":77,"column":1}},"key":"fb4V5K9B1c"},{"type":"inlineCode","value":".gitignore","position":{"start":{"line":77,"column":1},"end":{"line":77,"column":1}},"key":"q6Cg8TWW74"},{"type":"text","value":"  file already ignores PDF files, and the upcoming exercise with ","key":"aZAPSICARg"},{"type":"abbreviation","title":"GitHub","children":[{"type":"text","value":"GH","key":"NMGHY6Nwnp"}],"key":"O3WURLnNyu"},{"type":"text","value":" Actions illustrates how a PDF can be generated online and saved as a downloadable artifact, rather than committing it to the repository.","key":"PZGFL2pzFb"}],"key":"pf9NHP9YAJ"}],"key":"ILIGxBDdw5"},{"type":"heading","depth":2,"position":{"start":{"line":81,"column":1},"end":{"line":81,"column":1}},"children":[{"type":"text","value":"PDF output with ","key":"wDSWhDchYF"},{"type":"abbreviation","title":"GitHub","children":[{"type":"text","value":"GH","key":"gUuhjUhpvO"}],"key":"Nk8AgVgKqK"},{"type":"text","value":" Actions","key":"DlqHEEbORm"}],"label":"section:pdf-with-gha","identifier":"section:pdf-with-gha","html_id":"section-pdf-with-gha","key":"zYXft5HAZf"},{"type":"paragraph","position":{"start":{"line":83,"column":1},"end":{"line":83,"column":1}},"children":[{"type":"text","value":"Building and including your PDF is possible through a GitHub Action workflow that automatically builds the PDF when you push changes to GitHub. This has both is pros and cons. For instance, the build of your PDF is done prior to the build of your book, and if there is an error in the workflow your website may not be updated, or the PDF may not be included as a download. On the other hand, you do not need to install anything locally and the PDF is always up to date when you push changes. The most important reason for including the PDF build in your ","key":"eEwJd29GB6"},{"type":"abbreviation","title":"GitHub Actions","children":[{"type":"text","value":"GHA","key":"PVMW7FXkWb"}],"key":"SnMeUGm55f"},{"type":"text","value":" workflow is that your PDF will be generated and included automatically as a downloadable file along with your website. You will learn to do this in several ways by the end of this lesson.","key":"GP5AnRG6t9"}],"key":"utXeyUd2lU"},{"type":"paragraph","position":{"start":{"line":85,"column":1},"end":{"line":85,"column":1}},"children":[{"type":"text","value":"The workflow steps are:","position":{"start":{"line":85,"column":1},"end":{"line":85,"column":1}},"key":"avlcGigj6y"}],"key":"eAq29i7WgD"},{"type":"code","lang":"yaml","value":"jobs:\n  deploy:\n    ...\n    steps:\n      ...\n      - uses: typst-community/setup-typst@v4\n      ...\n    - name: Build PDF\n      run: |\n        jupyter book build --pdf\n\n    - name: Upload Output PDF as Artifact\n      uses: actions/upload-artifact@v4\n      with:\n        name: Output PDF\n        path: exports/book.pdf\n        compression-level: 0","position":{"start":{"line":87,"column":1},"end":{"line":105,"column":1}},"key":"rhEKo3Ff2z"},{"type":"exercise","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Change the workflow","position":{"start":{"line":107,"column":1},"end":{"line":107,"column":1}},"key":"EE90eKPB72"}],"key":"qBNGDfAqBs"},{"type":"tabSet","children":[{"type":"tabItem","title":"Locally","children":[{"type":"paragraph","position":{"start":{"line":112,"column":1},"end":{"line":112,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, update your ","position":{"start":{"line":112,"column":1},"end":{"line":112,"column":1}},"key":"XqISJ01KI1"},{"type":"inlineCode","value":"deploy.yml","position":{"start":{"line":112,"column":1},"end":{"line":112,"column":1}},"key":"jlbw18oOrL"},{"type":"text","value":" file to build the PDF as part of your GitHub Action workflow.","position":{"start":{"line":112,"column":1},"end":{"line":112,"column":1}},"key":"XltJGEZ3KA"}],"key":"LndQFrBNJY"},{"type":"paragraph","position":{"start":{"line":114,"column":1},"end":{"line":114,"column":1}},"children":[{"type":"text","value":"Visit the Actions page of your repository to find where the artifact (PDF) can be downloaded.","position":{"start":{"line":114,"column":1},"end":{"line":114,"column":1}},"key":"vvuijiFKEb"}],"key":"RVmIAsxikw"},{"type":"admonition","kind":"hint","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Hint","key":"Wn44f2XmSY"}],"key":"WQ3SWuW0dg"},{"type":"paragraph","position":{"start":{"line":117,"column":1},"end":{"line":117,"column":1}},"children":[{"type":"text","value":"Click on the last completed workflow run and look to the bottom of the page.","position":{"start":{"line":117,"column":1},"end":{"line":117,"column":1}},"key":"aCykpgIaQp"}],"key":"gNMke0NFeF"}],"key":"drG35nmKJJ"}],"key":"IzYshPr4OL"},{"type":"tabItem","title":"Online","children":[{"type":"paragraph","position":{"start":{"line":122,"column":1},"end":{"line":122,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, update your ","position":{"start":{"line":122,"column":1},"end":{"line":122,"column":1}},"key":"oHGSBvUuJ3"},{"type":"inlineCode","value":"deploy.yml","position":{"start":{"line":122,"column":1},"end":{"line":122,"column":1}},"key":"b9T1iS6YSo"},{"type":"text","value":" file to build the PDF as part of your GitHub Action workflow.","position":{"start":{"line":122,"column":1},"end":{"line":122,"column":1}},"key":"y2gwqbe9ME"}],"key":"z77wxmKvTI"},{"type":"paragraph","position":{"start":{"line":124,"column":1},"end":{"line":124,"column":1}},"children":[{"type":"text","value":"Visit the Actions page of your repository to find where the artifact (PDF) can be downloaded.","position":{"start":{"line":124,"column":1},"end":{"line":124,"column":1}},"key":"x27TivKcsJ"}],"key":"BFvulmQ7fq"},{"type":"admonition","kind":"hint","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Hint","key":"IoowoRRWNP"}],"key":"OSq78L1m17"},{"type":"paragraph","position":{"start":{"line":127,"column":1},"end":{"line":127,"column":1}},"children":[{"type":"text","value":"Click on the last completed workflow run and look to the bottom of the page.","position":{"start":{"line":127,"column":1},"end":{"line":127,"column":1}},"key":"dGe7L9cJIp"}],"key":"lQ9Lt1GS3l"}],"key":"aBBLxzn1Us"}],"key":"jnyzSbjoFU"}],"key":"RFAgsYDtHA"}],"enumerated":true,"label":"exercise-S8XpZhYcjD","identifier":"exercise-s8xpzhycjd","enumerator":"3","html_id":"exercise-s8xpzhycjd","key":"QXPjEKmXqh"},{"type":"heading","depth":2,"position":{"start":{"line":133,"column":1},"end":{"line":133,"column":1}},"children":[{"type":"text","value":"Change the PDF template","position":{"start":{"line":133,"column":1},"end":{"line":133,"column":1}},"key":"gJjDvuma59"}],"identifier":"change-the-pdf-template","label":"Change the PDF template","html_id":"change-the-pdf-template","implicit":true,"key":"wHC2MTm6Ot"},{"type":"paragraph","position":{"start":{"line":135,"column":1},"end":{"line":135,"column":1}},"children":[{"type":"text","value":"Take a look at the PDF generated in the previous exercises using the ","position":{"start":{"line":135,"column":1},"end":{"line":135,"column":1}},"key":"je61Ttu7Vk"},{"type":"inlineCode","value":"lapreprint-typst","position":{"start":{"line":135,"column":1},"end":{"line":135,"column":1}},"key":"gcDrg1vgFF"},{"type":"text","value":" template. You probably notice that it is does a good job at converting the website into a PDF document. However, you may have also noticed some text or formatting that isn’t perfect, or perhaps you thought that you might want a cover page or table of contents for the PDF.","position":{"start":{"line":135,"column":1},"end":{"line":135,"column":1}},"key":"PuTSkzh2zA"}],"key":"QaJ6aSmCAK"},{"type":"paragraph","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"children":[{"type":"text","value":"It turns out the ","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"aHrJyq8jHS"},{"type":"inlineCode","value":"lapreprint-typst","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"t1tgpHCwtJ"},{"type":"text","value":" template is not ideal for rendering content designed as a website made with the ","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"FAvsHVSOAY"},{"type":"inlineCode","value":"book-theme","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"hOk2CZgkXl"},{"type":"text","value":". Luckily, another Typst template is available: ","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"eYGd1sSksh"},{"type":"link","url":"https://github.com/myst-templates/plain_typst_book","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"children":[{"type":"text","value":"the Plain Typst Book ","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"reJ3FQPLcY"},{"type":"inlineCode","value":"plain_typst_book","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"uQfOwPkLps"}],"urlSource":"https://github.com/myst-templates/plain_typst_book","error":true,"key":"U0njCaBcgD"},{"type":"text","value":" (not yet listed on the MyST Templates ","key":"isoTP2VF1y"},{"type":"abbreviation","title":"GitHub","children":[{"type":"text","value":"GH","key":"CJFDv9lIHy"}],"key":"rDOnZaxe86"},{"type":"text","value":" Organization). An example YAML snippet that implements this in the ","key":"WS0hpA2U8y"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"HWPyxVZQnd"},{"type":"text","value":" file is illustrated here:","position":{"start":{"line":137,"column":1},"end":{"line":137,"column":1}},"key":"JeFOLShKiY"}],"key":"LpYD2cJ45a"},{"type":"code","lang":"yaml","value":"  exports:\n    - format: typst\n      template: https://github.com/myst-templates/plain_typst_book.git\n      output: exports/book.pdf\n      id: output-pdf","position":{"start":{"line":139,"column":1},"end":{"line":145,"column":1}},"key":"lElyfi5WVe"},{"type":"exercise","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Change the template","position":{"start":{"line":147,"column":1},"end":{"line":147,"column":1}},"key":"wuZTobsHvY"}],"key":"dYIrdwNA4q"},{"type":"tabSet","children":[{"type":"tabItem","title":"Locally","children":[{"type":"paragraph","position":{"start":{"line":152,"column":1},"end":{"line":152,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, update your ","position":{"start":{"line":152,"column":1},"end":{"line":152,"column":1}},"key":"tGYAdMNlnh"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":152,"column":1},"end":{"line":152,"column":1}},"key":"LvInInZcuz"},{"type":"text","value":" file to use the ","position":{"start":{"line":152,"column":1},"end":{"line":152,"column":1}},"key":"LZzmC0huD7"},{"type":"inlineCode","value":"plain_typst_book","position":{"start":{"line":152,"column":1},"end":{"line":152,"column":1}},"key":"nePEFM6hX0"},{"type":"text","value":" template in your book, then rebuild the PDF.","position":{"start":{"line":152,"column":1},"end":{"line":152,"column":1}},"key":"t2oATaxyNg"}],"key":"dXupW8ka8K"},{"type":"paragraph","position":{"start":{"line":154,"column":1},"end":{"line":154,"column":1}},"children":[{"type":"text","value":"Observe how the rendered PDF is different than the previous template.","position":{"start":{"line":154,"column":1},"end":{"line":154,"column":1}},"key":"zpy55UqZgr"}],"key":"uOO7Pmy3YF"}],"key":"g6KY4m9oAz"},{"type":"tabItem","title":"Online","children":[{"type":"paragraph","position":{"start":{"line":158,"column":1},"end":{"line":158,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, update your ","position":{"start":{"line":158,"column":1},"end":{"line":158,"column":1}},"key":"nsGc9awKcE"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":158,"column":1},"end":{"line":158,"column":1}},"key":"UhHflYdvR6"},{"type":"text","value":" file to use the ","position":{"start":{"line":158,"column":1},"end":{"line":158,"column":1}},"key":"R8lrPIuPJz"},{"type":"inlineCode","value":"plain_typst_book","position":{"start":{"line":158,"column":1},"end":{"line":158,"column":1}},"key":"do7IP4DWQI"},{"type":"text","value":" template in your book. After making a commit, wait for the workflow run to complete, then view the PDF after downloading it as an artifact.","position":{"start":{"line":158,"column":1},"end":{"line":158,"column":1}},"key":"eHv1tpSozA"}],"key":"ylAqRuHkNK"},{"type":"paragraph","position":{"start":{"line":160,"column":1},"end":{"line":160,"column":1}},"children":[{"type":"text","value":"Observe how the rendered PDF is different than the previous template.","position":{"start":{"line":160,"column":1},"end":{"line":160,"column":1}},"key":"Gc4n8rES7v"}],"key":"TkDihxr8bu"}],"key":"KsYVkouvEF"}],"key":"B5TvnNFSKT"}],"enumerated":true,"label":"exercise-vOJo81kCEH","identifier":"exercise-vojo81kceh","enumerator":"4","html_id":"exercise-vojo81kceh","key":"OCceN2IRUo"},{"type":"heading","depth":2,"position":{"start":{"line":165,"column":1},"end":{"line":165,"column":1}},"children":[{"type":"text","value":"More fun with PDF’s","position":{"start":{"line":165,"column":1},"end":{"line":165,"column":1}},"key":"nnhMbaujWo"}],"identifier":"more-fun-with-pdfs","label":"More fun with PDF’s","html_id":"more-fun-with-pdfs","implicit":true,"key":"ozOehYDhCM"},{"type":"paragraph","position":{"start":{"line":167,"column":1},"end":{"line":167,"column":1}},"children":[{"type":"text","value":"Now that you have successfully created a PDF and changed the template, a few small exercises are provided here to illustrate how the template can be customized, as well as how the PDF can be included as a download via the ","position":{"start":{"line":167,"column":1},"end":{"line":167,"column":1}},"key":"KSKve21ytl"},{"type":"emphasis","position":{"start":{"line":167,"column":1},"end":{"line":167,"column":1}},"children":[{"type":"text","value":"website.","position":{"start":{"line":167,"column":1},"end":{"line":167,"column":1}},"key":"QHqVLcGkk3"}],"key":"lxzgBKiT6o"}],"key":"cM7U5gTi0U"},{"type":"paragraph","position":{"start":{"line":169,"column":1},"end":{"line":169,"column":1}},"children":[{"type":"text","value":"You can complete the exercises in this section in any order.","position":{"start":{"line":169,"column":1},"end":{"line":169,"column":1}},"key":"BzX7RS0cVq"}],"key":"Coc2BGcE9d"},{"type":"heading","depth":3,"position":{"start":{"line":171,"column":1},"end":{"line":171,"column":1}},"children":[{"type":"text","value":"Customize the PDF output","position":{"start":{"line":171,"column":1},"end":{"line":171,"column":1}},"key":"ZTdbLUkWa6"}],"identifier":"customize-the-pdf-output","label":"Customize the PDF output","html_id":"customize-the-pdf-output","implicit":true,"key":"LlcnkC0rvR"},{"type":"paragraph","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"children":[{"type":"text","value":"The ","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"TmQAas3Nla"},{"type":"inlineCode","value":"plain_typst_book","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"En4h5R3BLG"},{"type":"text","value":" template includes options that can be set by the user to customize how the PDF is generated. For example, ","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"vlHW7HCzj9"},{"type":"inlineCode","value":"cover","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"u40dudnzVG"},{"type":"text","value":", ","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"hWfkKoQ1MI"},{"type":"inlineCode","value":"logo","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"wFnZygdNlL"},{"type":"text","value":" ","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"TImbGYc3Jv"},{"type":"inlineCode","value":"logo_width","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"cFTu99oznv"},{"type":"text","value":" and ","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"DgSOTMUIgF"},{"type":"inlineCode","value":"ToC_depth","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"HcH4pDJaC8"},{"type":"text","value":" are added to the ","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"ZAIUSJjATQ"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"gl76yzjp9H"},{"type":"text","value":" file.","position":{"start":{"line":173,"column":1},"end":{"line":173,"column":1}},"key":"YGbDjvUdei"}],"key":"pTzaTGeJ5d"},{"type":"code","lang":"yaml","value":"  exports:\n    - format: typst\n      template: https://github.com/myst-templates/plain_typst_book.git\n      output: exports/book.pdf\n      id: output-pdf\n      cover: content/figures/logo.svg\n      logo: content/figures/logo.svg\n      logo_width: 5\n      ToC_depth: 2","position":{"start":{"line":175,"column":1},"end":{"line":185,"column":1}},"key":"PaWmR5t2XG"},{"type":"exercise","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Add template options","position":{"start":{"line":187,"column":1},"end":{"line":187,"column":1}},"key":"dLzhxavAtt"}],"key":"uZtMB4AaHM"},{"type":"tabSet","children":[{"type":"tabItem","title":"Locally","children":[{"type":"paragraph","position":{"start":{"line":192,"column":1},"end":{"line":192,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, update your ","position":{"start":{"line":192,"column":1},"end":{"line":192,"column":1}},"key":"wZ8611wJLm"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":192,"column":1},"end":{"line":192,"column":1}},"key":"gHjHM1Gwma"},{"type":"text","value":" file to customize the PDF output, then rebuild the PDF. Feel free to experiment with the images and parameters.","position":{"start":{"line":192,"column":1},"end":{"line":192,"column":1}},"key":"GdjV7CkemR"}],"key":"fivisogUUR"}],"key":"HRQd12k1DZ"},{"type":"tabItem","title":"Online","children":[{"type":"paragraph","position":{"start":{"line":196,"column":1},"end":{"line":196,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, update your ","position":{"start":{"line":196,"column":1},"end":{"line":196,"column":1}},"key":"dK8ifDLEAQ"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":196,"column":1},"end":{"line":196,"column":1}},"key":"tKzTTa9hTO"},{"type":"text","value":" file to customize the PDF output. Feel free to experiment with the images and parameters.","position":{"start":{"line":196,"column":1},"end":{"line":196,"column":1}},"key":"HRC9wgbV8D"}],"key":"qovuuofb8B"},{"type":"paragraph","position":{"start":{"line":198,"column":1},"end":{"line":198,"column":1}},"children":[{"type":"text","value":"Make a commit and download the artifact to view the change.","position":{"start":{"line":198,"column":1},"end":{"line":198,"column":1}},"key":"CA0MYEqy9T"}],"key":"zHx1DKEQnL"}],"key":"u1P0LRZ3yn"}],"key":"wMVh38ZjHc"}],"enumerated":true,"label":"exercise-Tn8NZgvhFK","identifier":"exercise-tn8nzgvhfk","enumerator":"5","html_id":"exercise-tn8nzgvhfk","key":"C9ol8lmVNz"},{"type":"heading","depth":3,"position":{"start":{"line":203,"column":1},"end":{"line":203,"column":1}},"children":[{"type":"text","value":"Add Download PDF button to website","position":{"start":{"line":203,"column":1},"end":{"line":203,"column":1}},"key":"ZzYhewhFQz"}],"identifier":"add-download-pdf-button-to-website","label":"Add Download PDF button to website","html_id":"add-download-pdf-button-to-website","implicit":true,"key":"LxLPFfkHsG"},{"type":"paragraph","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"children":[{"type":"text","value":"You may have noticed a large “Feedback” button at the top right of your website. This is one example of what Jupyter Book 2 (and MyST) refer to as “actions” (not the same as GitHub Actions!). It would be very useful to include a similar button for downloading the PDF of your book. This can be done by adding the following values to the ","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"ZaukNP4BYa"},{"type":"inlineCode","value":"actions","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"hp8tsSpCuz"},{"type":"text","value":" sub-section of the ","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"EmgtagZ8eX"},{"type":"inlineCode","value":"site","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"rgSeewg99I"},{"type":"text","value":" section in ","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"mloEHwEUbF"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"wt0pP52DYd"},{"type":"text","value":":","position":{"start":{"line":205,"column":1},"end":{"line":205,"column":1}},"key":"ZoL6xxUEEx"}],"key":"kixQ90XTjf"},{"type":"code","lang":"yaml","value":"site:\n  ...\n  actions:\n      ...\n      - title: PDF\n        url: ./exports/book.pdf","position":{"start":{"line":207,"column":1},"end":{"line":214,"column":1}},"key":"D1p9TUmeWE"},{"type":"exercise","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Add PDF Download button","position":{"start":{"line":216,"column":1},"end":{"line":216,"column":1}},"key":"tQwCsLSYAB"}],"key":"OAgHd49aFy"},{"type":"tabSet","children":[{"type":"tabItem","title":"Locally","children":[{"type":"paragraph","position":{"start":{"line":221,"column":1},"end":{"line":221,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, add a PDF download button. Once the ","position":{"start":{"line":221,"column":1},"end":{"line":221,"column":1}},"key":"batEOoq2IW"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":221,"column":1},"end":{"line":221,"column":1}},"key":"iArou7kIas"},{"type":"text","value":" file has been updated the PDF must be regenerated and the website updated.","position":{"start":{"line":221,"column":1},"end":{"line":221,"column":1}},"key":"pz4jk2CrKH"}],"key":"y8eWgQBxyL"},{"type":"paragraph","position":{"start":{"line":223,"column":1},"end":{"line":223,"column":1}},"children":[{"type":"text","value":"Confirm that this was done successfully by checking that the PDF button downloads the file properly.","position":{"start":{"line":223,"column":1},"end":{"line":223,"column":1}},"key":"YXZb6Yhd1V"}],"key":"A9v8xJw8wK"}],"key":"KXwUXJzqXt"},{"type":"tabItem","title":"Online","children":[{"type":"paragraph","position":{"start":{"line":227,"column":1},"end":{"line":227,"column":1}},"children":[{"type":"text","value":"Using the example code provided above, add a PDF download button. Once the ","position":{"start":{"line":227,"column":1},"end":{"line":227,"column":1}},"key":"l69SZMqJf4"},{"type":"inlineCode","value":"myst.yml","position":{"start":{"line":227,"column":1},"end":{"line":227,"column":1}},"key":"BNCvG0lO2h"},{"type":"text","value":" file has been updated the PDF must be regenerated and the website updated, which is done automatically once the commit is made.","position":{"start":{"line":227,"column":1},"end":{"line":227,"column":1}},"key":"Qwi6AboBY4"}],"key":"Ft1Yv2H8IB"},{"type":"paragraph","position":{"start":{"line":229,"column":1},"end":{"line":229,"column":1}},"children":[{"type":"text","value":"Confirm that this was done successfully by checking that the PDF button downloads the file properly.","position":{"start":{"line":229,"column":1},"end":{"line":229,"column":1}},"key":"c8tw73uYm9"}],"key":"uzDGSXzu7F"}],"key":"iZAVfFVwJv"}],"key":"zVwowNX186"}],"enumerated":true,"label":"exercise-g0gJtDf0ng","identifier":"exercise-g0gjtdf0ng","enumerator":"6","html_id":"exercise-g0gjtdf0ng","key":"z76Glt3SBh"},{"type":"admonition","kind":"tip","children":[{"type":"admonitionTitle","children":[{"type":"text","value":"Order matters!","position":{"start":{"line":234,"column":1},"end":{"line":234,"column":1}},"key":"rqq1kCVs7T"}],"key":"wMAyhr2s8U"},{"type":"paragraph","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"children":[{"type":"text","value":"Note that in order for the PDF to be included in the website, the PDF must be generated ","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"key":"Mx5cyQ1Cy7"},{"type":"emphasis","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"children":[{"type":"text","value":"before","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"key":"nwnvCBJeyE"}],"key":"kQoQawzCZd"},{"type":"text","value":" the website is built. When working locally, this means you need to run the build command before updating the website. For GitHub Actions, the PDF build step must be listed ","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"key":"gKRiHqX9uB"},{"type":"emphasis","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"children":[{"type":"text","value":"above","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"key":"XRLo5po1yi"}],"key":"ebPh0i3NBC"},{"type":"text","value":" the HTML build step.","position":{"start":{"line":235,"column":1},"end":{"line":235,"column":1}},"key":"ZNa87sJmzE"}],"key":"P2SJLNVZTq"}],"key":"AwnlUHw7UB"}],"key":"NUCkoZ8g17"}],"key":"DDLS8zmtLN"},"references":{"cite":{"order":[],"data":{}}},"footer":{"navigation":{"prev":{"title":"PDFs with Typst and LaTeX 🌶","url":"/b-pdfgeneration","group":"Jupyter Book 2 Workshop Template"},"next":{"title":"Empty book","url":"/init","group":"Jupyter Book 2 Workshop Template"}}},"domain":"http://localhost:3000"}