Live data from Hacker News

Writing a Book with Pandoc, Make, and Vim

keleshev.com

51–60 of 61 posts

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

#51

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…

I assume organisations that need such complex layout also have a budget to pull together immersive HTML pages, infographic design or comprehensive reports. For instance the WHO has some pretty complex and visually pleasing reports; they seem to be using InDesign and I'm sure they use actual designers and researchers to produce them.

I like the idea of using open-source tools to create books and documentation because you could incorporate the process into a workflow that pulls in actual code or on-the-fly generated graphics. I don't own any commercial software, so I don't know how feasable that process would be with something like InDesign.

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

#52

A couple of things that might be of interest: 1) pandoc is awesome. 2) There are integrated development environments that allow you to write in markdown and output to pdf, html, and word with the flick of a switch. Rstudio with knitr, bookdown, and markdown has some nice functionality. Plus you can do graphs and drawings and embed them in the the rmd (r markdown) text. 3) There is an earlier post in HN from Gilles Ca…

> https://castel.dev/post/lecture-notes-1/

Very nice! Thank you.

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

#53
For any interested, here is my Pandoc book writing setup.

I have a couple bash scripts that I use to call pandoc to generate PDFs, HTML, or ePub.

Here is the repo https://gitlab.com/pianomanfrazier/pandoc-markdown-book and here is my blog post https://pianomanfrazier.com/post/write-a-book-with-markdown/

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

#54
post #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…

What does inDesign have to do with anything? This article isn't talking about using Windows or Mac software, and especially not proprietary Adobe software.

Also, if he's writing a book, why would he want to save anything as a "high res image" (implying raster graphics)?

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

#55
I used LiterateMarkdown [1] to write a PhD thesis in Markdown with reasonable success. It's main feature is being able to read Jupyter notebooks and include computations and plots using R, python and Groovy inline, so pretty handy for a thesis with lots of data analysis.

A beauty of using Pandoc is you can translate to Word for people who insist on that for review / edit / comments.

One tip: on OSX I use Skim as the PDF previewer. It is not a particularly great or special PDF viewer except for one thing: it does live update of the PDF without shifting the position of the page, even if you are zoomed in etc. This means you can work on a section iteratively and watch it update live as you work, which is pretty handy for proof-reading what you are writing.

[1] https://bit.ly/2XzTpSy [2] https://skim-app.sourceforge.io/

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

#56
Pandoc and make totally. I have a personal workflow for all my academic articles; which is expanding to books, and which involves chapters stored in individual markdown files in github, pandoc to build with a makefile to tie it all together[1], and zotero spitting out CSL json bibliographies, etc.

Honestly, though, I find writing in Markdown in vim/emacs to be really unergonomic. The unit of writing in code is the line (or the function or the block or the s-expression or whatever depending on language and task---something comprehensible to vim and emacs anyway); but with prose in Markdown the unit of writing is much less defined---sometimes sentence, sometimes paragraph, sometimes clause... and the movements just don't work for me there.

So I just do the writing in Sublime Text. Seems to work for me.

[1] But I'm not nearly good enough with make to do complicated things like back up or build every file in a directory. I hacked together my own backup utility @ https://github.com/paultopia/writingBackup

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

#57
post #7

Can you refer to figures and have the name rendered? For instance, a piece of text referring to a figure and the figure’s label will both get rendered to “Figure 2.8” regardless of paragraph edits and figures inserted or delete before it?

Pandoc has an extension for cross-references.

https://hackage.haskell.org/package/pandoc-crossref

https://lierdakil.github.io/pandoc-crossref/

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

#59
post #27

Earlier quoted context omitted.

Skimming the examples the typographical quality is that of a webpage (which is to be expected), miles below TeX-quality typesetting.

I think it really depends on the font you use and the CSS rules you apply. LaTeX needs tweaking, too, even with a good template. E.g., if your font supports it, you can enable ligatures: text-rendering: optimizeLegibility;

Ligatures don't make good typesetting. In fact, I'd expect a text to have enabled ligatures by default, that's not something to be proud of in any way.

Typesetting is about how the words are placed in the given space, how they're broken up, how the spacing is done to not line up between lines, managing punctuation, figures etc etc. Browsers do none of that, and one shouldn't expect them to, because that's not their job. A browsers job is to present content fast, not to figure out how to do it as beautiful as possible for minutes at a time, that's what TeX is for. TeX and a browsers rendering engine are different tools for different jobs and thinking one could achieve the same result as the other is not realistic in the current time.

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

#60

Earlier quoted context omitted.

Learning LaTex and tiKz help out with this. It looks like a presentation. So latex beamer package with some custom templates. The downside is that latex and tikz has a little bit of a learning curve. But it is worth it in the long run.

Have you used Katex in place of Latex? The latter is much lighter, especially if you're trying to publish a tome for the web.

No, I haven't. But I'll check it out! I had to go the full route a while back. Yes, it was bulky, but got the job done.
Post reply on HN