-
Notifications
You must be signed in to change notification settings - Fork 65
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
📝 Typst template documentation #1179
base: main
Are you sure you want to change the base?
Conversation
@@ -1,5 +1,5 @@ | |||
--- | |||
title: Create a Template | |||
title: Create a LaTeX Template | |||
description: jtex templates have a template.yml, template.tex, and any other images, class or definition files required for the template to render. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: jtex templates have a template.yml, template.tex, and any other images, class or definition files required for the template to render. | |
description: LaTeX templates have a template.yml, template.tex, and any other images, class or definition files required for the template to render. |
@@ -0,0 +1,324 @@ | |||
--- | |||
title: Create a Typst Template | |||
description: jtex templates have a template.yml, template.typ, and any other images, class or definition files required for the template to render. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: jtex templates have a template.yml, template.typ, and any other images, class or definition files required for the template to render. | |
description: Typst templates have a template.yml, template.typ, and any other images, class or definition files required for the template to render. |
--- | ||
|
||
A `jtex` template contains everything necessary to create a $\LaTeX$ document, including a `template.yml`, the main `template.typ`, and any associated files such as classes (`*.cls`), definitions (`*.def`), or images (`*.png`). | ||
These $\LaTeX$ templates are data-driven, in that they record all of the options in a `template.yml` which you create as you are working through moving your $\LaTeX$ document to a `jtex` template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These $\LaTeX$ templates are data-driven, in that they record all of the options in a `template.yml` which you create as you are working through moving your $\LaTeX$ document to a `jtex` template. | |
These Typst templates are data-driven, in that they record all of the options in a `template.yml` which you create as you are working through moving your Typst document to a `jtex` template. |
## Update the authors and affiliations | ||
|
||
The authors and affiliations are usually the hardest part to template as many journals do these differently. | ||
If you are looking for inspiration, take a look at some of the existing templates in the [myst-templates](https://github.com/myst-templates) organization on GitHub. | ||
|
||
For example, to create the following author/affiliations list: | ||
|
||
```latex | ||
\authors{First Author\affil{1}, Author\affil{1,2}} | ||
|
||
\affiliation{1}{First Affiliation} | ||
\affiliation{2}{Second Affiliation} | ||
``` | ||
|
||
The `jtex` template is as follows: | ||
|
||
```latex | ||
\authors{ | ||
[#- for author in doc.authors -#] | ||
[-- author.name --] | ||
[#- if author.affiliations -#] | ||
\affil{ | ||
[-- author.affiliations|join(",", "index") --] | ||
} | ||
[#- endif -#] | ||
[#- if not loop.last #], [# endif -#] | ||
[#- endfor -#] | ||
} | ||
|
||
[# for affiliation in doc.affiliations #] | ||
\affiliation{[-affiliation.index-]}{[-affiliation.value-]} | ||
[# endfor #] | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: refer to the frontmatter plugin from Curvenote for typst
myst build my-document.md --tex | ||
``` | ||
|
||
By default these are put in a `_build` folder. If you want to control that, use the `output:` field in the appropriate export. If you have $\LaTeX$ installed, you can also try changing the format to `pdf` or `pdf+tex` to keep the source files. See [](/guide/creating-pdf-documents) for more information on using MyST templates for $\LaTeX$. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default these are put in a `_build` folder. If you want to control that, use the `output:` field in the appropriate export. If you have $\LaTeX$ installed, you can also try changing the format to `pdf` or `pdf+tex` to keep the source files. See [](/guide/creating-pdf-documents) for more information on using MyST templates for $\LaTeX$. | |
By default these are put in a `_build` folder. If you want to control that, use the `output:` field in the appropriate export. If you have Typst installed, you can also try changing the format to `pdf` or `pdf+typst` to keep the source files. See [](/guide/creating-pdf-documents) for more information on using MyST templates for Typst. |
--- | ||
``` | ||
|
||
Ensure that the exports list has a `format: tex` in it. To also have your `parts` defined, use blocks with JSON metadata: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the exports list has a `format: tex` in it. To also have your `parts` defined, use blocks with JSON metadata: | |
Ensure that the exports list has a `format: typst` in it. To also have your `parts` defined, use blocks with JSON metadata: |
Beginning to document how to create Typst templates. Will be accompanied by a new
copier
template (that will initially live on my Github, but that we can later transfer over to https://github.com/myst-templates/.