-
-
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
Plain TeX writer #1541
Comments
I had thought about exactly this concept a little while ago, but I couldn't come up with a use case for this which isn't already served well by ConTeXt and LaTeX. Since both of the above systems provide advanced functionality for specifying layout and apprearance, I think tweaking a hypothetical TeX template file to get the desired appearance would take the user much longer, if they don't already know raw TeX. Do you have a specific application in mind where the extra low-level control would be worth it? |
One advantage, besides customizability, is that only a very minimal tex install would be needed to produce a PDF. |
I've been thinking a bit more about this lately, and getting more interested. I think my earlier question is missing the point; since any document can be typeset by any of the systems (plain TeX, ConTeXt or LaTeX). The reduced dependency is nice when installing, but also when authoring, since it would bypass the clunky LaTeX and ConTeXt systems. Plain TeX might turn out to be a better match for pandoc's document model then the two higher-level macro packages. |
Pandoc now has PDF generation using ConTeXt built in as well. ConTeXt Standalone states "ConTeXt macro files are small (less than 10MB), but the suite comes with various free fonts which considerably increase the size of the distribution to around 200MB)." There's also BasicTeX which comes in at around 100MB (which, however only contains two fonts and no bidi package etc). How does plain TeX handle unicode and bidirectional text btw? |
I have a use case for a pandoc plain tex writer: conversion of LaTeX snippets to Plain TeX snippets for sharing bits of code (in my case, math homework problems) between people who use different dialects of TeX. Is it ever likely to happen? |
Curious about this: if I understand correctly, what it would take to write a plain TeX writer is to emulate
|
@shreevatsa yes, we'd have to add a
Have a look at http://pandoc.org/CONTRIBUTING.html
and https://github.com/jgm/pandoc-types/blob/master/Text/Pandoc/Definition.hs However, before all this, we'd have to agree on what TeX exactly this plain writer would produce. That's what this issue is for... suggestions welcome :) At least it should be able to handle test/writer.native |
Thanks. I think @jgm already outlined a sensible approach in the issue description:
So for example the metadata |
+++ Shreevatsa [Jan 18 18 16:38 ]:
So for example the metadata ("date",MetaInlines [Str "July",Space,Str
"17,",Space,Str "2006"]) (from writer.native) may turn into \date{July
17, 2006} and then there would be a definition of \date (or how to use
the token list / boxes set by \date) in the preamble etc. We'd be
Well, not exactly. It would be more generic than this.
You wouldn't want every metadata field to turn into a
command of the same name.
Maybe: \metadata[date]{July 17, 2006}
|
As discussed in #4341, the witiko/markdown TeX package is an (unintentional) implementation of this idea (see an article introducing the package in TUGboat vol.39, no.2). The first step is to decide and document the TeX macros that will correspond to the individual elements of the AST; see section 2.2.3 of the witiko/markdown documentation to see the choices made by the package. Most importantly, the macros need to be prefixed (e.g. |
Below are some of my assorted thoughts on this:
|
I would not wish to discourage anyone from attempting this work who might be enthusiastic about it, but for those attempting optimally to delegate development resources, I share some thoughts on the subject.
|
The original intent of this issue was not to reduce dependencies but to enhance customizability. The emitted TeX would match as closely as possible pandoc's own document model, and all formatting would be done by macro definitions. |
If we generate tex that matches the pandoc AST, one could always use LaTeX to define the macros and process the result with pdflatex. In a sense it would be generic tex -- you supply the macro definitions, which could be in plain tex or latex. |
Would you not lose then the layout features and the macros provided by a document class? |
I don't see why. The document class is specified in material that goes in the template; it's not generated by the latex writer currently. You could still use a template of your choice. The template would have to provide macro defs for all the pandoc commands. |
@jgm As discussed in my yesterday TUG 2021 talk, there is an effort by @drehak (see drehak/lunamark) underway to produce a writer that would convert Pandoc's AST to the TeX AST input (see the spec) of the witiko/markdown package. We would distribute the writer with witiko/markdown, as discussed in #4341, and then use the writer from the
This leads me to the conclusion that the best way forward in the long run would be to add a Haskell reader and writer for the TeX AST format of witiko/markdown to Pandoc. Would you merge such a contribution? |
Where is the TeX AST format of witiko/markdown documented, exactly? I'd like to take a look. |
There is a specification in the Token Renderers section of the user manual (HTML) and the technical documentation (PDF). |
Not crazy about the |
The
Having shorter macros such as The namespacing does not need to be the |
I have always assumed this would mean emitting a bunch of macros named like |
I would be curious to understand how fully these proposed efforts may offer a foundation for expanding the LaTeX writer toward greater support for document abstractions (discussed earlier). Certainly, it would be valuable that any improvements would open opportunities of such kind. |
@jgm To give you an update, @drehak and I have since written a white paper (in Slovak, here is a machine translation to English) that discusses how the elements of Pandoc's AST can be mapped to the elements of the Markdown package for TeX. We have also produced a proof of concept that uses a Pandoc Lua Writer to convert any document understood by Pandoc to generic TeX, which can then be typeset using the Markdown package for TeX. We plan to fully implement the Lua writer and the accompanying package for TeX and describe them both in detail in a TUGboat article that would appear in March. We will share the preprint with you when ready. Since the Markdown package supports plain TeX, LaTeX, and ConTeXt, Pandoc could then reduce some of its maintenance costs and receive support for plain TeX by replacing its writers for ConTeXt and LaTeX with a single writer that would produce generic TeX. This would be to our mutual benefit, because we could in turn stop shipping and maintaining our Lua writer for generic TeX. |
@Witiko excellent, I look forward to hearing more about this in a couple months! |
@jgm @drehak In Section 2.3 of our TUGboat 43:1 article preprint, we give an example of how our proof of concept can be used to directly typeset and style any document format understood by Pandoc in TeX:
|
I want to explore the possibility of adding a plain tex writer---one whose output can be processed by plain tex (or perhaps
eplain
), without latex or context macros.What I have in mind is to have pandoc emit macros that are fairly closely customized to pandoc's own structural elements, and include definitions of these macros in the preamble of the default template. Then users could modify these macros to get the appearance they want.
The text was updated successfully, but these errors were encountered: