hardcopy and double-spaced printing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

hardcopy and double-spaced printing

Kevin Lawler
I would like to have hardcopy (printing) respect GUI Vim's linespace
or some similar option in order to achieve double-spaced printing. Is
there a way to do this?

The current alternative is to copy the text out of Vim (MacVim) and
paste it into Microsoft Word, and then use their double-spacing
feature.

I would also be willing to use some kind of Vim command-line fu or
postscript after-processing with Unix tools, if any of this is a
possible solution. Is there some way to pass a simple arg to the
postscript writer?

Unlikely to work: Since there are long lines and rarely newlines,
simply replacing each newline with two won't work (unless you can
somehow intercept the wrapping done for printing, plus respect page
breaks and headers).

I sort of suspect some dev is required but I am asking here first
anyway. If so, I would guess it's probably a simple variable that goes
to the vim postscript writer that needs to be changed. If the
translation from linespace to the postscript variable is not direct,
then a janky version, e.g. setting the var directly, would be
suitable. Perhaps as a postscript argument. Linespace is just a good
way of describing what typically goes into double-spacing.

Thanks,
Kevin

tags: double, space, double-spacing, linespace, hardcopy, printing, postscript

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: hardcopy and double-spaced printing

Tony Mechelynck
On Tue, Jul 3, 2018 at 9:24 PM, Kevin Lawler <[hidden email]> wrote:
> I would like to have hardcopy (printing) respect GUI Vim's linespace
> or some similar option in order to achieve double-spaced printing. Is
> there a way to do this?

I think you could do it with a custom 'printexpr' (q.v.) but you might
have to experiment before you find the right setting.

>
> The current alternative is to copy the text out of Vim (MacVim) and
> paste it into Microsoft Word, and then use their double-spacing
> feature.
>
> I would also be willing to use some kind of Vim command-line fu or
> postscript after-processing with Unix tools, if any of this is a
> possible solution. Is there some way to pass a simple arg to the
> postscript writer?
>
> Unlikely to work: Since there are long lines and rarely newlines,
> simply replacing each newline with two won't work (unless you can
> somehow intercept the wrapping done for printing, plus respect page
> breaks and headers).
>
> I sort of suspect some dev is required but I am asking here first
> anyway. If so, I would guess it's probably a simple variable that goes
> to the vim postscript writer that needs to be changed. If the
> translation from linespace to the postscript variable is not direct,
> then a janky version, e.g. setting the var directly, would be
> suitable. Perhaps as a postscript argument. Linespace is just a good
> way of describing what typically goes into double-spacing.

Unless a good 'printexpr' can be devised, an additional sub-option to
'printoptions' (see |popt-option|) might solve it but this would
require a change in the C code and I'm not competent to do it.
>
> Thanks,
> Kevin

Best regards,
Tony.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: hardcopy and double-spaced printing

meine van essen
In reply to this post by Kevin Lawler
> I would like to have hardcopy (printing) respect GUI Vim's linespace
> or some similar option in order to achieve double-spaced printing. Is
> there a way to do this?

you can use vim to generate the text file and use 'pandoc' to convert the text file to something publishable, like a PDF. pandoc accepts options to manage paper and font size and line spacing. see '$ man pandoc' or pandoc.org

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'

> The current alternative is to copy the text out of Vim (MacVim) and
> paste it into Microsoft Word, and then use their double-spacing
> feature.

that way it looks a practical workaround in the beginning, but it neglects the basic separation between vim as the text _editor_ and any publishing tool. just take the learning curve using vim for creating (eg.) markdown text files and pandoc to handle the publishing part -- each program for it's own specialties. (besides AFAIK vim has no 'linespace', its just the way it's put on the screen most comfortable)

> I would also be willing to use some kind of Vim command-line fu or
> postscript after-processing with Unix tools, if any of this is a
> possible solution. Is there some way to pass a simple arg to the
> postscript writer?

see 'pandoc'

//meine

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: hardcopy and double-spaced printing

Kevin Lawler
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.