Typesetting Markdown

Of possible interest, I’ve been writing a series of blog posts regarding typesetting Markdown. The posts primarily focus on using pandoc’s extended Markdown:

https://dave.autonoma.ca/blog/

The later posts rely heavily on the div syntax discussed at length on the extensions thread. It would be spectacular if CommonMark would adopt the ::: syntax.

3 Likes

@DaveJarvis,

At the risk of going off-topic, just wanted to commend you for the post Web of Knowledge and its section on the history of IBM.

Tech culture is dominated by hubris, a hubris that rejects self-examination and critique (try posting anything critical on Hacker News, the Twitter of the tech community). The result of course is a massive failure of conscience. There has been a slight change in reaction to the 2016 election, but it is far too little far too late. I would like to think techies today who read your post can make the mental jump to what’s happened to the web and the problems with the business models that dominate, and the primacy of profit over morality.

2 Likes

At the risk of going off-topic, just wanted to commend you for the

Thank you, vas, your commendation means a lot.

If you have ideas or suggestions or requests for the typesetting markdown parts of the blog, please drop me a line.

@DaveJarvis Nice!

Do you cover centering text? I don’t see it.

::: poem
I want to center this.
:::

Using pandoc to convert Markdown to ConTeXt:

\startpoem
I want to center this.
\stoppoem

In ConTeXt, this becomes something like:

\setupstartstop[poem][
  before={\startalignment[middle]},
  after={\stopalignment},
]

Don’t quote me on the syntax, but that’s the idea.

Thanks. I wonder if there’s a way to avoid blasting my SSD by installing ConTeXt. Last time I checked all these TeX distros were a gigabyte or more, which is deeply, deeply confusing given what they do.

Does Pandoc natively offer TeX output? I’m confused by what’s in your “Using pandoc…” box. Is that TeX? Then what is the syntax in your “In ConTeXt…” box? It would be nice to get TeX or LaTeX output from Pandoc, which I could then paste into an online TeX platform like Authorea…

I install ConTeXt into /opt/context:

$ du -hcs /opt/context/
438M	/opt/context/
438M	total

If you don’t install all the modules, it’s a bit smaller. I find it can still conflict with other TeX distributions (such as LaTeX), but since I’m not in academia I don’t have to have LaTeX installed. I’m sure there are ways to get them both working at the same time, I’ve just not put any effort into it.

Yes! Like this:

pandoc -f markdown -t context filename.md

Cool, eh? You can export LaTeX as well:

pandoc -f markdown -t latex filename.md
1 Like

Man, I installed XeTeX and it was devastating. 5 GB. I don’t understand why TeX distros are so bloated and primitive. The interface is just awful software, looks like something designed in 1994.

Dude, have some respect. TeX was created in 1978 by the great Donald Knuth. All the great and simple modern software you are comparing it to rests on the shoulders of giants. I’m sure XeTeX does a lot of stuff. This is all open source, free software. The ratio of users to people who donate time to improving free software is like a million to one. The distros include a lot of packages, documentation for them, lots of fonts, etc. You don’t have to install all of it. I’m sure you can find smaller distributions if you looked. But we don’t bat an eye streaming a 5GB movie that we’re over and done with in 2 hours. Just sayin’. I’ll bet you’re really young :wink:

1 Like

I’m familiar with the history of TeX, Knuth, the cult, etc. I was a veteran software QA manager before I became a social scientist, and I don’t like to make excuses for bad software. Open source is no excuse for software of this quality (especially when open source is often touted as a factor that leads to superior software). I have a lot of experience trying to get Miktex to work as well, mostly unsuccessful.

TeX is just an awful software ecosystem, beyond bad. Half the time, like with XeTeX this morning, there’s no way to uninstall it. It doesn’t register itself properly as an application in Windows 10, even though it was installed with an installer (of its own design; not simply unzipped binaries), so it’s not listed in Programs as something that can be uninstalled. If you’re going to issue a Windows release, it’s not much effort to use the standard platform APIs for things like registering yourself properly as an application.

The 5 GB is after some shrinking, leaving out all the languages it wanted to install. The installer was too primitive to be able to determine which packages I’d need or not, much different from say the Visual Studio installer, which orchestrates a similarly enormous multi-GB install, but which gives you lots of information and a proper UI to be able to make your choices. TeX distros usually want to install packages for every esoteric field and the thesis format of Argentina’s Air Force Academy or something. It’s unclear why they do this. It’s also unclear why no one has bothered to build a normal application that consumes a TeX dialect and renders modern PDF (v1.7) files or other outputs. Surely it must be possible to do this with a 100 MiB application. (Or even a clean-sheet typesetting markup language and system, but it’s not clear if a clean-sheet language could notably improve on TeX/LaTeX, which seem like okay languages.)

I like the equation typesetting. It’s not clear why else to use TeX distros. The most noteworthy thing seems to be Knuth’s justification algorithm, but since justification has been shown to be less readable than ragged right, I wouldn’t justify unless a journal forced me to. And they tend to want Word docs anyway. I’d be interested in seeing research on how good Word’s justification algorithm is compared to TeX, and various microtypography features, kerning, etc. No one seems to have researched it, and most pro-TeX claims on those variables tend to be comparing TeX to 20 year old versions of Word, not Word 2019/2016, for instance. There’s remarkably little research except for Knauff and Nejasmic’s study of “efficiency”, which seems to have some validity problems.

1 Like

Actually, I take it back about MiKteX. I just installed it after having to cut away XeTeX, and it’s much improved since I last used it. It has a proper installer and package UI, much nicer than XeTeX. And under 1 GB.

2 Likes

Pandoc has a number of paths towards typesetting, LaTeX probably being the most robust at this point. One other direction I’m working on is a Pandoc writer to support SILE (see pandoc#6087 and the related Draft PR). I mention this because it does handle the ::: syntax for divs using nested classes (kind of like how HTML/CSS would) where you can specify a Lua formula for typesetting divs any way you like.

Also note that if SILE is not for you yet there are Lua filters out there to map Pandoc’s div blocks to LaTeX environments. This is quite a robust solution for typesetting Markdown.