hplgit / doconce

Lightweight markup language - document once, include anywhere
http://hplgit.github.io/doconce/doc/web/index.html
Other
311 stars 60 forks source link

Adding option to --latex_style #53

Closed MartinHeroux closed 8 years ago

MartinHeroux commented 8 years ago

Using LaTeX or DocOnce to prepare manuscripts is great because the files can be version controlled and the writer does not have to fuss over the formatting.

However, one of the biggest challenges of using LaTeX to prepare manuscripts in the life and health sciences is that few journals support LaTeX. No LaTeX styles or templates are provided, and the writer has to spend considerable time tweaking LaTeX parameters to meet the formatting requirements of a given journal. And if your manuscript is accepted, you will have to generate a .doc version of your manuscript.

Nevertheless, there are a few journals that support LaTeX. A series of journals that have become increasingly popular are PLOS journals. When preparing a manuscript for one of these journals, there is a LaTeX template that can be used. It is not a .cls, but rather a .tex file with lots of commands, as well as a .bst file.

Would it be possible to add some functionality to DocOnce so that users could specify --latex_style=PLOS? I am not certain whether this would be more complicated than adding another pdf_style based on a .cls file. As a non-expert, would this be something I could tackle with some guidance, or would this be too hard?

Adding a PLOS latex_style would add to the pool of people who might be interested in using DocOnce. For me, it would be easier to get colleagues to collaborate a .do.txt file; most would be intimated and confused with a .tex file.

Regards.

hplgit commented 8 years ago

The target audience for DocOnce writes a lot of math and code so their journals typically require (or at least offer) a latex template. However, these templates often imply quite special newcommands for title, authors, abstract, and so forth so the generated latex code depends heavily on the template. We have support for SIAM and Elsevier templates in DocOnce, but no others - so far.

Traditional papers where the publisher has the copyright make most sense to be written directly in latex, but with open access, it makes much sense to use DocOnce and publish various (updated) electronic versions on personal websites.

Most journals (probably PLOS too) will accept submission of papers typeset in one of the standard latex formats generated by DocOnce. Only in the production phase it is necessary to use to journal's template, but I guess that most production offices will help with this. So, standard latex will usually be enough to get the paper refereed.

Most of the packages in the PLOS latex template are also used in the DocOnce generated latex output. With a few tweaks, we can add the PLOS layout in a compilation script:

#!/bin/bash
doconce format pdflatex mydoc --latex_bibstyle=plos2015 --latex_code_style=vrb
doconce subst '% insert custom LaTeX commands...' '
\usepackage[aboveskip=1pt,labelfont=bf,labelsep=period,justification=raggedright,singlelinecheck=off]{caption}
% Text layout
\raggedright
\setlength{\parindent}{0.5cm}
\textwidth 5.25in 
\textheight 8.75in
% Remove brackets from numbering in List of References
\makeatletter
\renewcommand{\@biblabel}[1]{\quad#1.}
\makeatother
\usepackage[right]{lineno}
\usepackage[top=0.85in,left=2.75in,footskip=0.75in]{geometry}' mydoc.tex
pdflatex mydoc

The above latex commands seem to be the most important ones from the PLOS template.

MartinHeroux commented 8 years ago

Thank you for the thoughtful reply and accompanying script.

hplgit commented 8 years ago

This question has now entered the FAQ:

http://hplgit.github.io/doconce/doc/pub/trouble/trouble.html#trouble:latex:styles