-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Writer for typst #8713
Comments
One hurdle is that their math syntax (https://typst.app/docs/reference/math/) is not LaTeX-compatible. |
Just stumbled upon typst and I am delighted to find that are planning to have a writer for it |
I've made a start on a texmath writer as a first step. Of course, if anyone else wants to help out (especially typst experts), that would be welcome. |
I just found out that there's already a custom pandoc reader & writer (partial support): https://github.com/lvignoli/typst-pandoc |
See #8713. Still needed: - automated tests - PDF-via-typst support - improved template - fuller table support
The |
A few notes:
|
Hey, I'm one of the developers of Typst. Very cool that you're working on this! In response to your notes:
|
@laurmaedje thanks for commenting: typst is an exciting project, and I really like a lot of the decisions that went into it. I think my main pain points right now are footnotes, tables, and citations. Glad to hear footnotes are planned. On citations:
On tables: Standard typographic practice is not to put lines between all cells of a table. In books, you often only have a line under the header, above the footer, and maybe below the table. (And that's pandoc's default behavior.) Maybe I'm missing something, but it seems there is no way currently to achieve this with typst. You can adjust the Does typst have anything equivalent to LaTeX's "floats"? Currently tables seem to break between pages (so they behave like LaTeX |
On |
One more question @laurmaedje : I was unable to figure out how to specify alignments for table columns (e.g. first column right, second center, third left). Can you point to an example of this? |
See #8713. Still needed: - PDF-via-typst support - fuller table support
For the table strokes, I know there is a branch with a partial implementation of stroke customization, but it isn't ready to be merged quite yet. see also typst/typst#226 |
See #8713. Still needed: - PDF-via-typst support - fuller table support
The typst writer has been merged into the main branch. |
Floats are, similarly to footnotes, unfortunately not yet implemented.
We should definitely consider it. Typst is what it is because we have the tendency to reinvent every wheel, but sometimes it's the wrong decision.
No fundamental reason why there couldn't be.
As mentioned before, there's a branch where I have an implementation of customizable strokes. There's lots of edge cases though, that's why I didn't get it finished in time for the beta launch.
You can customize it arbitrarily with a show rule:
But if the current default style is very non-standard, I'd also be open to changing it. There's no particular reason it is that way.
You can provide a function that returns the alignment depending on the x, y cell coordinates, e.g. like this:
|
Neither LaTeX nor HTML add a colon, and in many cases this is unwanted, so I'd say it would be better for the default behavior not to add one. But thanks for the example of customization. Thanks also for the example of the alignment function. I saw the thing about a function from the documentation, but an example like this would have been really helpful! |
I removed the colon in the default style and made the separator configurable (default is just a bit of space now).
Added to the docs! (Still deploying.) |
Great! I expect to have a new pandoc release with typst output support within the day. |
pandoc 3.1.2 is out now with a typst writer. |
Are there any plans for a reader? For example, would it eventually be possible to convert from |
Yes, I'm starting to think about a reader. It's a bit of a complex beast, because we'll have to parse and interpret the typst language. But should be doable. If typst ever supplies HTML output, that could be another route, since that could be passed through pandoc. PS. Another possible route: typst/typst#461 |
I'll open a separate issue for a reader. |
Does anyone have a simple, round-trip example that shows how a workflow from a typical Markdown document for Pandoc could be converted to Typst with the Pandoc writer and then rendered to a PDF document using one of the many Typst styles? It would be really cool if the many Typst templates could be used for rendering a standard Pandoc Markdown document. Which YAML variables would be required in the Markdown document? Etc. |
I use Scrivener to write, converted to Pandoc markdown and rendered to PDF via Typst. Pandoc is great at building flexible Typst templates. I did this for a paper using the really nice lapreprint template https://github.com/LaPreprint/typst (you need to download the lapreprint.typ file and put it somewhere typst can find it): My defaults file: https://github.com/iandol/dotpandoc/blob/master/defaults/lapreprint.yaml The pandoc document metadata looked something like this: ---
# Typst LaPreprint Metadata
title: 'Title'
date: '`(title: "Published V3", date: datetime(year: 2023, month: 12, day: 12))`{=typst}'
short-title: PFTM
theme: '`red.darken(40%)`{=typst}'
venue: '`[bio#text(fill: red.darken(20%))[R]χiv]`{=typst}'
logo: logo.png
bibliography: Core.bib
csl: cell2022.csl
doi: '10.1101/2023.10.19.563116'
mainfont: "Alegreya Sans"
fontsize: 12pt
linestretch: 1.3
papersize: a4
lang: en
verbose: true
wrap: none
author:
- name: Jane Doe
equal-contributor: true
affiliation: "2†"
- name: Janet Doe
orcid: "0000-0001-9985-3414"
email: [email protected]
affiliation: "1"
affiliations:
- id: cebsit
index: "1"
name: "Institute of Neuroscience, State Key Laboratory of Neuroscience, Key Laboratory of Primate Neurobiology, Center for Excellence in Brain Science and Intelligence Technology, Chinese Academy of Sciences, Shanghai 200031, China"
- id: inserm
index: "2"
name: "Sorbonne Université, Inserm, CNRS, ICM, Paris, France"
- id: eq
index: "†"
name: Equal contribution
keywords: [color perception, pupillometry, no-report paradigm, frequency-tagging, isoluminance]
margin-correspondence:
- "Jane: [[email protected]](mailto:[email protected])"
- "Janet: [[email protected]](mailto:[email protected])"
margin-keypoints:
- "Lorum ipsum blah blah blah."
- "Lorum ipsum blah blah blah."
- "Lorum ipsum blah blah blah."
margin-funding:
- "This work was supported by the following grants: National Science and Technology Innovation 2030 Major Program XXX (to Janet), Shanghai Municipal Science and Technology Major Project 2018SHZDZX05 (to Jane), National Natural Science Foundation of China grants 32070992 and 32150410370 (to Jane) and 32100805 (to Jane)."
margin-code:
- "Code to run can be found online."
--- I made a filter that fixes a couple of issues i had with syntax (e.g. typst uses I also have custom typst templates for standard docs, you can look through my dotpandoc templates folder: https://github.com/iandol/dotpandoc/tree/master/templates -- I have to modify things as I use academic metadata |
typst is a new open-source document formatting system (LaTeX alternative) with a lot of nice features. It would be nice to have a pandoc writer for it (maybe a reader too, but at this point a writer would be most useful).
The text was updated successfully, but these errors were encountered: