Skip to content

Commit

Permalink
add pihph_article() (rstudio#362)
Browse files Browse the repository at this point in the history
Co-authored-by: Christophe Dervieux <christophe.dervieux@gmail.com>
  • Loading branch information
Stefano Coretta and cderv committed Apr 3, 2021
1 parent ca49e94 commit 871447d
Show file tree
Hide file tree
Showing 11 changed files with 496 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export(mdpi_article)
export(mnras_article)
export(oup_article)
export(peerj_article)
export(pihph_article)
export(plos_article)
export(pnas_article)
export(rjournal_article)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ rticles 0.19
---------------------------------------------------------------------
- Update Copernicus Publications template to version 6.2 from 2021-01-15 (thanks, @RLumSK, #366).

- Add article template `pihph_article()` for the *Papers in Historical Phonology* (PiHPh) (thanks, @stefanocoretta, #362).

rticles 0.18
---------------------------------------------------------------------

Expand Down
19 changes: 19 additions & 0 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,25 @@ peerj_article <- function(..., keep_tex = TRUE) {
pdf_document_format("peerj", keep_tex = keep_tex, ...)
}

#' @section \code{pihph_article}: Format for creating submissions to the Papers
#' in Historical Phonology
#' (\url{http://journals.ed.ac.uk/pihph/about/submissions}). Adapted from
#' \url{https://github.com/pihph/templates}. This format works well with
#' \code{latex_engine = "xelatex"} and \code{citation_package="biblatex"},
#' which are the default. It may not work correctly if you change these value.
#' In that case, please open an issue and, a PR to contribute a change in the
#' template.
#' @export
#' @rdname article
pihph_article <- function(
..., keep_tex = TRUE, latex_engine = "xelatex",
citation_package = "biblatex"
) {
pdf_document_format(
"pihph", keep_tex = keep_tex, latex_engine = latex_engine,
citation_package = citation_package, ...)
}

#' @section \code{plos_article}: Format for creating submissions to PLOS
#' journals. Adapted from \url{https://journals.plos.org/ploscompbiol/s/latex}.
#' @export
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Currently included templates and their contributors are the following:
| [MNRAS: Monthly Notices of the Royal Astronomical Society](https://academic.oup.com/mnras) | [@oleskiewicz](https://github.com/oleskiewicz) | [#175](https://github.com/rstudio/rticles/pull/175) | `mnras_article()` |
| [OUP: Oxford University Press](https://academic.oup.com/journals/pages/authors/preparing_your_manuscript) | [@dmkaplan](https://github.com/dmkaplan) | [#284](https://github.com/rstudio/rticles/pull/284) | `oup_articles()` |
| [PeerJ: Journal of Life and Environmental Sciences](https://peerj.com) | [@zkamvar](https://github.com/zkamvar) | [#127](https://github.com/rstudio/rticles/pull/127) | `peerj_article()` |
| [PiHPh: Papers in Historical Phonology](http://journals.ed.ac.uk/pihph/about/submissions) | [@stefanocoretta](https://github.com/stefanocoretta) | [#362](https://github.com/rstudio/rticles/pull/362) | `pihph_article()` |
| [PLOS](https://plos.org/#journals) | [@sjmgarnier](https://github.com/sjmgarnier) | [#12](https://github.com/rstudio/rticles/pull/12) | `plos_article()` |
| [PNAS: Proceedings of the National Academy of Sciences](https://www.pnas.org/) | [@cboettig](https://github.com/cboettig) | [#72](https://github.com/rstudio/rticles/pull/72) | `pnas_article()` |
| [RSOS: Royal Society Open Science](https://www.royalsocietypublishing.org/journal/rsos) | [@ThierryO](https://github.com/ThierryO) | [#135](https://github.com/rstudio/rticles/pull/135) | `rsos_article()` |
Expand Down
305 changes: 305 additions & 0 deletions inst/rmarkdown/templates/pihph/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
% === GO TO THE USER CUSTOMIZATION SECTION TO MAKE CHANGES

\documentclass[article, a4paper, 12pt, $for(classoption)$$classoption$$sep$,$endfor$]{memoir}

% Please use XeLaTeX to compile

\usepackage{xltxtra}
\defaultfontfeatures{Ligatures=TeX}
\usepackage{hyphenat}

\newcommand\setlogofont[1]{\newfontfamily\logofont{#1}}
\newcommand\setlicensefont[1]{\newfontfamily\licensefont{#1}}
\usepackage{microtype}
\usepackage{rotating}
\usepackage{hyperxmp}
\usepackage[colorlinks=true, unicode=true, breaklinks=true, linkcolor=black, urlcolor=blue, citecolor=black]{hyperref}

\counterwithout{section}{chapter}
\setsecnumdepth{subsubsection}
\setcounter{tocdepth}{3}

\usepackage[export]{adjustbox}
\usepackage{graphicx}
\usepackage[type={CC}, modifier={by}, version=4.0]{doclicense}

\newcommand\affiliation[1]{{\normalfont\normalsize\itshape#1}}

\pagestyle{simple}
\makeevenfoot{simple}{}{}{}
\makeoddfoot{simple}{}{}{}
\raggedbottom

\newcommand\authorheader[1]{\makeevenhead{simple}{\footnotesize\itshape#1}{}{\footnotesize\thepage}}
\newcommand\titleheader[1]{\makeoddhead{simple}{\footnotesize\thepage}{}{\footnotesize\itshape#1}}

\newcommand\thisdoi{10.2218/pihph.201x.x.xxxx}
\newcommand\thisdoilink{http://dx.doi.org/\thisdoi}

\renewcommand{\maketitlehooka}{%
\vspace*{-60pt}
\noindent\hspace*{-25pt}\begin{minipage}[t]{2.5cm}
\vspace*{-16pt}
\includegraphics[valign=t, width=2.5cm]{pihph-logo.png}
\end{minipage}
\begin{minipage}[t]{.75\linewidth}
\centering
$if(logofont)$\logofont$endif$\Large Papers in Historical Phonology\\[5pt]

\footnotesize

http://journals.ed.ac.uk/pihph

ISSN 2399-6714

\footnotesize\vspace*{5pt}

Volume 1, \thepage--\thelastpage

DOI: \thisdoi
\end{minipage}
\begin{minipage}[t]{2.1cm}
\centering
\vspace*{-14pt}
\adjustbox{valign=t}{\doclicenseImage[imagewidth=2.1cm]}\\
$if(licensefont)$\licensefont$endif$\tiny Licensed under~a \doclicenseLongNameRef{} License
\end{minipage}
}

\pretitle{\vspace*{24pt}\begin{center}\large\bfseries}
\preauthor{\begin{center}\large\scshape\begin{tabular}[t]{c}}
\postauthor{\end{tabular}\end{center}\vspace*{12pt}}

\predate{\relax}
\postdate{\relax}
\date{}

\captionnamefont{\footnotesize\bfseries}
\captiontitlefont{\footnotesize}

\renewcommand\abstractnamefont{\normalfont\footnotesize\bfseries}
\renewcommand\abstracttextfont{\normalfont\footnotesize}
\setlength\absleftindent{1cm}
\setlength\absrightindent{1cm}
\setlength{\abstitleskip}{-17pt}
\setbeforesecskip{-18pt}
\setaftersecskip{6pt}
\setsecheadstyle{\normalfont\bfseries}
\setbeforesubsecskip{-18pt}
\setaftersubsecskip{6pt}
\setsubsecheadstyle{\normalfont\bfseries}
\setbeforesubsubsecskip{-18pt}
\setaftersubsubsecskip{6pt}
\setsubsubsecheadstyle{\normalfont\bfseries}
\renewenvironment{quote}{\list{}{\leftmargin=0.7cm\rightmargin=0.7cm}\item[]\footnotesize}{\endlist}

\setlrmarginsandblock{4cm}{4cm}{*}
\setulmarginsandblock{4.5cm}{4.5cm}{*}
\checkandfixthelayout

\setlength{\footmarkwidth}{0em}
\setlength{\footmarksep}{0em}
\footmarkstyle{\textsuperscript{#1}\hspace{.3em}}
\setfootins{24pt}{\bigskipamount}
\renewcommand*{\footnoterule}{%
\kern-3pt%
\hrule width 0.4\columnwidth
\kern 2.6pt
\vspace{12pt}}

\usepackage[usenames]{xcolor}
\definecolor{pihphgreen}{RGB}{118, 146, 60}
\usepackage[most]{tcolorbox}

\newtcolorbox{tcdoublebox}[1][]{%
enhanced jigsaw,
sharp corners,
colback=white,
text width=.95\textwidth,
before={\vspace*{18pt}\noindent},
left skip=-5mm,
borderline={1pt}{-2pt}{black},
#1
}

\newcommand\commentsinvited{
\begin{tcdoublebox}

\section*{\textcolor{pihphgreen}{Comments invited}}

\textit{PiHPh} relies on post-publication review of the papers that it publishes. If you have any comments on this piece, please add them to its comments site. You are encouraged to consult this site after reading the paper, as there may be comments from other readers there, and replies from the author. This paper's site is here:

\vspace*{1ex}\noindent \url{\thisdoilink}

\end{tcdoublebox}
}

\widowpenalty=10000
\clubpenalty=10000

% === START OF USER CUSTOMIZATION


\title{$title$$if(subtitle)$:\\$subtitle$$endif$}
\author{$for(author)$$author.name$\\\affiliation{$author.affiliation$}$sep$ \and $endfor$}

\authorheader{$if(author-header)$$author-header$$else$$for(author)$$author.name$$sep$, $endfor$$endif$}
\titleheader{$if(title-header)$$title-header$$else$$title$$endif$}

$if(mainfont)$
\setmainfont{$mainfont$}
$endif$
$if(licensefont)$
\setlicensefont{$licensefont$}
$endif$
$if(logofont)$
\setlogofont{$logofont$}
$endif$
% If you do not have access to Cambria, you can use the metric-equivalent Caladea: https://fontlibrary.org/en/font/caladea
% If you do not have access to Calibri, you can use the metric-equivalent Carlito: https://fontlibrary.org/en/font/carlito
% Lekton available at https://www.fontsquirrel.com/fonts/lekton

% Use polyglossia by default since the engine is xelatex.
\usepackage{polyglossia}
\setmainlanguage[$if(en-variant)$variant=$en-variant$$endif$]{english}
\usepackage[autostyle$if(single-quotes)$,english=british$endif$]{csquotes} % remove the english=british option for double quotes
$if(gloss)$
\usepackage{$gloss$} % for examples, feel free to use anything else
$endif$

$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
% Pandoc syntax highlighting
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$

% Some recommended packages

\usepackage{booktabs} % for nice tables

$if(biblatex)$
% BibLaTeX setup, recommended
\usepackage[backend=biber,
style=langsci-unified, % available on CTAN
mincrossrefs=50,
maxcitenames=3,
maxbibnames=50,
useprefix=true,
doi=false]{biblatex}
$for(bibliography)$
\addbibresource{$bibliography$}
$endfor$
% remember to include the .bib extension
% remember to run biber rather than bibtex if using this option
\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}
$endif$

% BibTeX setup, deprecated
% \usepackage{natbib}
% \bibpunct[:]{(}{)}{;}{a}{}{,}
% \setlength\bibsep{0pt}


% Pandoc citation processing
$if(csl-refs)$
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
% for Pandoc 2.8 to 2.10.1
\newenvironment{cslreferences}%
{$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
{\par}
% For Pandoc 2.11+
\newenvironment{CSLReferences}[3] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
% set entry spacing
\ifnum #2 > 0
\setlength{\parskip}{#2\baselineskip}
\fi
}%
{}
\usepackage{calc} % for calculating minipage widths
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

$for(header-includes)$
$header-includes$
$endfor$

\begin{document}
\setcounter{page}{1}
\maketitle
\thispagestyle{empty}

$if(abstract)$
\begin{abstract}
\noindent $abstract$
\end{abstract}
$endif$

$for(include-before)$
$include-before$
$endfor$

$body$

\commentsinvited % Please do not change this

$if(acknowledgements)$
\section*{Acknowledgements}
$acknowledgements$
$endif$

$if(supplement)$
\section*{Associated material}
$supplement$
$endif$

\section*{Author's contact details}
\label{sec:auth-cont-deta}

$for(author)$
\noindent \textit{$author.name$}

$if(author.affiliation)$\noindent $author.affiliation$$endif$

$if(author.address)$\noindent $author.address$$endif$

$if(author.email)$
\vspace*{5pt}
\noindent \textit{$author.email$}
$endif$
$endfor$

$if(biblatex)$
% BibLaTeX setup, recommended
\printbibliography[title=References]
$endif$

% BibTeX setup, deprecated
% \bibliographystyle{unified} % unified.bst can be obtained at http://cexlj.org/downloads/unified.bst
% \renewcommand\bibsection{\section*{References}}
%\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}


$for(include-after)$
$include-after$
$endfor$
\end{document}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 871447d

Please sign in to comment.