add extensions

This commit is contained in:
2024-03-21 00:29:18 +08:00
parent 4dfe6bdad6
commit 74c343770f
92 changed files with 15715 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
title: Elsevier Journal Format
author: Charles Teague
version: 0.2.0
quarto-required: ">=1.2.198"
contributes:
formats:
common:
date-format: full
filters:
- elsevier.lua
pdf:
documentclass: elsarticle
template-partials: ["partials/before-body.tex", "partials/title.tex"]
format-resources:
- elsarticle.cls
cite-method: natbib
number-sections: true
html:
theme: styles/elsevier.scss

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never" default-locale="en-US">
<info>
<title>Elsevier - Harvard (with titles)</title>
<id>http://www.zotero.org/styles/elsevier-harvard</id>
<link href="http://www.zotero.org/styles/elsevier-harvard" rel="self"/>
<link href="http://www.zotero.org/styles/ecology-letters" rel="template"/>
<link href="http://www.elsevier.com/journals/biological-conservation/0006-3207/guide-for-authors#68000" rel="documentation"/>
<author>
<name>David Kaplan</name>
<email>david.kaplan@ird.fr</email>
</author>
<contributor>
<name>Simon Kornblith</name>
<email>simon@simonster.com</email>
</contributor>
<contributor>
<name>Bruce D'Arcus</name>
</contributor>
<contributor>
<name>Curtis M. Humphrey</name>
</contributor>
<contributor>
<name>Richard Karnesky</name>
<email>karnesky+zotero@gmail.com</email>
<uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri>
</contributor>
<contributor>
<name>Sebastian Karcher</name>
</contributor>
<category citation-format="author-date"/>
<category field="biology"/>
<category field="generic-base"/>
<updated>2019-01-22T15:57:12+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>
<macro name="container">
<choose>
<if type="chapter paper-conference" match="any">
<text term="in" prefix=", " suffix=": "/>
<names variable="editor translator" delimiter=", " suffix=", ">
<name name-as-sort-order="all" sort-separator=", " initialize-with="." delimiter=", " delimiter-precedes-last="always"/>
<label form="short" text-case="capitalize-first" prefix=" (" suffix=")"/>
</names>
<group delimiter=", ">
<text variable="container-title" text-case="title"/>
<text variable="collection-title" text-case="title"/>
</group>
</if>
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<group prefix=", " delimiter=", ">
<text variable="container-title"/>
<text variable="collection-title"/>
</group>
</else-if>
<else>
<group prefix=". " delimiter=", ">
<text variable="container-title" form="short"/>
<text variable="collection-title"/>
</group>
</else>
</choose>
</macro>
<macro name="author">
<names variable="author">
<name name-as-sort-order="all" sort-separator=", " initialize-with="." delimiter=", " delimiter-precedes-last="always"/>
<label form="short" prefix=" (" suffix=")" text-case="capitalize-first"/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
<text macro="title"/>
</substitute>
</names>
</macro>
<macro name="author-short">
<names variable="author">
<name form="short" and="text" delimiter=", " initialize-with=". "/>
<substitute>
<names variable="editor"/>
<names variable="translator"/>
<choose>
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<text variable="title" form="short" font-style="italic"/>
</if>
<else>
<text variable="title" form="short" quotes="true"/>
</else>
</choose>
</substitute>
</names>
</macro>
<macro name="access">
<choose>
<if variable="DOI">
<text variable="DOI" prefix="https://doi.org/"/>
</if>
<else-if type="webpage post-weblog" match="any">
<group delimiter=" ">
<text value="URL"/>
<text variable="URL"/>
<group prefix="(" suffix=").">
<text term="accessed" suffix=" "/>
<date variable="accessed">
<date-part name="month" form="numeric" suffix="."/>
<date-part name="day" suffix="."/>
<date-part name="year" form="short"/>
</date>
</group>
</group>
</else-if>
</choose>
</macro>
<macro name="title">
<choose>
<if type="report thesis" match="any">
<text variable="title"/>
<group prefix=" (" suffix=")" delimiter=" ">
<text variable="genre"/>
<text variable="number" prefix="No. "/>
</group>
</if>
<else-if type="bill book graphic legal_case legislation motion_picture report song speech" match="any">
<text variable="title"/>
<text macro="edition" prefix=", "/>
</else-if>
<else-if type="webpage">
<text variable="title"/>
<text value="WWW Document" prefix=" [" suffix="]"/>
</else-if>
<else>
<text variable="title"/>
</else>
</choose>
</macro>
<macro name="publisher">
<group delimiter=", ">
<text variable="publisher"/>
<text variable="publisher-place"/>
</group>
</macro>
<macro name="event">
<choose>
<if variable="event">
<text term="presented at" text-case="capitalize-first" suffix=" "/>
<text variable="event"/>
</if>
</choose>
</macro>
<macro name="issued">
<choose>
<if variable="issued">
<date variable="issued">
<date-part name="year"/>
</date>
</if>
<else>
<text term="no date" form="short"/>
</else>
</choose>
</macro>
<macro name="edition">
<group delimiter=" ">
<choose>
<if is-numeric="edition">
<number variable="edition" form="ordinal"/>
</if>
<else>
<text variable="edition" suffix="."/>
</else>
</choose>
<text value="ed"/>
</group>
</macro>
<macro name="locators">
<choose>
<if type="article-journal article-magazine article-newspaper" match="any">
<group prefix=" " delimiter=", ">
<group>
<text variable="volume"/>
</group>
<text variable="page"/>
</group>
</if>
<else-if type="bill book graphic legal_case legislation motion_picture report song thesis" match="any">
<group delimiter=", " prefix=". ">
<text macro="event"/>
<text macro="publisher"/>
</group>
</else-if>
<else-if type="chapter paper-conference" match="any">
<group delimiter=", " prefix=". ">
<text macro="event"/>
<text macro="publisher"/>
<group>
<label variable="page" form="short" suffix=" "/>
<text variable="page"/>
</group>
</group>
</else-if>
<else-if type="patent">
<text variable="number" prefix=". "/>
</else-if>
</choose>
</macro>
<citation et-al-min="3" et-al-use-first="1" disambiguate-add-givenname="true" disambiguate-add-year-suffix="true" collapse="year" cite-group-delimiter=", ">
<sort>
<key macro="author"/>
<key macro="issued" sort="descending"/>
</sort>
<layout prefix="(" suffix=")" delimiter="; ">
<group delimiter=", ">
<text macro="author-short"/>
<text macro="issued"/>
<group delimiter=" ">
<label variable="locator" form="short"/>
<text variable="locator"/>
</group>
</group>
</layout>
</citation>
<bibliography hanging-indent="true" entry-spacing="0" line-spacing="1">
<sort>
<key macro="author"/>
<key macro="issued" sort="descending"/>
</sort>
<layout>
<group suffix=".">
<text macro="author" suffix=","/>
<text macro="issued" prefix=" "/>
<group prefix=". ">
<text macro="title"/>
<text macro="container"/>
<text macro="locators"/>
</group>
</group>
<text macro="access" prefix=". "/>
</layout>
</bibliography>
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,166 @@
-- cite style constants
local kBibStyleDefault = 'number'
local kBibStyles = { 'number', 'numbername', 'authoryear' }
local kBibStyleAuthYr = 'elsarticle-harv'
local kBibStyleNumber = 'elsarticle-num'
local kBibStyleNumberName = 'elsarticle-num-names'
local kBibStyleUnknown = kBibStyleNumberName
-- layout and style
local kFormatting = pandoc.List({ 'preprint', 'review', 'doubleblind' })
local kModels = pandoc.List({ '1p', '3p', '5p' })
local kLayouts = pandoc.List({ 'onecolumn', 'twocolumn' })
local function setBibStyle(meta, style)
meta['biblio-style'] = style
quarto.doc.add_format_resource('bib/' .. style .. '.bst')
end
local function hasClassOption(meta, option)
if meta['classoption'] == nil then
return false
end
for i, v in ipairs(meta['classoption']) do
if v[1].text == option then
return true
end
end
return false
end
local function addClassOption(meta, option)
if meta['classoption'] == nil then
meta['classoption'] = pandoc.List({})
end
if not hasClassOption(meta, option) then
meta['classoption']:insert({ pandoc.Str(option) })
end
end
local function printList(list)
local result = ''
local sep = ''
for i, v in ipairs(list) do
result = result .. sep .. v
sep = ', '
end
return result
end
local bibstyle = kBibStyleDefault
return {
{
Meta = function(meta)
-- If citeproc is being used, switch to the proper
-- CSL file
if quarto.doc.cite_method() == 'citeproc' and meta['csl'] == nil then
meta['csl'] = quarto.utils.resolve_path('bib/elsevier-harvard.csl')
end
if quarto.doc.is_format("pdf") then
-- read the journal settings
local journal = meta['journal']
local citestyle = nil
local formatting = nil
local model = nil
local layout = nil
local name = nil
if journal ~= nil then
citestyle = journal['cite-style']
formatting = journal['formatting']
model = journal['model']
layout = journal['layout']
name = journal['name']
end
-- process the site style
if citestyle ~= nil then
citestyle = pandoc.utils.stringify(citestyle)
else
citestyle = kBibStyleDefault
end
-- capture the bibstyle
bibstyle = citestyle
if citestyle == 'numbername' then
setBibStyle(meta, kBibStyleNumberName)
addClassOption(meta, 'number')
elseif citestyle == 'authoryear' then
setBibStyle(meta, kBibStyleAuthYr)
addClassOption(meta, 'authoryear')
elseif citestyle == 'number' then
setBibStyle(meta, kBibStyleNumber)
addClassOption(meta, 'number')
else
error("Unknown journal cite-style " .. citestyle .. "\nPlease use one of " .. printList(kBibStyles))
setBibStyle(meta, kBibStyleUnknown)
end
-- process the layout
if formatting ~= nil then
formatting = pandoc.utils.stringify(formatting)
if kFormatting:includes(formatting) then
addClassOption(meta, formatting)
else
error("Unknown journal formatting " .. formatting .. "\nPlease use one of " .. printList(kFormatting))
end
end
-- process the type
if model ~= nil then
model = pandoc.utils.stringify(model)
if kModels:includes(model) then
addClassOption(meta, model)
else
error("Unknown journal model " .. model .. "\nPlease use one of " .. printList(kModels))
end
end
-- 5p models should be two column always
if model == '5p' and layout == nil then
layout = 'twocolumn'
end
-- process the type
if layout ~= nil then
layout = pandoc.utils.stringify(layout)
if kLayouts:includes(layout) then
addClassOption(meta, layout)
if layout == 'twocolumn' then
quarto.doc.include_file('in-header', 'partials/_two-column-longtable.tex')
end
else
error("Unknown journal layout " .. layout .. "\nPlease use one of " .. printList(kLayouts))
end
end
-- process the name
if name ~= nil then
name = pandoc.utils.stringify(name)
quarto.doc.include_text('in-header', '\\journal{' .. name .. '}')
end
end
return meta
end
},
{
Cite = function(cite)
if bibstyle == 'number' then
-- If we are numbered, force citations into normal mode
-- as the author styles don't make sense
for i, v in ipairs(cite.citations) do
v.mode = 'NormalCitation'
end
return cite
end
end,
}
}

View File

@@ -0,0 +1,20 @@
\usepackage{float}
\makeatletter
\let\oldlt\longtable
\let\endoldlt\endlongtable
\def\longtable{\@ifnextchar[\longtable@i \longtable@ii}
\def\longtable@i[#1]{\begin{figure}[H]
\onecolumn
\begin{minipage}{0.5\textwidth}
\oldlt[#1]
}
\def\longtable@ii{\begin{figure}[H]
\onecolumn
\begin{minipage}{0.5\textwidth}
\oldlt
}
\def\endlongtable{\endoldlt
\end{minipage}
\twocolumn
\end{figure}}
\makeatother

View File

@@ -0,0 +1,41 @@
\begin{frontmatter}
\title{$title$ $if(subtitle)$ \\\large{$subtitle$} $endif$ }
$for(by-author)$\author[$for(by-author.affiliations)$$it.number$$sep$,$endfor$]{$by-author.name.literal$%
$if(by-author.attributes.corresponding)$\corref{cor1}$endif$%
$if(by-author.note.text)$\fnref{fn$by-author.note.number$}$endif$}
$if(by-author.email)$ \ead{$by-author.email$} $endif$
$endfor$
$for(by-affiliation)$
\affiliation[$it.number$]{organization={$it.name$},$if(it.address)$addressline={$it.address$}$endif$$if(it.city)$$if(it.address)$,$endif$city={$it.city$}$endif$$if(it.country)$$if(it.city)$,$elseif(it.address)$,$endif$country={$it.country$}$endif$$if(it.postal-code)$$if(it.country)$,$elseif(it.city)$,$elseif(it.address)$,$endif$postcode={$it.postal-code$}$endif$}
$endfor$
\cortext[cor1]{Corresponding author}
$for(by-author)$
$if(by-author.note.text)$\fntext[fn$by-author.note.number$]{$by-author.note.text$}$endif$
$endfor$
$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$
$if(journal.graphical-abstract)$\begin{graphicalabstract}
$journal.graphical-abstract$
\end{graphicalabstract}
$endif$
$if(journal.highlights)$\begin{highlights}
$for(journal.highlights)$\item $it$$endfor$
\end{highlights}
$endif$
$if(keywords)$
\begin{keyword}
$for(keywords/allbutlast)$$keywords$ \sep $endfor$
$for(keywords/last)$$keywords$$endfor$
\end{keyword}
$endif$
\end{frontmatter}

View File

@@ -0,0 +1,66 @@
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{float}
\usepackage[normalem]{ulem}
\usepackage{hyperref}
\usepackage{nameref} %needed by zref-xr
\usepackage{zref-xr,zref-hyperref,zref-user}
\usepackage{xr-hyper}
\usepackage{adjustbox}
% \usepackage{xcolor}
\usepackage{mdframed}
\newmdenv[topline=false,
leftline=true,
bottomline=false,
rightline=false,
linewidth=3pt,
%backgroundcolor=lightgray,
linecolor=gray!30,
backgroundcolor=gray!5,
skipabove=\topsep,
skipbelow=\topsep,
leftmargin=0pt,
rightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt
]{refquote}
\newmdenv[topline=false,
leftline=true,
bottomline=false,
rightline=false,
linewidth=3pt,
%backgroundcolor=lightgray,
backgroundcolor=red!3!white,
linecolor=red!30!white,
skipabove=\topsep,
skipbelow=\topsep,
leftmargin=0pt,
rightmargin=0pt,
innertopmargin=10pt,
innerbottommargin=10pt
]{question}
% setup hyperlink for page and line number
\def\msname{MS}
\def\smname{SM}
\setenumerate{labelsep=*, leftmargin=1.0pc}
%\zexternaldocument*{ManuscriptNew\veraa}
\zexternaldocument*{\msname}
\zexternaldocument*{\smname}
\newcommand{\hlabel}[1]{\label{#1}\hypertarget{#1}{
\linelabel{line:#1}}}
%\externaldocument[si-]{\smname\veraa}[\smname\veraa.pdf]
\makeatletter
\newcommand{\clab}[2][]{
\protected@write\@auxout{\let\clab\@secondoftwo}{
\string\newlabel{r:#1}{{#2}{}}}%
\hlabel{#1}#2\hlabel{#1end}}
\makeatother
\newcommand{\zhypera}[1]{\href[pdfnewwindow]{\msname.pdf\##1}{\\[1ex]\textbf{Page \zpageref{#1}, Line
\zref{line:#1}--\zref{line:#1end}:}\\}}
\newcommand{\cref}[1]{\begin{refquote}\zhypera{#1}{\zref{r:#1}}\\[-0.5ex]\end{refquote}}
% \newenvironment{ra}[1][\unskip]{\par \noindent \\[-1ex] \textbf{Response/Action:}\par\bf}{\ \\}
\renewenvironment{quote}{\begin{question}}{\end{question}}
% \renewenvironment{verbatim}{\begin{ra}}{\end{ra}}

View File

@@ -0,0 +1 @@
\setlength{\parindent}{6pt}

View File

@@ -0,0 +1 @@
/*-- scss:defaults --*/