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

Glossa Psycholinguistics template #526

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ Authors@R: c(
person("Dmytro", "Perepolkin", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0001-8558-6183", github = "dmi3kno")),
person("Tom", "Palmer", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0003-4655-4511", github = "remlapmot"))
comment = c(ORCID = "0000-0003-4655-4511", github = "remlapmot")),
person("Veronica", "Boyce", , "[email protected]", role="ctb",
comment=c(ORCID = "0000-0002-8890-2775", github= "vboyce"))
)
Description: A suite of custom R Markdown formats and templates for
authoring journal articles and conference submissions.
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export(ctex_article)
export(elsevier_article)
export(frontiers_article)
export(glossa_article)
export(glossapx_article)
export(ieee_article)
export(ims_article)
export(informs_article)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# rticles (development version)

## NEW FEATURES

- New `glossapx_article()` template for submissions to Glossa Psycholinguistics

## MINOR CHANGES

- Update to the `asa_article()` format (thanks, @ianmtaylor1 #506, @jepusto, #507):
Expand Down
22 changes: 22 additions & 0 deletions R/article.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,28 @@ glossa_article <- function(..., keep_tex = TRUE, latex_engine = "xelatex") {
format
}

#' @section `glossapx_article`: Format for creating submissions to Glossa Psycholinguistics.
#' Submission structure from <https://escholarship.org/uc/glossapsycholinguistics/structure_of_submission>
#' Template is adapted from the Glossa rticles template.
#' @export
#' @rdname article
glossapx_article <- function(..., keep_tex = TRUE, latex_engine = "xelatex") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about naming glossapsycholx() as their twitter account ? https://twitter.com/glossapsycholx

format <- pdf_document_format(
"glossa",
keep_tex = keep_tex, latex_engine = latex_engine, ...
)
Comment on lines +232 to +235
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be glossapx here ? You are not using the correct template I believe here

Suggested change
format <- pdf_document_format(
"glossa",
keep_tex = keep_tex, latex_engine = latex_engine, ...
)
format <- pdf_document_format(
"glossapx",
keep_tex = keep_tex, latex_engine = latex_engine, ...
)

But are the template different ?

Copy link
Author

Choose a reason for hiding this comment

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

It might be possible to do it with settings differences? I'm not sure, but here's the diff from the glossa template to get something in glossa psycholinguistics format.

  • Reference format: glossa psycholinguistics uses APA 7 , glossa template uses some non-standard bibtex files (although I now see that there exists a .csl for glossa's style)
  • Section numbering: glossa doesn't do trailing dots after the section number, glossa psycholinguistics wants a trailing dot after sections (but not subsections "1. Intro", but "1.1 Stuff")
  • Tables and figures: glossa psycholinguistics wants table captions above the table (but glossa does below), glossa psycholinguistics wants left-aligned captions (glossa template centers, although I couldn't find documentation on glossa's website for any preference, glossa's website does link to a latex .cls that centers)
  • The set of unnumbered sections at the end of the paper differ slightly between the two journals, both on which sections are included and when they are required or not.

I think if it's possible to set toggles for the table captions and section numbering in the yaml that interact with the latex template, then glossa psycholinguistics format could be added to the glossa template by

  • setting yaml toggles for tables, caption alignment, and section numbering (perhaps this should be one toggle for glossa versus glossa psycholinguistics?)
  • switching to pandoc/csl for refs, and having both apa7 and glossa as labelled options
  • adding all the unnumbered sections to the skeleton and labeling what each journal wants in them and when

If this sounds like a better way forward, I can work on adapting the glossa template to support both glossa and glossa psycholinguistics.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to clarify where do you think those change go ? From what I can see in the PR, it seems nothing is different in the template.tex or the associated resources, and things are different only in the skeleton.Rmd. Is that so ?

I understand now that there may not be an easy way to :

  • Have a glossapsycholx_article() function in the package
  • but none of the resources needs to be copied from glossa as template is the same.

There should be a way to reuse the glossa template, but provide another skeleton. If this is not possible easily already, I need to provide a way for this to happen.

So, probably clear question is: Is this PR aiming to offer a skeleton.Rmd specific to Glossa Psycholinguistics journal which could use glossa_article() really ?

My understanding is that Glossa Psycholinguistics is only some configuration variations from default glossa. Is that right ?

Copy link
Author

Choose a reason for hiding this comment

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

In the PR currently, there are

  • differences in the glossa.cls file of a few lines
    diff glossa/skeleton/glossa.cls glossapx/skeleton/glossa.cls
    < \RequirePackage[font=sf,labelfont=bf,labelsep=colon,justification=raggedright,singlelinecheck=off,justification=centering]{caption}

\RequirePackage[font=sf,labelfont=bf,labelsep=colon,justification=raggedright,singlelinecheck=off]{caption}
498a499,502

\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}

  • apa7.csl for references in the skeleton
  • differences to skeleton.Rmd

I agree that the resources/template.tex is the same, so I just need a different skeleton but it's more than just the skeleton.Rmd since it needs the different cls and csl files.

I don't know if these would count as configuration variations?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the clarification.

I also read the following page: https://escholarship.org/uc/glossapsycholinguistics/structure_of_submission
and noticed this

Glossa Psycholinguistics follows many of the style guidelines specified for Glossa: a journal of general linguistics. However, due to important differences Glossa: General stylesheets or template files should not be used for a Glossa Psycholinguistics submission, as detailed below.

I understand there are important differences now. I need to understand the maintainance part of this.

differences in the glossa.cls file of a few lines

Did you make the adaptation ? Is there a glossapsycholx LaTeX template we can use somewhere ?
How to we maintain the file ? How to update ? What is the source of truth for this template ?

Is there anything to change to follow the guideline on their website ? I don't see any mention of original glossa.cls in their website.

I agree that the resources/template.tex is the same, so I just need a different skeleton but it's more than just the skeleton.Rmd since it needs the different cls and csl files.

I don't know if these would count as configuration variations?

Different CSL is a configuration with the csl: field in YAML.

Regarding cls, does the line need to be inserted into the CLS file explicitly ?
Can't it be in the template.tex directly ?

If this is really the same resource, but some different skeleton.Rmd and format function, I can think of how to allow that in rticles

Thanks a lot for the discussion, I think this is the first case we have like this. Really interesting.

if (tinytex::is_tinytex() && tinytex::check_installed("microtype")) {
# TODO: known conflict - remove when fixed
tinytex::tlmgr_remove("microtype")
fun <- format$on_exit
format$on_exit <- function() {
if (is.function(fun)) fun()
if (!tinytex::check_installed("microtype")) tinytex::tlmgr_install("microtype")
}
}
format
}

#' @param journal one of `"aoas"`, `"aap"`, `"aop"`, `"aos"`, `"sts"` for `ims_article`
#' @section `ims_article`: Format for creating submissions to the Institute of Mathematical Statistics
#' [IMS](https://imstat.org/) journals and publications. Adapted from
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Currently included templates and their contributors are the following:
| [Elsevier](https://www.elsevier.com) | [\@cboettig](https://github.com/cboettig), [\@robjhyndman](https://github.com/robjhyndman) | [#27](https://github.com/rstudio/rticles/pull/27), [#467](https://github.com/rstudio/rticles/pull/467) | `elsevier_article()` |
| [Frontiers](https://www.frontiersin.org/) | [\@muschellij2](https://github.com/muschellij2) | [#211](https://github.com/rstudio/rticles/pull/211) | `frontiers_article()` |
| [Glossa](https://www.glossa-journal.org) | [\@stefanocoretta](https://github.com/stefanocoretta) | [#361](https://github.com/rstudio/rticles/pull/361) | `glossa_article()` |
| [Glossa Psycholinguistics](https://escholarship.org/uc/glossapsycholinguistics) | [\@vboyce](https://github.com/vboyce) | | `glossapx_article()` |
| [IEEE Transaction](http://www.ieee.org/publications_standards/publications/authors/author_templates.html) | [\@Emaasit](https://github.com/Emaasit), [\@espinielli](https://github.com/espinielli), [\@nathanweeks](https://github.com/nathanweeks), [\@DunLug](https://github.com/DunLug) | [#97](https://github.com/rstudio/rticles/pull/97), [#169](https://github.com/rstudio/rticles/pull/169), [#227](https://github.com/rstudio/rticles/pull/227), [#263](https://github.com/rstudio/rticles/pull/263), [#264](https://github.com/rstudio/rticles/pull/264), [#265](https://github.com/rstudio/rticles/pull/265) | `ieee_article()` |
| [IMS: Institute of Mathematical Statistics](https://imstat.org/) [AoAS: Annals of Applied Statistics](https://imstat.org/journals-and-publications/annals-of-applied-statistics/) | [\@auzaheta](https://github.com/auzaheta) | [#372](https://github.com/rstudio/rticles/pull/372) | `ims_article()` |
| [INFORMS: Institute for Operations Research and the Management Sciences](https://www.informs.org/) | [\@robjhyndman](https://github.com/robjhyndman) | [#460](https://github.com/rstudio/rticles/pull/460) | `informs_article()` |
Expand Down
187 changes: 187 additions & 0 deletions inst/rmarkdown/templates/glossapx/resources/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
% see http://info.semprag.org/basics for a full description of this template
\documentclass[$for(classoption)$$classoption$$sep$,$endfor$]{glossa}

% possible options:
% [times] for Times font (default if no option is chosen)
% [cm] for Computer Modern font
% [lucida] for Lucida font (not freely available)
% [brill] open type font, freely downloadable for non-commercial use from http://www.brill.com/about/brill-fonts; requires xetex
% [charis] for CharisSIL font, freely downloadable from http://software.sil.org/charis/
% for the Brill an CharisSIL fonts, you have to use the XeLatex typesetting engine (not pdfLatex)
% for headings, tables, captions, etc., Fira Sans is used: https://www.fontsquirrel.com/fonts/fira-sans
% [biblatex] for using biblatex (the default is natbib, do not load the natbib package in this file, it is loaded automatically via the document class glossa.cls)
% [linguex] loads the linguex example package
% !! a note on the use of linguex: in glossed examples, the third line of the example (the translation) needs to be prefixed with \glt. This is to allow a first line with the name of the language and the source of the example. See example (2) in the text for an illustration.
% !! a note on the use of bibtex: for PhD dissertations to typeset correctly in the references list, the Address field needs to contain the city (for US cities in the format "Santa Cruz, CA")

%\addbibresource{sample.bib}
% the above line is for use with biblatex
% replace this by the name of your bib-file (extension .bib is required)
% comment out if you use natbib/bibtex

\let\B\relax %to resolve a conflict in the definition of these commands between xyling and xunicode (the latter called by fontspec, called by charis)
\let\T\relax
\usepackage{xyling} %for trees; the use of xyling with the CharisSIL font produces poor results in the branches. This problem does not arise with the packages qtree or forest.
\usepackage[linguistics]{forest} %for nice trees!
\usepackage{longtable}

\title[$if(shorttitle)$$shorttitle$$endif$]{$title$$if(wordcount)$\\ \bigskip \large Word count: $wordcount$$endif$}
% Optional short title inside square brackets, for the running headers.

% \author[Paul \& Vanden Wyngaerd]% short form of the author names for the running header. If no short author is given, no authors print in the headers.
% {%as many authors as you like, each separated by \AND.
% \spauthor{Waltraud Paul\\
% \institute{CNRS, CRLAO}\\
% \small{105, Bd. Raspail, 75005 Paris\\
% [email protected]}
% }
% \AND
% \spauthor{Guido Vanden Wyngaerd \\
% \institute{KU Leuven}\\
% \small{Warmoesberg 26, 1000 Brussel\\
% [email protected]}
% }%
% }

\author[$if(shortauthors)$$shortauthors$$endif$]{
$for(author)$
\spauthor{$author.name$\\
\institute{$author.affiliation$}\\
\small{$author.address$}
}%
$sep$\AND$endfor$
}

$if(natbib)$
\usepackage{natbib}
$endif$
$if(biblatex)$
\usepackage[$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
$for(bibliography)$
\addbibresource{$bibliography$}
$endfor$
$endif$

$if(highlighting-macros)$
% Pandoc syntax highlighting
$highlighting-macros$
$endif$

% tightlist command for lists without linebreak
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

$if(tables)$
% From pandoc table feature
\usepackage{longtable,booktabs,array}
$if(multirow)$
\usepackage{multirow}
$endif$
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
$endif$

$if(csl-refs)$
% Pandoc citation processing
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslentryspacingunit} % times entry-spacing
\setlength{\cslentryspacingunit}{\parskip}
% 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}[2] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\let\oldpar\par
\def\par{\hangindent=\cslhangindent\oldpar}
\fi
% set entry spacing
\setlength{\parskip}{#2\cslentryspacingunit}
}%
{}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$

$if(verbatim-in-note)$
\usepackage{fancyvrb}
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$

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

\begin{document}

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

\sffamily
\maketitle

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

$if(keywords)$
\begin{keywords}
$keywords$
\end{keywords}
$endif$

\rmfamily

% Body of the article
$body$

$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$

$for(include-after)$
$include-after$

$endfor$

\end{document}
Loading