Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Draft mode (double spaced, numbered lines) #299

Open
olgabot opened this issue Jan 6, 2020 · 9 comments
Open

Feature request: Draft mode (double spaced, numbered lines) #299

olgabot opened this issue Jan 6, 2020 · 9 comments

Comments

@olgabot
Copy link
Contributor

olgabot commented Jan 6, 2020

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

Screen Shot 2020-01-06 at 11 05 48 AM

Draft format

Screen Shot 2020-01-06 at 11 08 48 AM
Screen Shot 2020-01-06 at 11 08 55 AM

Original document class

\documentclass[%
 reprint,
%superscriptaddress,
%groupedaddress,
%unsortedaddress,
%runinaddress,
%frontmatterverbose, 
%preprint,
%showpacs,preprintnumbers,
%nofootinbib,
%nobibnotes,
%bibnotes,
 amsmath,amssymb,
 aps,
%pra,
%prb,
%rmp,
%prstab,
%prstper,
%floatfix,
]{revtex4-1}

\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
%\usepackage{hyperref}% add hypertext capabilities
%\usepackage[mathlines]{lineno}% Enable numbering of text and display math
%\linenumbers\relax % Commence numbering lines

Preprint document configuration

\documentclass[%
%  reprint,
%superscriptaddress,
%groupedaddress,
%unsortedaddress,
%runinaddress,
%frontmatterverbose, 
preprint,
%showpacs,
% preprintnumbers,
%nofootinbib,
%nobibnotes,
%bibnotes,
 amsmath,amssymb,
 aps,
%pra,
%prb,
%rmp,
%prstab,
%prstper,
%floatfix,
]{revtex4-1}

\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
%\usepackage{hyperref}% add hypertext capabilities
\usepackage[mathlines]{lineno}% Enable numbering of text and display math
\linenumbers\relax % Commence numbering lines

Would it be possible to add a similar feature to manubot, which would double-space the paper and number lines?

@dhimmel dhimmel transferred this issue from manubot/manubot Jan 6, 2020
@dhimmel
Copy link
Member

dhimmel commented Jan 6, 2020

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.

@vincerubinetti
Copy link
Collaborator

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.

@olgabot
Copy link
Contributor Author

olgabot commented Jan 6, 2020

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?

@dhimmel
Copy link
Member

dhimmel commented Jan 6, 2020

I'd be happy with a double spaced version

Try increasing the value in:

line-height: 1.35;

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.

@agitter
Copy link
Member

agitter commented Jan 7, 2020

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?

@dhimmel
Copy link
Member

dhimmel commented Jan 7, 2020

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?

@vincerubinetti
Copy link
Collaborator

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.

@dhimmel
Copy link
Member

dhimmel commented Feb 19, 2020

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: rstudio/pagedown#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.

@julientaq
Copy link

👋
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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants