Live data from Hacker News

Writing a Book with Pandoc, Make, and Vim

keleshev.com

31–40 of 61 posts

Re: Writing a Book with Pandoc, Make, and Vim

#31
post #2

To emulate the live preview, there is a neat piece of software called entr[1], from their main page, you can do something like: ls | entr make And whenever you save a change, the build is triggered and the preview is updated. [1]: http://eradman.com/entrproject/

I personally use fswatch for this. The invocation is probably something like this:

    fswatch -0 ***.md | xargs -0 make
I invoke a variant of this from my Makefile with a phony watch target. I think the main change is that I also echo a bell character, to provide some feedback.

Fun tip: Preview will automatically reload PDFs on disk, though with some limitations that I workaround by waiting for the bell.

Re: Writing a Book with Pandoc, Make, and Vim

#32

It's even possible to replace (Xe)LaTeX with weasy¹, a Python HTML-to-PDF converter. It supports two-colums via CSS, automatic CSS hypens, CSS page counters and embedding SVGs. I just needed an HTML header with CSS in the markdown file. $ pandoc --filter pandoc-citeproc --csl ieee.csl --bibliography=paper.bib --smart --normalize -f markdown+multiline_tables+inline_notes -t html5 -V margin-top:0.5in -V margin-bottom:0…

This is a very interesting (open source) project that I didn’t know about; thank you for mentioning it. But it doesn’t replace LaTeX, as it doesn’t produce the same results. A glance at the sample documents reveals the ugly typography resulting from the word-processing layout strategy employed in web browsers. This is confirmed in the documentation. So this could be useful if you have an existing set of HTML pages th…

I cant tell the difference between this layout quality and latex. What are you noticing?

Re: Writing a Book with Pandoc, Make, and Vim

#33

Earlier quoted context omitted.

This is a very interesting (open source) project that I didn’t know about; thank you for mentioning it. But it doesn’t replace LaTeX, as it doesn’t produce the same results. A glance at the sample documents reveals the ugly typography resulting from the word-processing layout strategy employed in web browsers. This is confirmed in the documentation. So this could be useful if you have an existing set of HTML pages th…

I cant tell the difference between this layout quality and latex. What are you noticing?

The first things that jump out are the large and uneven gaps between words and the “color” variations among paragraphs. What I mean by the “word-processing layout strategy” is the algorithm where, when you run out of space on a line, you simply break the line at the end of the previous word, fill up the space (for justified text) by expanding the spaces between words, and begin the next line. When you get to the end of the paragraph you go on to the next one. The TeX layout engine, in contrast, makes several passes over each paragraph, adjusting the line breaking (including hyphenation) in order to optimize its appearance (which includes such things as trying to avoid successive hyphenated lines); then, when the page is set, it goes over the entire page to try to equalize the density, or color, among paragraphs.

Re: Writing a Book with Pandoc, Make, and Vim

#35
I know this is tangential, but I would love for someone to talk about writing a more visual type of book, full of images, tables and charts for the business world.

A table like the one in the first screenshot of this post works well because the author is not repeatedly iterating on it, there's very little text and information flows top-to-bottom very neatly. That's great, but it's also extremely basic.

Take a look at something like https://www.jpmorgan.com/jpmpdf/1320605428574.pdf and imagine writing that. How do you lay things out on a page? How do you make content fit a layout? There's no grid.

The reality is people use PowerPoint to do that, but PowerPoint is a slide authoring tool that assumes you have a few bullets, maybe one or two images per slide.

Dense presentations make its shortcomings obvious and quite painful.

It boggles the mind that with all of the resources dumped into CSS/JS and web development in general, nobody has leveraged that experience to build an authoring tool that's 21st-century ready, with version control, with a clear separation but nonetheless linked relationship of raw data, actual content output and formatting and final publishing into PDF.

What am I missing?

EDIT: one more example for good measure https://www.jefferies.com/CMSFiles/Jefferies.com/files/W%201...

Re: Writing a Book with Pandoc, Make, and Vim

#36

I’m always interested in reading articles like this, as I like to see the setups that people come up with to produce books and documents. I didn’t know about set virtualedit=all in vim! If you learn how to extend Pandoc with your own filters, which you can write in several languages, there is no limit to what you can do. Here’s the description, published in the sadly defunct Linux Journal , of the system I created to…

Everything in that link can be done with inDesign and having data. Finding a way to complete using console or alternative applications would take hacking the inDes app or finding some sort of IFTTT sort of automation when needed, then saving as a high res image, and referencing as a link in your console layout doc. At the end it would have to compile as an image into something (might as well be inDesign) and at that point why not just layout the book with inDesign from the start? Writing the book in a text doc with some tagged markdown for rules, linking text to connected and flowed into styled text boxes that have rules assigned to them, and generating all the charts and sheets necessary to complete. Visual communication isn’t a strongpoint in code interfaces.

Re: Writing a Book with Pandoc, Make, and Vim

#37

I know this is tangential, but I would love for someone to talk about writing a more visual type of book, full of images, tables and charts for the business world. A table like the one in the first screenshot of this post works well because the author is not repeatedly iterating on it, there's very little text and information flows top-to-bottom very neatly. That's great, but it's also extremely basic. Take a look at…

You mean https://bubblin.io/book/bookiza-documentation-by-marvin-dani... ?

Re: Writing a Book with Pandoc, Make, and Vim

#40

I know this is tangential, but I would love for someone to talk about writing a more visual type of book, full of images, tables and charts for the business world. A table like the one in the first screenshot of this post works well because the author is not repeatedly iterating on it, there's very little text and information flows top-to-bottom very neatly. That's great, but it's also extremely basic. Take a look at…

You mean https://bubblin.io/book/bookiza-documentation-by-marvin-dani... ?

That's part of it, but the content still flows top-to-bottom for the most part and is not quite enterprise-ready, packaged into a standalone app.
Post reply on HN