Friday, July 6, 2018

Re: hardcopy and double-spaced printing

On Wednesday, July 4, 2018 at 5:04:24 PM UTC-5, meine van essen wrote:
> pandoc seems to have a new feature where you can use a bunch of metadata to manage the options mentioned, see https://stackoverflow.com/questions/14883525/set-double-spacing-and-line-numbers-when-converting-from-markdown-to-pdf-with-pa#29643267 and its link to the 'YAML-header'

On your recommendation I tried pandoc with a prepended header and it's not bad. It involves a sizable digression into LaTeX, and then it gets some things wrong because it assumes pandoc-markdown, for instance, when I've been typing against a custom Vim syntax interpreter. So text blocks that have been indented four or more spaces render literally, and all styling is dropped. All Vim styling which doesn't have an analog in markdown is dropped.

The right way to do it is still to edit the Vim source to allow for double spacing [variable spacing], I think. This is with all things considered, including mission creep of the hardcopy format. I made an attempt. For any interested developers, the logic in question is here:

https://github.com/vim/vim/blob/master/src/hardcopy.c#L3369

and you multiply where `prt_line_height` is by a desired line spacing multiple. You need an `if (margin)` guard so that `prt_pos_y` is not changed for margins. This kind of works but is broken in a few corner cases. I had to timeout there: my impression is that this change needs to be implemented by a developer already familiar with `hardcopy.c`. If you know what's going on in that file, solving the corners should be easy.

The GUI Vim `linespace` variable is in something like points, and not a scalar representing the multiple of the line height, and so the fix would either need a conversion, or alternatively a new and separate printing option, distinct from `linespace`, representing the multiple.

P.S. Assuming monospaced font, another rough Unix tools pre-processor for printing in Vim is:
fold -s -w 70 myfile.txt | sed '/^$/d;G'
where the argument to -w is the line width in characters. This replaces one or more newlines with two newlines.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: