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

Add template for the MNRAS (Monthly Notices of the Royal Astronomical Society) article. #175

Merged
merged 11 commits into from
Jul 5, 2018
Merged

Conversation

oleskiewicz
Copy link
Contributor

@oleskiewicz oleskiewicz commented Jun 21, 2018

This creates a template for a submission to MNRAS journal, based on their LaTeX template file. I've added most of the housekeeping as outlined here, but wasn't sure what more is there to be done.

md_extensions = md_extensions,
format = "mnras_article",
template = "template.tex",
csl = "mnras.csl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to use system.file() to refer to these (as the current code assumes they are in the current working directory)

@oleskiewicz
Copy link
Contributor Author

Thanks @jjallaire, I'm just starting learning R so this is all a bit new to me!

I have changed the template and csl references using the find_resource helper function, just as plos_article does it, I hope this is better now?

@jjallaire
Copy link
Member

You should also run the tests locally (you can do this with devtools::test()). When I run your test I get this failure:

unused argument (csl = "/Users/jjallaire/packages/rticles/inst/rmarkdown/templates/mnras_article/resources/mnras.csl")
1: rmarkdown::render(testdoc) at /Users/jjallaire/packages/rticles/tests/testthat/test_formats.R:30
2: create_output_format(output_format$name, output_format$options)
3: do.call(output_format_func, options)

I think you want to call pdf_document_format() rather than pdf_document()

@jjallaire
Copy link
Member

I am still unable to get this article format to actually work. Here is the error I get:

processing file: Untitled.Rmd
output file: Untitled.knit.md

tlmgr search --file --global '/example'
! LaTeX Error: File `example' not found.

Error: Failed to compile Untitled.tex. See Untitled.log for more info.
In addition: Warning message:
In parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)) :
  Failed to find a package that contains example
Execution halted

@oleskiewicz
Copy link
Contributor Author

oleskiewicz commented Jun 22, 2018

Oh I see -- it seems like the LaTeX environment is trying to pick up the example figure (example.png), but it assumes the .tex extension and fails due to some relative path.

I'll change the way figure is rendered in the skeleton (it's my understanding that including figures through knitr is preferred anyway?), hopefully this will fix it.

Sorry it keeps failing, the test has passed successfully for me.

Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase against the current master branch here, resolve conflicts, and force push. Then your format will be automatically check on Travis. Thanks!

@yihui yihui force-pushed the master branch 3 times, most recently from 8023cbf to 928d6cd Compare July 3, 2018 16:11
Piotr Oleskiewicz added 9 commits July 4, 2018 14:32
I couldn't find official MNRAS CSL file so just this one for now.
inherit_pdf_document was changed to pdf_document_format
LaTeX in the testing environment appears to be looking for .tex figure
before finding the .png one.
Appendices need to be positioned below references, hence the slightly
hacky div positioning.  See: https://stackoverflow.com/q/16427637
@oleskiewicz
Copy link
Contributor Author

The build fails for the same reason as previously:

Package pdftex.def Error: File `example.png' not found: using draft setting.

I have checked other templates, and for instance amq_article passes the Travis build while including figures from external files in skeleton. Similarly, there are no issues with the template locally. How do I include the example.png in the test render?

% To include a figure from a file named example.*
% Allowable file formats are eps or ps if compiling using latex
% or pdf, png, jpg if compiling using pdflatex
\includegraphics[width=\columnwidth]{example.png}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You included example.png here but the file is not included in the PR. You should either include a real file, or comment out this line.

@oleskiewicz
Copy link
Contributor Author

The tests have passed! Thank you for all your help -- let me know if there is anything else that needs fixing.

Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks a lot!

@yihui yihui merged commit 629b074 into rstudio:master Jul 5, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants