-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add template for the MNRAS (Monthly Notices of the Royal Astronomical…
… Society) article. (#175) * Add MNRAS templates and skeleton. * Add a CSL file. I couldn't find official MNRAS CSL file so just this one for now. * Add combinations of authors and affiliations * Add MNRAS entry to NAMESPACE and README.md * Add test for MNRAS template * Reference template files paths * Change PDF function to include CSL in Pandoc inherit_pdf_document was changed to pdf_document_format * Fix missing figure extensions LaTeX in the testing environment appears to be looking for .tex figure before finding the .png one. * Add appendices Appendices need to be positioned below references, hence the slightly hacky div positioning. See: https://stackoverflow.com/q/16427637 * Add example figure * Generate documentation with Roxygen
- Loading branch information
1 parent
76a83cc
commit 629b074
Showing
14 changed files
with
2,165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#' Monthly Notices of the Royal Astronomical Society (MNRAS) Journal format. | ||
#' | ||
#' Format for creating an Monthly Notices of Royal Astronomical Society (MNRAS) Journal articles. | ||
#' Adapted from | ||
#' \href{https://www.ras.org.uk/news-and-press/2641-new-version-of-the-mnras-latex-package}{https://www.ras.org.uk/news-and-press/2641-new-version-of-the-mnras-latex-package}. | ||
#' | ||
#' @inheritParams rmarkdown::pdf_document | ||
#' @param ... Arguments to \code{rmarkdown::pdf_document} | ||
#' | ||
#' @return R Markdown output format to pass to \code{\link[rmarkdown:render]{render}} | ||
#' @examples | ||
#' | ||
#' \dontrun{ | ||
#' library(rmarkdown) | ||
#' draft("MyArticle.Rmd", template = "mnras_article", package = "rticles") | ||
#' } | ||
#' | ||
#' @export | ||
mnras_article <- function(..., | ||
keep_tex = TRUE, | ||
md_extensions = c(), | ||
fig_caption = TRUE) { | ||
pdf_document_format(..., | ||
keep_tex = keep_tex, | ||
md_extensions = md_extensions, | ||
format = "mnras_article", | ||
template = "template.tex", | ||
csl = "mnras.csl") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.tex |
13 changes: 13 additions & 0 deletions
13
inst/rmarkdown/templates/mnras_article/resources/mnras.csl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0"> | ||
<info> | ||
<title>Harvard reference format 1 (deprecated)</title> | ||
<id>http://www.zotero.org/styles/harvard1</id> | ||
<link href="http://www.zotero.org/styles/harvard1" rel="self"/> | ||
<link href="http://www.zotero.org/styles/harvard-cite-them-right" rel="independent-parent"/> | ||
<category citation-format="author-date"/> | ||
<summary>The original "harvard1.csl" independent CSL style was not based on any style guide, but it nevertheless remained popular because it was included by default in Mendeley Desktop. We have now taken one step to remove this style from the central CSL repository by turning it into a dependent style that uses the Harvard author-date format specified by the popular "Cite Them Right" guide. This dependent style will likely be removed from the CSL repository entirely at some point in the future.</summary> | ||
<updated>2017-04-03T00:20:53+00:00</updated> | ||
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> | ||
</info> | ||
</style> |
131 changes: 131 additions & 0 deletions
131
inst/rmarkdown/templates/mnras_article/resources/template.tex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
% mnras_template.tex | ||
% | ||
% LaTeX template for creating an MNRAS paper | ||
% | ||
% v3.0 released 14 May 2015 | ||
% (version numbers match those of mnras.cls) | ||
% | ||
% Copyright (C) Royal Astronomical Society 2015 | ||
% Authors: | ||
% Keith T. Smith (Royal Astronomical Society) | ||
|
||
% Change log | ||
% | ||
% v3.0 May 2015 | ||
% Renamed to match the new package name | ||
% Version number matches mnras.cls | ||
% A few minor tweaks to wording | ||
% v1.0 September 2013 | ||
% Beta testing only - never publicly released | ||
% First version: a simple (ish) template for creating an MNRAS paper | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% Basic setup. Most papers should leave these options alone. | ||
\documentclass[a4paper,fleqn,usenatbib]{mnras} | ||
|
||
% MNRAS is set in Times font. If you don't have this installed (most LaTeX | ||
% installations will be fine) or prefer the old Computer Modern fonts, comment | ||
% out the following line | ||
\usepackage{newtxtext,newtxmath} | ||
% Depending on your LaTeX fonts installation, you might get better results with one of these: | ||
%\usepackage{mathptmx} | ||
%\usepackage{txfonts} | ||
|
||
% Use vector fonts, so it zooms properly in on-screen viewing software | ||
% Don't change these lines unless you know what you are doing | ||
\usepackage[T1]{fontenc} | ||
\usepackage{ae,aecompl} | ||
|
||
|
||
%%%%% AUTHORS - PLACE YOUR OWN PACKAGES HERE %%%%% | ||
|
||
% Only include extra packages if you really need them. Common packages are: | ||
\usepackage{graphicx} % Including figure files | ||
\usepackage{amsmath} % Advanced maths commands | ||
\usepackage{amssymb} % Extra maths symbols | ||
\usepackage{hyperref} | ||
\usepackage{url} | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
%%%%% AUTHORS - PLACE YOUR OWN COMMANDS HERE %%%%% | ||
|
||
% Please keep new commands to a minimum, and use \newcommand not \def to avoid | ||
% overwriting existing commands. Example: | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
%%%%%%%%%%%%%%%%%%% TITLE PAGE %%%%%%%%%%%%%%%%%%% | ||
|
||
% Title of the paper, and the short title which is used in the headers. | ||
% Keep the title short and informative. | ||
$if(title)$ | ||
\title$if(shorttitle)$[$shorttitle$]$endif${$title$} | ||
$endif$ | ||
|
||
% The list of authors, and the short list which is used in the headers. | ||
% If you need two or more lines of authors, add an extra line using \newauthor | ||
|
||
$if(authors)$ | ||
\author$if(shortauthor)$[$shortauthor$]$endif${ | ||
$for(authors)$ | ||
$authors.name$ | ||
$if(authors.email)$ | ||
\thanks{$authors.email$} | ||
$endif$ | ||
$if(authors.affiliations)$ | ||
$$^{$for(authors.affiliations)$$authors.affiliations$$sep$,$endfor$}$$ | ||
$endif$ | ||
$endfor$\\ | ||
$if(affiliations)$ | ||
$for(affiliations)$ | ||
$$^{$affiliations.number$}$$$affiliations.name$$sep$\\ | ||
$endfor$ | ||
$endif$ | ||
} | ||
$endif$ | ||
|
||
% These dates will be filled out by the publisher | ||
\date{Accepted XXX. Received YYY; in original form ZZZ} | ||
|
||
% Enter the current year, for the copyright statements etc. | ||
\pubyear{2018} | ||
|
||
% Don't change these lines | ||
\begin{document} | ||
\label{firstpage} | ||
\pagerange{\pageref{firstpage}--\pageref{lastpage}} | ||
$if(title)$ | ||
\maketitle | ||
$endif$ | ||
|
||
% Abstract of the paper | ||
$if(abstract)$ | ||
\begin{abstract} | ||
$abstract$ | ||
\end{abstract} | ||
$endif$ | ||
|
||
% Select between one and six entries from the list of approved keywords. | ||
% Don't make up new ones. | ||
$if(keywords)$ | ||
\begin{keywords} | ||
$for(keywords)$$keywords$$sep$ -- $endfor$ | ||
\end{keywords} | ||
$endif$ | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
%%%%%%%%%%%%%%%%% BODY OF PAPER %%%%%%%%%%%%%%%%%% | ||
|
||
$body$ | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
|
||
% Don't change these lines | ||
\bsp % typesetting comment | ||
\label{lastpage} | ||
\end{document} | ||
|
||
% End of mnras_template.tex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# pandoc-mnras | ||
|
||
A template for building MNRAS Journal articles in pandoc. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.