Open olgabot opened 4 years ago
We've got similar feature requests a few times:
Currently, we create the PDF from the HTML, by essentially printing to PDF. The paged-js library could allow us to add page numbers, but I don't see the line numbering feature. Maybe @vincerubinetti can look into whether it is feasible that we could create a HTML print view that has line numbers. I agree it would be super helpful for submitting documents for review.
_update see this reddit thread on pagedjs_
The other option would be to explore whether we can enable line numbers in the DOCX. In general, the DOCX output is not pretty, but it often gets the job done for submission.
The final option would be to try to go though LaTeX to create the PDF, but we've already burned a lot of time trying to get this to work in #256 / #249.
Unfortunately line numbers are the same issue as page numbers. HTML just wasn't designed with pagination in mind.
When the browser performs the automatic text wrapping -- and automatic pagination when printing -- it doesn't expose any of the information, like what breaking algorithm to use (or was used) or where things were broken, to the developer.
Ah I didn't see those! Thanks for pointing them out. I'm surprised that line numbering has the same problems as page numbering, but that makes sense that when the text is reflowed, the HTML didn't know what word was going to start on each line.
This was one of those "oh I bet this is easy to add" user moments that turns out to be way more complicated.
I'd be happy with a double spaced version as then that is easy to print and write comments on. Would that be possible?
I'd be happy with a double spaced version
Try increasing the value in:
I think you have to do something like 3.0
to get an equivalent of double spaced.
This will affect the print output but not the in-browser view.
Because double spacing is feasible and a common request, should work on an easier way to toggle it on? We could have a copy of build/pandoc-defaults
for double spacing that would point to something like build/themes/double-space.html
. That requires copying a lot of files to change one line though. Is there anything simpler?
Is there anything simpler?
I think editing line-height
in the CSS is simple enough to do, once you know what to do... so it's mostly a matter of missing documentation.
But perhaps another option would be to use CSS custom properties, such that we could provide a compact place for users to set commonly modified variables. @vincerubinetti does that make sense?
I doubt we want to use CSS variables. Things can get messy, on top of the already messy CSS specificity.
Yes this is something that has been discussed in other issues. It depends how we decide to handle all of the other theme issues -- like whether to have a core theme that we build other themes on top of or duplicate a lot, how we will handle compact printing modes, etc -- because all of this unfortunately has to be designed and considered as a whole. CSS isn't good with modularity, so we have to think about everything at once, at very carefully, before we make.
@dhimmel This might be something we wait until the refactor to implement.
There was recently a thread about pagedjs on Reddit. I asked about whether pagedjs could support many of the features we're looking for.
@julientaq provided a detailed reply. Thanks so much! Copying below:
numbering pages on the output PDF
This is pretty basic pagedmedia specs stuff, we got you covered in the doc. (you may want to read from the top of the page though) https://www.pagedjs.org/documentation/07-generated-content-in-margin-boxes/#page-counter
numbering lines on the output PDF
A solution build by the community: https://github.com/rstudio/pagedown/issues/115 I'll make a post about that. We also have a simple solution to build a baseline grid: https://www.pagedjs.org/img/linecount.png
floating figures and tables to avoid large chunks of whitespace
We do have solutions to do that, but it depends on your content and how you want it to behave. Floating top is pretty much easy to do. But julie, our specialist of specifications wrote quite a good article about that: https://www.pagedjs.org/page-floats/
multiple columns on PDF pages
Yes sir :) We're using the browser and pages are made using css grid and flex, so you can do pretty much what you would do in a browser for screen. I'll try to find some examples in the coming days.
@vincerubinetti we should take a deeper look at whether these solutions would work for us.
:wave: my pleasure :)
i’ll be happy to help if you need anything. we can talk on mattermost.pagedmedia.org if you want, and i’ll keep an eye on this issue :)
One very convenient feature of the American Physical Society Template (APS) is a preprint/draft mode (see manual section V.3. One-column vs. two-column layouts), which changes to a single-column, double spaced format that makes it very easy to view and edit for collaborators. By changing some of the
\documentclass
parameters (in "Details" below), the paper becomes much more easy on the eyes. Additionally, some journals require lines to be numbered for preprint submissions, so that feature would be helpful as well.Below are some examples of a draft format:
Original APS format
Draft format
Would it be possible to add a similar feature to manubot, which would double-space the paper and number lines?