第7次课
This commit is contained in:
parent
00c44b652e
commit
04cc6935d6
|
@ -150,5 +150,4 @@ author: 姓名
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "../")`
|
||||
|
|
|
@ -218,4 +218,4 @@ devtools::install_github("kjhealy/socviz")
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "../")`
|
||||
|
|
|
@ -792,4 +792,4 @@ names(Y) <- c("colA", "colB", "colC")
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "../")`
|
||||
|
|
|
@ -130,4 +130,4 @@ require(learnr)
|
|||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "../")`
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../_extensions
|
|
@ -0,0 +1,157 @@
|
|||
---
|
||||
title: "代码编写规则"
|
||||
subtitle: 《区域水环境污染数据分析实践》<br>Data analysis practice of regional water environment pollution
|
||||
author: 苏命、王为东<br>中国科学院大学资源与环境学院<br>中国科学院生态环境研究中心
|
||||
date: today
|
||||
lang: zh
|
||||
format:
|
||||
revealjs:
|
||||
theme: dark
|
||||
slide-number: true
|
||||
chalkboard:
|
||||
buttons: true
|
||||
preview-links: auto
|
||||
lang: zh
|
||||
toc: true
|
||||
toc-depth: 1
|
||||
toc-title: 大纲
|
||||
logo: ./_extensions/inst/img/ucaslogo.png
|
||||
css: ./_extensions/inst/css/revealjs.css
|
||||
pointer:
|
||||
key: "p"
|
||||
color: "#32cd32"
|
||||
pointerSize: 18
|
||||
revealjs-plugins:
|
||||
- pointer
|
||||
filters:
|
||||
- d2
|
||||
---
|
||||
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
# source("../../coding/_common.R")
|
||||
library(tidyverse)
|
||||
library(nycflights13)
|
||||
```
|
||||
|
||||
|
||||
## tidy data
|
||||
|
||||
```{r}
|
||||
knitr::include_graphics("../../image/tidy-1.png", dpi = 270)
|
||||
```
|
||||
|
||||
|
||||
## pipe(管道) |>
|
||||
|
||||
```{r}
|
||||
#| eval: false
|
||||
require(patchwork)
|
||||
plot(1:10)
|
||||
1:10 |> plot()
|
||||
plot(x = 1:10, y = sin(1:10))
|
||||
1:10 |> plot(y = sin(1:10))
|
||||
|
||||
```
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
#| layout-nrow: 1
|
||||
#| fig-width: 4
|
||||
#| fig-height: 3
|
||||
#| out-height: 90%
|
||||
require(patchwork)
|
||||
plot(1:10)
|
||||
1:10 |> plot()
|
||||
plot(x = 1:10, y = sin(1:10))
|
||||
1:10 |> plot(y = sin(1:10))
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## pipe(管道):%>%
|
||||
|
||||
```{r}
|
||||
#| eval: false
|
||||
#| layout-nrow: 1
|
||||
#| fig-width: 3
|
||||
#| fig-height: 4
|
||||
#| out-height: 125%
|
||||
require(magrittr)
|
||||
1:10 %>% plot()
|
||||
1:10 %>% plot(y = sin(1:10))
|
||||
sin(1:10) %>% plot(1:10, .)
|
||||
sin(1:10) |> plot(x = 1:10, y = _)
|
||||
|
||||
```
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
#| layout-nrow: 1
|
||||
#| fig-width: 3
|
||||
#| fig-height: 4
|
||||
#| out-height: 125%
|
||||
require(magrittr)
|
||||
1:10 %>% plot()
|
||||
1:10 %>% plot(y = sin(1:10))
|
||||
sin(1:10) %>% plot(1:10, .)
|
||||
sin(1:10) |> plot(x = 1:10, y = _)
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## 代码编写规则
|
||||
|
||||
```{r}
|
||||
#| eval: false
|
||||
|
||||
# Strive for:
|
||||
short_flights <- flights |> filter(air_time < 60)
|
||||
# Avoid:
|
||||
SHORTFLIGHTS <- flights |> filter(air_time < 60)
|
||||
|
||||
# Strive for
|
||||
z <- (a + b)^2 / d
|
||||
# Avoid
|
||||
z<-( a + b ) ^ 2/d
|
||||
|
||||
# Strive for
|
||||
mean(x, na.rm = TRUE)
|
||||
# Avoid
|
||||
mean (x ,na.rm=TRUE)
|
||||
```
|
||||
|
||||
## 练习
|
||||
|
||||
```{r}
|
||||
#| eval: false
|
||||
flights|>filter(dest=="IAH")|>
|
||||
group_by(year,month,day)|>summarize(n=n(),
|
||||
delay=mean(arr_delay,na.rm=TRUE))|>filter(n>10)
|
||||
|
||||
flights|>filter(carrier=="UA",
|
||||
dest%in%c("IAH","HOU"),sched_dep_time>
|
||||
0900,sched_arr_time<2000)|>group_by(flight)|>
|
||||
summarize(delay=mean(
|
||||
arr_delay,na.rm=TRUE),cancelled=sum(is.na(arr_delay)),
|
||||
n=n())|>filter(n>10)
|
||||
```
|
||||
|
||||
|
||||
## quarto
|
||||
|
||||
![](../../image/quarto-flow.png)
|
||||
|
||||
|
||||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "../")`
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
title: Authors-block
|
||||
authors:
|
||||
- name: Lorenz A. Kapsner
|
||||
orcid: 0000-0003-1866-860X
|
||||
- name: Albert Krewinkel
|
||||
orcid: 0000-0002-9455-0796
|
||||
- name: Robert Winkler
|
||||
version: 0.2.1
|
||||
quarto-required: ">=1.3.0"
|
||||
contributes:
|
||||
filters:
|
||||
- authors-block.lua
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
--[[
|
||||
authors-block – affiliations block extension for quarto
|
||||
|
||||
Copyright (c) 2023 Lorenz A. Kapsner
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
]]
|
||||
|
||||
local List = require 'pandoc.List'
|
||||
|
||||
-- [import]
|
||||
local from_utils = require "utils"
|
||||
local normalize_affiliations = from_utils.normalize_affiliations
|
||||
local normalize_authors = from_utils.normalize_authors
|
||||
local normalize_latex_authors = from_utils.normalize_latex_authors
|
||||
|
||||
local from_authors = require "from_author_info_blocks"
|
||||
local default_marks = from_authors.default_marks
|
||||
local create_equal_contributors_block = from_authors.create_equal_contributors_block
|
||||
local create_affiliations_blocks = from_authors.create_affiliations_blocks
|
||||
local create_correspondence_blocks = from_authors.create_correspondence_blocks
|
||||
local is_corresponding_author = from_authors.is_corresponding_author
|
||||
local author_inline_generator = from_authors.author_inline_generator
|
||||
local create_authors_inlines = from_authors.create_authors_inlines
|
||||
-- [/import]
|
||||
|
||||
-- This is the main-part
|
||||
function Pandoc(doc)
|
||||
local meta = doc.meta
|
||||
local body = List:new{}
|
||||
|
||||
local mark = function (mark_name) return default_marks[mark_name] end
|
||||
|
||||
body:extend(create_equal_contributors_block(meta.authors, mark) or {})
|
||||
body:extend(create_affiliations_blocks(meta.affiliations) or {})
|
||||
body:extend(create_correspondence_blocks(meta.authors, mark) or {})
|
||||
body:extend(doc.blocks)
|
||||
|
||||
for _i, author in ipairs(meta.authors) do
|
||||
author.test = is_corresponding_author(author)
|
||||
end
|
||||
|
||||
meta.affiliations = normalize_affiliations(meta.affiliations)
|
||||
meta.author = meta.authors:map(normalize_authors(meta.affiliations))
|
||||
|
||||
-- Overwrite authors with formatted values. We use a single, formatted
|
||||
-- string for most formats. LaTeX output, however, looks nicer if we
|
||||
-- provide a authors as a list.
|
||||
meta.author = pandoc.MetaInlines(create_authors_inlines(meta.author, mark))
|
||||
-- Institute info is now baked into the affiliations block.
|
||||
meta.affiliations = nil
|
||||
|
||||
return pandoc.Pandoc(body, meta)
|
||||
end
|
|
@ -1,197 +0,0 @@
|
|||
-- https://github.com/pandoc/lua-filters/commit/ca72210b453cc0d045360e0ae36448d019d7dfbf
|
||||
--[[
|
||||
affiliation-blocks – generate title components
|
||||
|
||||
Copyright © 2017–2021 Albert Krewinkel
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
]]
|
||||
|
||||
-- from @kapsner
|
||||
-- [import]
|
||||
local from_utils = require "utils"
|
||||
local has_key = from_utils.has_key
|
||||
-- [/import]
|
||||
local M = {}
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
local List = require 'pandoc.List'
|
||||
local utils = require 'pandoc.utils'
|
||||
local stringify = utils.stringify
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
local default_marks
|
||||
local default_marks = {
|
||||
corresponding_author = FORMAT == 'latexAA'
|
||||
and {pandoc.RawInline('latex', '*')}
|
||||
or {pandoc.Str '✉'},
|
||||
equal_contributor = FORMAT == 'latexAA'
|
||||
and {pandoc.RawInline('latex', '$\\dagger{}$')}
|
||||
or {pandoc.Str '*'},
|
||||
}
|
||||
M.default_marks = default_marks
|
||||
|
||||
-- modified by @kapsner
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
local function is_equal_contributor(author)
|
||||
if has_key(author, "attributes") then
|
||||
return author.attributes["equalcontributor"]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
--- Create equal contributors note.
|
||||
local function create_equal_contributors_block(authors, mark)
|
||||
local has_equal_contribs = List:new(authors):find_if(is_equal_contributor)
|
||||
if not has_equal_contribs then
|
||||
return nil
|
||||
end
|
||||
local contributors = {
|
||||
pandoc.Superscript(mark'equal_contributor'),
|
||||
pandoc.Space(),
|
||||
pandoc.Str 'These authors contributed equally to this work.'
|
||||
}
|
||||
return List:new{pandoc.Para(contributors)}
|
||||
end
|
||||
M.create_equal_contributors_block = create_equal_contributors_block
|
||||
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
local function intercalate(lists, elem)
|
||||
local result = List:new{}
|
||||
for i = 1, (#lists - 1) do
|
||||
result:extend(lists[i])
|
||||
result:extend(elem)
|
||||
end
|
||||
if #lists > 0 then
|
||||
result:extend(lists[#lists])
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
--- Check whether the given author is a corresponding author
|
||||
local function is_corresponding_author(author)
|
||||
if has_key(author, "attributes") then
|
||||
if author.attributes["corresponding"] then
|
||||
return author.email
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
M.is_corresponding_author = is_corresponding_author
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
--- Generate a block element containing the correspondence information
|
||||
local function create_correspondence_blocks(authors, mark)
|
||||
local corresponding_authors = List:new{}
|
||||
for _, author in ipairs(authors) do
|
||||
if is_corresponding_author(author) then
|
||||
local mailto = 'mailto:' .. utils.stringify(author.email)
|
||||
local author_with_mail = List:new(
|
||||
-- modified by @kapsner
|
||||
author.name.literal .. List:new{pandoc.Space(), pandoc.Str '<'} ..
|
||||
author.email .. List:new{pandoc.Str '>'}
|
||||
)
|
||||
local link = pandoc.Link(author_with_mail, mailto)
|
||||
table.insert(corresponding_authors, {link})
|
||||
end
|
||||
end
|
||||
if #corresponding_authors == 0 then
|
||||
return nil
|
||||
end
|
||||
local correspondence = List:new{
|
||||
pandoc.Superscript(mark'corresponding_author'),
|
||||
pandoc.Space(),
|
||||
pandoc.Str'Correspondence:',
|
||||
pandoc.Space()
|
||||
}
|
||||
local sep = List:new{pandoc.Str',', pandoc.Space()}
|
||||
return {
|
||||
pandoc.Para(correspondence .. intercalate(corresponding_authors, sep))
|
||||
}
|
||||
end
|
||||
M.create_correspondence_blocks = create_correspondence_blocks
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
--- Create inlines for a single author (includes all author notes)
|
||||
local function author_inline_generator (get_mark)
|
||||
return function (author)
|
||||
local author_marks = List:new{}
|
||||
-- modified by @kapsner
|
||||
if has_key(author, "attributes") then
|
||||
if author.attributes["equalcontributor"] then
|
||||
author_marks[#author_marks + 1] = get_mark 'equal_contributor'
|
||||
end
|
||||
end
|
||||
local idx_str
|
||||
for _, idx in ipairs(author.affiliations) do
|
||||
if type(idx) ~= 'table' then
|
||||
idx_str = tostring(idx)
|
||||
else
|
||||
idx_str = stringify(idx)
|
||||
end
|
||||
author_marks[#author_marks + 1] = {pandoc.Str(idx_str)}
|
||||
end
|
||||
if is_corresponding_author(author) then
|
||||
author_marks[#author_marks + 1] = get_mark 'corresponding_author'
|
||||
end
|
||||
-- modified by @kapsner
|
||||
if FORMAT:match 'latexAA' then
|
||||
author.name.literal[#author.name.literal + 1] = pandoc.Superscript(intercalate(author_marks, {pandoc.Str ','}))
|
||||
return author
|
||||
else
|
||||
local res = List.clone(author.name.literal)
|
||||
res[#res + 1] = pandoc.Superscript(intercalate(author_marks, {pandoc.Str ','}))
|
||||
return res
|
||||
end
|
||||
end
|
||||
end
|
||||
M.author_inline_generator = author_inline_generator
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
--- Generate a list of inlines containing all authors.
|
||||
local function create_authors_inlines(authors, mark)
|
||||
local inlines_generator = author_inline_generator(mark)
|
||||
local inlines = List:new(authors):map(inlines_generator)
|
||||
local and_str = List:new{pandoc.Space(), pandoc.Str'and', pandoc.Space()}
|
||||
|
||||
local last_author = inlines[#inlines]
|
||||
inlines[#inlines] = nil
|
||||
local result = intercalate(inlines, {pandoc.Str ',', pandoc.Space()})
|
||||
if #authors > 1 then
|
||||
result:extend(List:new{pandoc.Str ","} .. and_str)
|
||||
end
|
||||
result:extend(last_author)
|
||||
return result
|
||||
end
|
||||
M.create_authors_inlines = create_authors_inlines
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/author-info-blocks/author-info-blocks.lua
|
||||
--- Generate a block list all affiliations, marked with arabic numbers.
|
||||
local function create_affiliations_blocks(affiliations)
|
||||
local affil_lines = List:new(affiliations):map(
|
||||
function (affil, i)
|
||||
local num_inlines = List:new{
|
||||
pandoc.Superscript{pandoc.Str(affil.number)},
|
||||
pandoc.Space()
|
||||
}
|
||||
return num_inlines .. affil.name
|
||||
end
|
||||
)
|
||||
return {pandoc.Para(intercalate(affil_lines, {pandoc.LineBreak()}))}
|
||||
end
|
||||
M.create_affiliations_blocks = create_affiliations_blocks
|
||||
|
||||
return M
|
|
@ -1,59 +0,0 @@
|
|||
--[[
|
||||
ScholarlyMeta – normalize author/affiliation meta variables
|
||||
|
||||
Copyright (c) 2017-2021 Albert Krewinkel, Robert Winkler
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
]]
|
||||
|
||||
local List = require 'pandoc.List'
|
||||
local utils = require 'pandoc.utils'
|
||||
local stringify = utils.stringify
|
||||
|
||||
local M = {}
|
||||
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/scholarly-metadata/scholarly-metadata.lua
|
||||
--- Returns a function which checks whether an object has the given ID.
|
||||
local function has_id(id)
|
||||
return function(x) return x.id == id end
|
||||
end
|
||||
|
||||
|
||||
-- taken from https://github.com/pandoc/lua-filters/blob/1660794b991c3553968beb993f5aabb99b317584/scholarly-metadata/scholarly-metadata.lua
|
||||
--- Resolve institute placeholders to full named objects
|
||||
local function resolve_institutes(institute, known_institutes)
|
||||
local unresolved_institutes
|
||||
if institute == nil then
|
||||
unresolved_institutes = {}
|
||||
elseif type(institute) == "string" or type(institute) == "number" then
|
||||
unresolved_institutes = {institute}
|
||||
else
|
||||
unresolved_institutes = institute
|
||||
end
|
||||
|
||||
local result = List:new{}
|
||||
for i, inst in ipairs(unresolved_institutes) do
|
||||
-- this has been modified by @kapsner
|
||||
--result[i] =
|
||||
-- known_institutes[tonumber(inst)] or
|
||||
-- known_institutes:find_if(has_id(pandoc.utils.stringify(inst))) or
|
||||
-- to_named_object(inst)
|
||||
intermed_val = known_institutes:find_if(has_id(stringify(inst)))
|
||||
result[i] = pandoc.MetaString(stringify(intermed_val.index))
|
||||
end
|
||||
return result
|
||||
end
|
||||
M.resolve_institutes = resolve_institutes
|
||||
|
||||
return M
|
|
@ -1,62 +0,0 @@
|
|||
--[[
|
||||
authors-block – affiliations block extension for quarto
|
||||
|
||||
Copyright (c) 2023 Lorenz A. Kapsner
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
]]
|
||||
|
||||
local List = require 'pandoc.List'
|
||||
local utils = require 'pandoc.utils'
|
||||
local stringify = utils.stringify
|
||||
|
||||
-- [import]
|
||||
local from_scholarly = require "from_scholarly_metadata"
|
||||
local resolve_institutes = from_scholarly.resolve_institutes
|
||||
-- [/import]
|
||||
|
||||
local M = {}
|
||||
|
||||
-- from @kapsner
|
||||
local function normalize_affiliations(affiliations)
|
||||
local affiliations_norm = List:new(affiliations):map(
|
||||
function(affil, i)
|
||||
affil.index = pandoc.MetaInlines(pandoc.Str(tostring(i)))
|
||||
affil.id = pandoc.MetaString(stringify(affil.id))
|
||||
return affil
|
||||
end
|
||||
)
|
||||
return affiliations_norm
|
||||
end
|
||||
M.normalize_affiliations = normalize_affiliations
|
||||
|
||||
-- from https://stackoverflow.com/a/2282547
|
||||
local function has_key(set, key)
|
||||
return set[key] ~= nil
|
||||
end
|
||||
M.has_key = has_key
|
||||
|
||||
-- from @kapsner
|
||||
local function normalize_authors(affiliations)
|
||||
return function(auth)
|
||||
auth.id = pandoc.MetaString(stringify(auth.name))
|
||||
auth.affiliations = resolve_institutes(
|
||||
auth.affiliations,
|
||||
affiliations
|
||||
)
|
||||
return auth
|
||||
end
|
||||
end
|
||||
M.normalize_authors = normalize_authors
|
||||
|
||||
return M
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,225 +0,0 @@
|
|||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
|
||||
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu3cOWxw.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lujVj9_mf.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lujVj9_mf.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lujVj9_mf.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lujVj9_mf.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lujVj9_mf.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
|
||||
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lujVj9_mf.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7lujVj9w.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmhdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
|
||||
U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwkxdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmxdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlBdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmBdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
|
||||
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwmRdu3cOWxy40.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
|
||||
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: "Source Sans Pro";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url(./googlefonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ig4vwlxdu3cOWxw.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,8 +0,0 @@
|
|||
title: D2
|
||||
author: Data Intuitive
|
||||
version: 1.1.0
|
||||
quarto-required: ">=1.3"
|
||||
contributes:
|
||||
filters:
|
||||
- d2.lua
|
||||
|
|
@ -1,272 +0,0 @@
|
|||
-- Enum for D2Theme
|
||||
local D2Theme = {
|
||||
NeutralDefault = 0,
|
||||
NeutralGrey = 1,
|
||||
FlagshipTerrastruct = 3,
|
||||
CoolClassics = 4,
|
||||
MixedBerryBlue = 5,
|
||||
GrapeSoda = 6,
|
||||
Aubergine = 7,
|
||||
ColorblindClear = 8,
|
||||
VanillaNitroCola = 100,
|
||||
OrangeCreamsicle = 101,
|
||||
ShirelyTemple = 102,
|
||||
EarthTones = 103,
|
||||
EvergladeGreen = 104,
|
||||
ButteredToast = 105,
|
||||
DarkMauve = 200,
|
||||
Terminal = 300,
|
||||
TerminalGrayscale = 301,
|
||||
Origami = 302
|
||||
}
|
||||
|
||||
-- Enum for D2Layout
|
||||
local D2Layout = {
|
||||
dagre = 'dagre',
|
||||
elk = 'elk'
|
||||
}
|
||||
|
||||
-- Enum for D2Format
|
||||
local D2Format = {
|
||||
svg = 'svg',
|
||||
png = 'png',
|
||||
pdf = 'pdf'
|
||||
}
|
||||
-- Enum for Embed mode
|
||||
local EmbedMode = {
|
||||
inline = "inline",
|
||||
link = "link",
|
||||
raw = "raw"
|
||||
}
|
||||
|
||||
-- Helper function to copy a table
|
||||
function copyTable(obj, seen)
|
||||
-- Handle non-tables and previously-seen tables.
|
||||
if type(obj) ~= 'table' then return obj end
|
||||
if seen and seen[obj] then return seen[obj] end
|
||||
|
||||
-- New table; mark it as seen and copy recursively.
|
||||
local s = seen or {}
|
||||
local res = {}
|
||||
s[obj] = res
|
||||
for k, v in pairs(obj) do res[copyTable(k, s)] = copyTable(v, s) end
|
||||
return setmetatable(res, getmetatable(obj))
|
||||
end
|
||||
|
||||
-- Helper function for debugging
|
||||
function dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
||||
end
|
||||
return s .. '} '
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Counter for the diagram files
|
||||
local counter = 0
|
||||
|
||||
local function render_graph(globalOptions)
|
||||
local filter = {
|
||||
CodeBlock = function(cb)
|
||||
-- Check if the CodeBlock has the 'd2' class
|
||||
if not cb.classes:includes('d2') or cb.text == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
counter = counter + 1
|
||||
|
||||
-- Initialise options table
|
||||
local options = copyTable(globalOptions)
|
||||
|
||||
-- Process codeblock attributes
|
||||
for k, v in pairs(cb.attributes) do
|
||||
options[k] = v
|
||||
end
|
||||
|
||||
-- Transform options
|
||||
if options.theme ~= nil and type(options.theme) == "string" then
|
||||
assert(D2Theme[options.theme] ~= nil, "Invalid theme: " .. options.theme .. ". Options are: " .. dump(D2Theme))
|
||||
options.theme = D2Theme[options.theme]
|
||||
end
|
||||
if options.layout ~= nil and type(options.layout) == "string" then
|
||||
assert(D2Layout[options.layout] ~= nil, "Invalid layout: " .. options.layout .. ". Options are: " .. dump(D2Layout))
|
||||
options.layout = D2Layout[options.layout]
|
||||
end
|
||||
if options.format ~= nil and type(options.format) == "string" then
|
||||
assert(D2Format[options.format] ~= nil, "Invalid format: " .. options.format .. ". Options are: " .. dump(D2Format))
|
||||
options.format = D2Format[options.format]
|
||||
end
|
||||
if options.embed_mode ~= nil and type(options.embed_mode) == "string" then
|
||||
assert(EmbedMode[options.embed_mode] ~= nil, "Invalid embed_mode: " .. options.embed_mode .. ". Options are: " .. dump(EmbedMode))
|
||||
options.embed_mode = EmbedMode[options.embed_mode]
|
||||
end
|
||||
if options.sketch ~= nil and type(options.sketch) == "string" then
|
||||
assert(options.sketch == "true" or options.sketch == "false", "Invalid sketch: " .. options.sketch .. ". Options are: true, false")
|
||||
options.sketch = options.sketch == "true"
|
||||
end
|
||||
if options.pad ~= nil and type(options.pad) == "string" then
|
||||
assert(tonumber(options.pad) ~= nil, "Invalid pad: " .. options.pad .. ". Must be a number")
|
||||
options.pad = tonumber(options.pad)
|
||||
end
|
||||
if options.echo ~= nil and type(options.echo) == "string" then
|
||||
assert(options.echo == "true" or options.echo == "false", "Invalid echo: " .. options.echo .. ". Options are: true, false")
|
||||
options.echo = options.echo == "true"
|
||||
end
|
||||
|
||||
-- Set default filename
|
||||
if options.filename == nil then
|
||||
options.filename = "diagram-" .. counter
|
||||
end
|
||||
|
||||
-- Set the default format to pdf since svg is not supported in PDF output
|
||||
if options.format == D2Format.svg and quarto.doc.is_format("latex") then
|
||||
options.format = D2Format.pdf
|
||||
end
|
||||
-- Set the default embed_mode to link if the quarto format is not html or the figure format is pdf
|
||||
if not quarto.doc.is_format("html") or options.format == D2Format.pdf then
|
||||
options.embed_mode = EmbedMode.link
|
||||
end
|
||||
|
||||
-- Set the default folder to ./images when embed_mode is link
|
||||
if options.folder == nil and options.embed_mode == EmbedMode.link then
|
||||
options.folder = "./images"
|
||||
end
|
||||
|
||||
-- Generate diagram using `d2` CLI utility
|
||||
local result = pandoc.system.with_temporary_directory('svg-convert', function (tmpdir)
|
||||
-- determine path name of input file
|
||||
local inputPath = pandoc.path.join({tmpdir, "temp_" .. counter .. ".txt"})
|
||||
|
||||
-- determine path name of output file
|
||||
local outputPath
|
||||
if options.folder ~= nil then
|
||||
os.execute("mkdir -p " .. options.folder)
|
||||
outputPath = options.folder .. "/" .. options.filename .. "." .. options.format
|
||||
else
|
||||
outputPath = pandoc.path.join({tmpdir, options.filename .. "." .. options.format})
|
||||
end
|
||||
|
||||
-- write graph text to file
|
||||
local tmpFile = io.open(inputPath, "w")
|
||||
if tmpFile == nil then
|
||||
print("Error: Could not open file for writing")
|
||||
return nil
|
||||
end
|
||||
tmpFile:write(cb.text)
|
||||
tmpFile:close()
|
||||
|
||||
-- run d2
|
||||
os.execute(
|
||||
"d2" ..
|
||||
" --theme=" .. options.theme ..
|
||||
" --layout=" .. options.layout ..
|
||||
" --sketch=" .. tostring(options.sketch) ..
|
||||
" --pad=" .. options.pad ..
|
||||
" " .. inputPath ..
|
||||
" " .. outputPath
|
||||
)
|
||||
|
||||
if options.embed_mode == EmbedMode.link then
|
||||
return outputPath
|
||||
else
|
||||
local file = io.open(outputPath, "rb")
|
||||
local data
|
||||
if file then
|
||||
data = file:read('*all')
|
||||
file:close()
|
||||
end
|
||||
os.remove(outputPath)
|
||||
|
||||
if options.embed_mode == EmbedMode.raw then
|
||||
return data
|
||||
elseif options.embed_mode == EmbedMode.inline then
|
||||
dump(options)
|
||||
|
||||
if options.format == "svg" then
|
||||
return "data:image/svg+xml;base64," .. quarto.base64.encode(data)
|
||||
elseif options.format == "png" then
|
||||
return "data:image/png;base64," .. quarto.base64.encode(data)
|
||||
else
|
||||
print("Error: Unsupported format")
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Read the generated output into a Pandoc Image element
|
||||
local output
|
||||
if options.embed_mode == EmbedMode.raw then
|
||||
output = pandoc.Div({pandoc.RawInline("html", result)})
|
||||
|
||||
if options.width ~= nil then
|
||||
output.attributes.style = "width: " .. options.width .. ";"
|
||||
end
|
||||
if options.height ~= nil then
|
||||
output.attributes.style = output.attributes.style .. "height: " .. options.height .. ";"
|
||||
end
|
||||
|
||||
else
|
||||
local image = pandoc.Image({}, result)
|
||||
|
||||
-- Set the width and height attributes, if they exist
|
||||
if options.width ~= nil then
|
||||
image.attributes.width = options.width
|
||||
end
|
||||
|
||||
if options.height ~= nil then
|
||||
image.attributes.height = options.height
|
||||
end
|
||||
|
||||
if options.caption ~= '' then
|
||||
image.caption = pandoc.Str(options.caption)
|
||||
end
|
||||
|
||||
output = pandoc.Para({image})
|
||||
end
|
||||
|
||||
-- Wrap the Image element in a Para element and return it
|
||||
if options.echo then
|
||||
local codeBlock = pandoc.CodeBlock(cb.text, cb.attr)
|
||||
output = pandoc.Div({codeBlock, output})
|
||||
end
|
||||
return output
|
||||
end
|
||||
}
|
||||
return filter
|
||||
end
|
||||
|
||||
|
||||
function Pandoc(doc)
|
||||
|
||||
local options = {
|
||||
theme = D2Theme.NeutralDefault,
|
||||
layout = D2Layout.dagre,
|
||||
format = D2Format.svg,
|
||||
sketch = false,
|
||||
pad = 100,
|
||||
folder = nil,
|
||||
filename = nil,
|
||||
caption = '',
|
||||
width = nil,
|
||||
height = nil,
|
||||
echo = false,
|
||||
embed_mode = "inline"
|
||||
}
|
||||
|
||||
-- Process global attributes
|
||||
local globalOptions = doc.meta["d2"]
|
||||
if type(globalOptions) == "table" then
|
||||
for k, v in pairs(globalOptions) do
|
||||
options[k] = pandoc.utils.stringify(v)
|
||||
end
|
||||
end
|
||||
|
||||
return doc:walk(render_graph(options))
|
||||
end
|
|
@ -1,345 +0,0 @@
|
|||
:root {
|
||||
--r-background-color: #fff;
|
||||
--r-main-font: Source Sans Pro, simhei, microsoft yahei;
|
||||
--r-main-font-size: 32px;
|
||||
--r-main-color: #222;
|
||||
--r-block-margin: 12px;
|
||||
--r-heading-margin: 0 0 12px 0;
|
||||
--r-heading-font: Source Sans Pro, microsoft yahei, simhei;
|
||||
--r-heading-color: #0c4c8a;
|
||||
--r-heading-line-height: 1.2em;
|
||||
--r-heading-letter-spacing: normal;
|
||||
--r-heading-text-transform: none;
|
||||
--r-heading-text-shadow: none;
|
||||
--r-heading-font-weight: 900;
|
||||
--r-heading1-text-shadow: none;
|
||||
--r-heading1-size: 2.5em;
|
||||
--r-heading2-size: 1.6em;
|
||||
--r-heading3-size: 1.3em;
|
||||
--r-heading4-size: 1em;
|
||||
--r-code-font: SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono,
|
||||
Courier New, monospace;
|
||||
--r-link-color: #ef562d;
|
||||
--r-link-color-dark: #ef562d;
|
||||
--r-link-color-hover: #d13076;
|
||||
--r-selection-background-color: #98bdef;
|
||||
--r-selection-color: #fff;
|
||||
--quarto-hl-fu-color: #c53800;
|
||||
}
|
||||
|
||||
.reveal .title-slide h1 {
|
||||
text-align: center;
|
||||
line-height: var(--r-heading-line-height);
|
||||
}
|
||||
|
||||
section#title-slide p.author,
|
||||
section#title-slide p.institute,
|
||||
section#title-slide p.date {
|
||||
font-size: var(--r-heading2-size);
|
||||
color: gray;
|
||||
}
|
||||
|
||||
section#title-slide h1.title:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
border: 3px solid;
|
||||
border-image: linear-gradient(to right, white, var(--r-heading-color), white)
|
||||
1;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
section#title-slide p.subtitle {
|
||||
font-size: var(--r-heading3-size);
|
||||
text-decoration: underline;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
section#title-slide a {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.reveal .slide-number a {
|
||||
color: #bbbbbb;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
section#title-slide a:hover {
|
||||
color: var(--r-link-color-hover);
|
||||
}
|
||||
|
||||
.reveal[data-navigation-mode="linear"] .title-slide h1 {
|
||||
font-size: var(--r-heading2-size);
|
||||
}
|
||||
|
||||
section#TOC {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
section#TOC h2 {
|
||||
font-size: var(--r-heading2-size);
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
section#TOC h2:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
border: 3px solid;
|
||||
border-image: linear-gradient(to right, white, var(--r-heading-color), white)
|
||||
1;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
section#TOC ul {
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
margin-top: 3em;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
section#TOC ol li {
|
||||
font-size: var(--r-heading3-size);
|
||||
font-weight: bold;
|
||||
color: gray;
|
||||
list-style-type: number;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
section#TOC strong,
|
||||
section#TOC b {
|
||||
color: black;
|
||||
}
|
||||
|
||||
section#TOC ul li {
|
||||
font-size: var(--r-heading3-size);
|
||||
font-weight: bold;
|
||||
color: gray;
|
||||
list-style-type: circle;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
section#TOC a {
|
||||
color: black;
|
||||
}
|
||||
|
||||
section#TOC a:hover {
|
||||
color: var(--r-link-color-hover);
|
||||
}
|
||||
|
||||
.reveal h2 {
|
||||
text-align: left;
|
||||
margin-top: 0px;
|
||||
line-height: var(--r-heading-line-height);
|
||||
}
|
||||
|
||||
.reveal .title-slide h1:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
border: 3px solid;
|
||||
border-image: linear-gradient(to right, white, var(--r-heading-color), white)
|
||||
1;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.reveal h2:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
border: 3px solid;
|
||||
border-image: linear-gradient(to right, var(--r-heading-color), white) 1;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.reveal ul {
|
||||
list-style-type: circle;
|
||||
}
|
||||
|
||||
li:hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.reveal p:hover {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.reveal ul li {
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
.reveal .thank h2 {
|
||||
font-size: var(--r-heading1-size);
|
||||
line-height: var(--r-heading-line-height);
|
||||
}
|
||||
|
||||
.reveal .thank {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.reveal .thank h2:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
border: 3px solid;
|
||||
border-image: linear-gradient(to right, white, var(--r-heading-color), white)
|
||||
1;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.panel-tabset [role="tab"] {
|
||||
border-bottom: 1px solid red;
|
||||
}
|
||||
|
||||
.panel-tabset [role="tab"][aria-selected="true"] {
|
||||
background-color: #ffdddd;
|
||||
border-bottom: 1px solid red;
|
||||
}
|
||||
|
||||
.white {
|
||||
color: #ffffff;
|
||||
}
|
||||
.orange {
|
||||
color: #e09a25;
|
||||
}
|
||||
.green {
|
||||
color: #006e51;
|
||||
}
|
||||
.pink {
|
||||
color: #d13076;
|
||||
}
|
||||
|
||||
.dusty {
|
||||
color: #ad5d5d;
|
||||
}
|
||||
|
||||
.flame {
|
||||
color: #ef562d;
|
||||
}
|
||||
.kale {
|
||||
color: #5c7148;
|
||||
}
|
||||
.blue {
|
||||
color: #0c4c8a;
|
||||
}
|
||||
.red {
|
||||
color: #b93a32;
|
||||
}
|
||||
.clay {
|
||||
color: #9e4624;
|
||||
}
|
||||
.bodacious {
|
||||
color: #b76ba3;
|
||||
}
|
||||
.serenity {
|
||||
color: #91a8d0;
|
||||
}
|
||||
|
||||
.cognac {
|
||||
color: #60413c;
|
||||
}
|
||||
.sangria {
|
||||
color: #760030;
|
||||
}
|
||||
|
||||
.alumium {
|
||||
color: #75796a;
|
||||
}
|
||||
|
||||
.marsala {
|
||||
color: #964f4c;
|
||||
}
|
||||
.purple {
|
||||
color: #702fa8;
|
||||
}
|
||||
|
||||
.blank {
|
||||
background-color: "Yellow";
|
||||
width: 100%;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.reveal .slide aside {
|
||||
position: absolute;
|
||||
margin: 0 auto;
|
||||
left: 2%;
|
||||
font-size: 0.7em;
|
||||
text-align: end;
|
||||
max-width: 90%;
|
||||
width: fit-content;
|
||||
color: gray;
|
||||
bottom: -6%;
|
||||
}
|
||||
|
||||
.ref {
|
||||
position: absolute;
|
||||
margin: 0 auto;
|
||||
right: 2%;
|
||||
font-size: 1em;
|
||||
text-align: end;
|
||||
max-width: 90%;
|
||||
width: fit-content;
|
||||
color: gray;
|
||||
bottom: -6%;
|
||||
}
|
||||
|
||||
.con {
|
||||
position: absolute;
|
||||
margin: 0 auto;
|
||||
font-size: 1.4em;
|
||||
text-align: center;
|
||||
font-family: inherit;
|
||||
max-width: 100%;
|
||||
width: fit-content;
|
||||
color: #023047;
|
||||
bottom: -2%;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tiny {
|
||||
font-size: 60%;
|
||||
}
|
||||
|
||||
figure > figcaption {
|
||||
margin-top: -0.5em;
|
||||
}
|
||||
|
||||
.reveal .slide figure > figcaption,
|
||||
.reveal .slide img.stretch + p.caption,
|
||||
.reveal .slide img.r-stretch + p.caption {
|
||||
font-size: 0.9em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.reveal strong, .reveal b {
|
||||
font-weight: bold;
|
||||
color: crimson;
|
||||
}
|
||||
|
||||
.reveal pre code {
|
||||
background-color: #554433;
|
||||
line-height: 1.2em;
|
||||
color: #fff;
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
.reveal pre code:hover{
|
||||
font-size: xx-large;
|
||||
line-height: 250%;
|
||||
}
|
||||
|
||||
section#title-slide p.subtitle {
|
||||
font-size: var(--r-heading3-size);
|
||||
text-decoration: none;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.reveal div.sourceCode pre code {
|
||||
background-color: #002233;
|
||||
min-height: 100%;
|
||||
font-size: x-large;
|
||||
}
|
||||
|
||||
.reveal div.sourceCode pre code:hover {
|
||||
font-size: xx-large;
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
.udot {
|
||||
text-decoration-line: underline;
|
||||
text-decoration-color: rgb(50, 50, 50);
|
||||
text-decoration-style: dashed;
|
||||
text-decoration-thickness: 1px;
|
||||
}
|
||||
|
||||
.good {
|
||||
background-color: forestgreen;
|
||||
color: lightyellow;
|
||||
}
|
||||
|
||||
.bad {
|
||||
background-color: orangered;
|
||||
color: lightyellow;
|
||||
}
|
||||
|
||||
.del {
|
||||
/* text-decoration-color: rgb(222 13 13); */
|
||||
text-decoration: line-through;
|
||||
background-color: rgba(255, 0, 0, 0.2);
|
||||
text-decoration-style: initial;
|
||||
text-decoration-thickness: 1.5px;
|
||||
}
|
||||
|
||||
|
||||
.todo {
|
||||
background-color: darkorange;
|
||||
color: lightyellow;
|
||||
}
|
||||
|
||||
.com {
|
||||
background-color: #0025ff;
|
||||
font-weight: bold;
|
||||
color: lightyellow;
|
||||
}
|
||||
|
||||
.add .ins {
|
||||
text-decoration: underline;
|
||||
background-color: rgba(0, 128, 0, 0.2);
|
||||
/* text-decoration-color: rgb(222 13 13); */
|
||||
background-color: violet;
|
||||
text-decoration-style: initial;
|
||||
text-decoration-thickness: 2px;
|
||||
}
|
||||
|
||||
|
||||
del {
|
||||
text-decoration-line: line-through;
|
||||
text-decoration-color: rgb(222 13 13);
|
||||
text-decoration-style: initial;
|
||||
text-decoration-thickness: 1.0px;
|
||||
}
|
||||
|
||||
|
||||
ins {
|
||||
text-decoration: underline;
|
||||
background-color: rgba(0, 128, 0, 0.2);
|
||||
text-decoration-style: initial;
|
||||
text-decoration-thickness: 2px;
|
||||
}
|
||||
|
||||
.clab {
|
||||
background-color: rgb(255, 245, 240);
|
||||
}
|
||||
|
||||
.rem {
|
||||
background-color: darkorange;
|
||||
color: lightyellow;
|
||||
text-decoration-thickness: 2px;
|
||||
}
|
||||
|
||||
|
||||
#criticnav {
|
||||
position: fixed;
|
||||
z-index: 1100;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 120px;
|
||||
border-bottom: solid 1px #ffffff;
|
||||
margin: 0;
|
||||
padding: 10;
|
||||
background-color: rgb(143 38 38 / 95%);
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
font-family: "Helvetica Neue", helvetica, arial, sans-serif !important
|
||||
}
|
||||
|
||||
#criticnav ul {
|
||||
list-style-type: none;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
#criticnav ul li {
|
||||
display: block;
|
||||
width: 100px;
|
||||
min-width: 80px;
|
||||
text-align: center;
|
||||
padding: 5px 0 3px !important;
|
||||
margin: 5px 2px !important;
|
||||
line-height: 1em;
|
||||
float: center;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
border-radius: 20px;
|
||||
border: 3px solid rgba(255,255,255,0);
|
||||
color: #fff !important
|
||||
}
|
||||
|
||||
.markup del {
|
||||
background-color: rgba(255, 0, 0, 0.2);
|
||||
text-decoration-line: line-through;
|
||||
/* text-decoration-color: rgb(222 13 13); */
|
||||
text-decoration-style: initial;
|
||||
text-decoration-thickness: 1.5px;
|
||||
}
|
||||
|
||||
.markup ins {
|
||||
text-decoration: underline;
|
||||
background-color: rgba(0, 128, 0, 0.2);
|
||||
/* text-decoration-color: rgb(222 93 93); */
|
||||
text-decoration-style: initial;
|
||||
text-decoration-thickness: 2px;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 81 KiB |
Binary file not shown.
Before Width: | Height: | Size: 222 KiB |
Binary file not shown.
Before Width: | Height: | Size: 250 KiB |
Binary file not shown.
Before Width: | Height: | Size: 150 KiB |
Binary file not shown.
Before Width: | Height: | Size: 229 KiB |
|
@ -1,280 +0,0 @@
|
|||
<?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="sort-only" page-range-format="expanded" default-locale="en-US">
|
||||
<info>
|
||||
<title>American Chemical Society</title>
|
||||
<title-short>ACS</title-short>
|
||||
<id>http://www.zotero.org/styles/american-chemical-society</id>
|
||||
<link href="http://www.zotero.org/styles/american-chemical-society" rel="self"/>
|
||||
<link href="https://pubs.acs.org/doi/full/10.1021/acsguide.40303" rel="documentation"/>
|
||||
<link href="https://pubs.acs.org/doi/book/10.1021/acsguide" rel="documentation"/>
|
||||
<author>
|
||||
<name>Julian Onions</name>
|
||||
<email>julian.onions@gmail.com</email>
|
||||
</author>
|
||||
<contributor>
|
||||
<name>Ivan Bushmarinov</name>
|
||||
<email>ib@ineos.ac.ru</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Sebastian Karcher</name>
|
||||
</contributor>
|
||||
<category citation-format="numeric"/>
|
||||
<category field="chemistry"/>
|
||||
<summary>The American Chemical Society style</summary>
|
||||
<updated>2021-06-04T03:27:50+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>
|
||||
<locale xml:lang="en">
|
||||
<terms>
|
||||
<term name="editortranslator" form="short">
|
||||
<single>ed. and translator</single>
|
||||
<multiple>eds. and translators</multiple>
|
||||
</term>
|
||||
<term name="translator" form="short">
|
||||
<single>translator</single>
|
||||
<multiple>translators</multiple>
|
||||
</term>
|
||||
<term name="collection-editor" form="short">
|
||||
<single>series ed.</single>
|
||||
<multiple>series eds.</multiple>
|
||||
</term>
|
||||
</terms>
|
||||
</locale>
|
||||
<macro name="editor">
|
||||
<group delimiter="; ">
|
||||
<names variable="editor translator" delimiter="; ">
|
||||
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/>
|
||||
<label form="short" prefix=", " text-case="title"/>
|
||||
</names>
|
||||
<names variable="collection-editor">
|
||||
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/>
|
||||
<label form="short" prefix=", " text-case="title"/>
|
||||
</names>
|
||||
</group>
|
||||
</macro>
|
||||
<macro name="author">
|
||||
<names variable="author" suffix=".">
|
||||
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter="; " delimiter-precedes-last="always"/>
|
||||
<label form="short" prefix=", " text-case="capitalize-first"/>
|
||||
</names>
|
||||
</macro>
|
||||
<macro name="publisher">
|
||||
<choose>
|
||||
<if type="thesis" match="any">
|
||||
<group delimiter=", ">
|
||||
<text variable="publisher"/>
|
||||
<text variable="publisher-place"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<group delimiter=": ">
|
||||
<text variable="publisher"/>
|
||||
<text variable="publisher-place"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="title">
|
||||
<choose>
|
||||
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
|
||||
<text variable="title" text-case="title" font-style="italic"/>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="title" text-case="title"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="volume">
|
||||
<group delimiter=" ">
|
||||
<text term="volume" form="short" text-case="capitalize-first"/>
|
||||
<text variable="volume"/>
|
||||
</group>
|
||||
</macro>
|
||||
<macro name="series">
|
||||
<text variable="collection-title"/>
|
||||
</macro>
|
||||
<macro name="pages">
|
||||
<label variable="page" form="short" suffix=" " strip-periods="true"/>
|
||||
<text variable="page"/>
|
||||
</macro>
|
||||
<macro name="book-container">
|
||||
<group delimiter=". ">
|
||||
<text macro="title"/>
|
||||
<choose>
|
||||
<if type="entry-dictionary entry-encyclopedia" match="none">
|
||||
<group delimiter=" ">
|
||||
<text term="in" text-case="capitalize-first"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
</else>
|
||||
</choose>
|
||||
</group>
|
||||
</macro>
|
||||
<macro name="issued">
|
||||
<date variable="issued" delimiter=" ">
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</macro>
|
||||
<macro name="full-issued">
|
||||
<date variable="issued" delimiter=" ">
|
||||
<date-part name="month" form="long" suffix=" "/>
|
||||
<date-part name="day" suffix=", "/>
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</macro>
|
||||
<macro name="edition">
|
||||
<choose>
|
||||
<if is-numeric="edition">
|
||||
<group delimiter=" ">
|
||||
<number variable="edition" form="ordinal"/>
|
||||
<text term="edition" form="short"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="edition" suffix="."/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<citation collapse="citation-number">
|
||||
<sort>
|
||||
<key variable="citation-number"/>
|
||||
</sort>
|
||||
<layout delimiter="," vertical-align="sup">
|
||||
<text variable="citation-number"/>
|
||||
</layout>
|
||||
</citation>
|
||||
<bibliography second-field-align="flush" entry-spacing="0">
|
||||
<layout suffix=".">
|
||||
<text variable="citation-number" prefix="(" suffix=") "/>
|
||||
<text macro="author" suffix=" "/>
|
||||
<choose>
|
||||
<if type="article-journal review" match="any">
|
||||
<group delimiter=" ">
|
||||
<text macro="title" suffix="."/>
|
||||
<text variable="container-title" font-style="italic" form="short"/>
|
||||
<group delimiter=", ">
|
||||
<text macro="issued" font-weight="bold"/>
|
||||
<choose>
|
||||
<if variable="volume">
|
||||
<group delimiter=" ">
|
||||
<text variable="volume" font-style="italic"/>
|
||||
<text variable="issue" prefix="(" suffix=")"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<group delimiter=" ">
|
||||
<text term="issue" form="short" text-case="capitalize-first"/>
|
||||
<text variable="issue"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</group>
|
||||
</if>
|
||||
<else-if type="article-magazine article-newspaper article" match="any">
|
||||
<group delimiter=" ">
|
||||
<text macro="title" suffix="."/>
|
||||
<text variable="container-title" font-style="italic" suffix="."/>
|
||||
<text macro="edition"/>
|
||||
<text macro="publisher"/>
|
||||
<group delimiter=", ">
|
||||
<text macro="full-issued"/>
|
||||
<text macro="pages"/>
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="thesis">
|
||||
<group delimiter=", ">
|
||||
<group delimiter=". ">
|
||||
<text macro="title"/>
|
||||
<text variable="genre"/>
|
||||
</group>
|
||||
<text macro="publisher"/>
|
||||
<text macro="issued"/>
|
||||
<text macro="volume"/>
|
||||
<text macro="pages"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
|
||||
<group delimiter="; ">
|
||||
<group delimiter=", ">
|
||||
<text macro="title"/>
|
||||
<text macro="edition"/>
|
||||
</group>
|
||||
<text macro="editor" prefix=" "/>
|
||||
<text macro="series"/>
|
||||
<choose>
|
||||
<if type="report">
|
||||
<group delimiter=" ">
|
||||
<text variable="genre"/>
|
||||
<text variable="number"/>
|
||||
</group>
|
||||
</if>
|
||||
</choose>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
<group delimiter=", ">
|
||||
<text macro="volume"/>
|
||||
<text macro="pages"/>
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="patent">
|
||||
<group delimiter=", ">
|
||||
<group delimiter=". ">
|
||||
<text macro="title"/>
|
||||
<text variable="number"/>
|
||||
</group>
|
||||
<date variable="issued" form="text"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="chapter paper-conference entry-dictionary entry-encyclopedia" match="any">
|
||||
<group delimiter="; ">
|
||||
<text macro="book-container"/>
|
||||
<text macro="editor"/>
|
||||
<text macro="series"/>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<text macro="issued"/>
|
||||
</group>
|
||||
<group delimiter=", ">
|
||||
<text macro="volume"/>
|
||||
<text macro="pages"/>
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="webpage">
|
||||
<group delimiter=" ">
|
||||
<text variable="title"/>
|
||||
<text variable="URL"/>
|
||||
<date variable="accessed" prefix="(accessed " suffix=")" delimiter=" ">
|
||||
<date-part name="year"/>
|
||||
<date-part name="month" prefix="-" form="numeric-leading-zeros"/>
|
||||
<date-part name="day" prefix="-" form="numeric-leading-zeros"/>
|
||||
</date>
|
||||
</group>
|
||||
</else-if>
|
||||
<else>
|
||||
<group delimiter=", ">
|
||||
<group delimiter=". ">
|
||||
<text macro="title"/>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
</group>
|
||||
<group delimiter=", ">
|
||||
<text macro="issued"/>
|
||||
<text variable="volume" font-style="italic"/>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
<text variable="DOI" prefix=". https://doi.org/"/>
|
||||
</layout>
|
||||
</bibliography>
|
||||
</style>
|
|
@ -1,435 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="in-text" names-delimiter=". " name-as-sort-order="all" sort-separator=" " demote-non-dropping-particle="never" initialize-with=" " initialize-with-hyphen="false" page-range-format="expanded" default-locale="zh-CN">
|
||||
<info>
|
||||
<title>China National Standard GB/T 7714-2015 (numeric, 中文)</title>
|
||||
<id>http://www.zotero.org/styles/china-national-standard-gb-t-7714-2015-numeric</id>
|
||||
<link href="http://www.zotero.org/styles/china-national-standard-gb-t-7714-2015-numeric" rel="self"/>
|
||||
<link href="http://std.samr.gov.cn/gb/search/gbDetailed?id=71F772D8055ED3A7E05397BE0A0AB82A" rel="documentation"/>
|
||||
<author>
|
||||
<name>牛耕田</name>
|
||||
<email>buffalo_d@163.com</email>
|
||||
</author>
|
||||
<contributor>
|
||||
<name>Zeping Lee</name>
|
||||
<email>zepinglee@gmail.com</email>
|
||||
</contributor>
|
||||
<category citation-format="numeric"/>
|
||||
<category field="generic-base"/>
|
||||
<summary>The Chinese GB/T 7714-2015 numeric style</summary>
|
||||
<updated>2022-02-23T10:44:01+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>
|
||||
<locale xml:lang="zh-CN">
|
||||
<date form="text">
|
||||
<date-part name="year" suffix="年" range-delimiter="—"/>
|
||||
<date-part name="month" form="numeric" suffix="月" range-delimiter="—"/>
|
||||
<date-part name="day" suffix="日" range-delimiter="—"/>
|
||||
</date>
|
||||
<terms>
|
||||
<term name="edition" form="short">版</term>
|
||||
<term name="open-quote">“</term>
|
||||
<term name="close-quote">”</term>
|
||||
<term name="open-inner-quote">‘</term>
|
||||
<term name="close-inner-quote">’</term>
|
||||
</terms>
|
||||
</locale>
|
||||
<locale>
|
||||
<date form="numeric">
|
||||
<date-part name="year" range-delimiter="/"/>
|
||||
<date-part name="month" form="numeric-leading-zeros" prefix="-" range-delimiter="/"/>
|
||||
<date-part name="day" form="numeric-leading-zeros" prefix="-" range-delimiter="/"/>
|
||||
</date>
|
||||
<terms>
|
||||
<term name="page-range-delimiter">-</term>
|
||||
</terms>
|
||||
</locale>
|
||||
<!-- 引用日期 -->
|
||||
<macro name="accessed-date">
|
||||
<date variable="accessed" form="numeric" prefix="[" suffix="]"/>
|
||||
</macro>
|
||||
<!-- 主要责任者 -->
|
||||
<macro name="author">
|
||||
<names variable="author">
|
||||
<name>
|
||||
<name-part name="family" text-case="uppercase"/>
|
||||
<name-part name="given"/>
|
||||
</name>
|
||||
<substitute>
|
||||
<names variable="composer"/>
|
||||
<names variable="illustrator"/>
|
||||
<names variable="director"/>
|
||||
<choose>
|
||||
<if variable="container-title" match="none">
|
||||
<names variable="editor"/>
|
||||
</if>
|
||||
</choose>
|
||||
</substitute>
|
||||
</names>
|
||||
</macro>
|
||||
<!-- 书籍的卷号(“第 x 卷”或“第 x 册”) -->
|
||||
<macro name="book-volume">
|
||||
<choose>
|
||||
<if type="article article-journal article-magazine article-newspaper periodical" match="none">
|
||||
<choose>
|
||||
<if is-numeric="volume">
|
||||
<group delimiter=" ">
|
||||
<label variable="volume" form="short" text-case="capitalize-first"/>
|
||||
<text variable="volume"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="volume"/>
|
||||
</else>
|
||||
</choose>
|
||||
</if>
|
||||
</choose>
|
||||
</macro>
|
||||
<!-- 专著主要责任者 -->
|
||||
<macro name="container-author">
|
||||
<names variable="editor">
|
||||
<name>
|
||||
<name-part name="family" text-case="uppercase"/>
|
||||
<name-part name="given"/>
|
||||
</name>
|
||||
<substitute>
|
||||
<names variable="editorial-director"/>
|
||||
<names variable="collection-editor"/>
|
||||
<names variable="container-author"/>
|
||||
</substitute>
|
||||
</names>
|
||||
</macro>
|
||||
<!-- 专著题名 -->
|
||||
<macro name="container-title">
|
||||
<group delimiter=", ">
|
||||
<group delimiter=": ">
|
||||
<choose>
|
||||
<if variable="container-title">
|
||||
<text variable="container-title"/>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="event"/>
|
||||
</else>
|
||||
</choose>
|
||||
<text macro="book-volume"/>
|
||||
</group>
|
||||
<choose>
|
||||
<if variable="event-date">
|
||||
<date variable="event-date" form="text"/>
|
||||
<text variable="event-place"/>
|
||||
</if>
|
||||
</choose>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 版本项 -->
|
||||
<macro name="edition">
|
||||
<choose>
|
||||
<if is-numeric="edition">
|
||||
<group delimiter=" ">
|
||||
<number variable="edition" form="ordinal"/>
|
||||
<text term="edition" form="short"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="edition"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<!-- 电子资源的更新或修改日期 -->
|
||||
<macro name="issued-date">
|
||||
<date variable="issued" form="numeric"/>
|
||||
</macro>
|
||||
<!-- 出版年 -->
|
||||
<macro name="issued-year">
|
||||
<choose>
|
||||
<if is-uncertain-date="issued">
|
||||
<date variable="issued" prefix="[" suffix="]">
|
||||
<date-part name="year" range-delimiter="-"/>
|
||||
</date>
|
||||
</if>
|
||||
<else>
|
||||
<date variable="issued">
|
||||
<date-part name="year" range-delimiter="-"/>
|
||||
</date>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<!-- 专著的出版项 -->
|
||||
<macro name="publishing">
|
||||
<group delimiter=": ">
|
||||
<group delimiter=", ">
|
||||
<group delimiter=": ">
|
||||
<text variable="publisher-place"/>
|
||||
<text variable="publisher"/>
|
||||
</group>
|
||||
<!-- 非电子资源显示“出版年” -->
|
||||
<choose>
|
||||
<if variable="publisher page" type="book chapter paper-conference thesis" match="any">
|
||||
<text macro="issued-year"/>
|
||||
</if>
|
||||
<else-if variable="URL DOI" match="none">
|
||||
<text macro="issued-year"/>
|
||||
</else-if>
|
||||
</choose>
|
||||
</group>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
<choose>
|
||||
<!-- 纯电子资源显示“更新或修改日期” -->
|
||||
<if variable="publisher page" type="book chapter paper-conference thesis" match="none">
|
||||
<choose>
|
||||
<if variable="URL DOI" match="any">
|
||||
<text macro="issued-date" prefix="(" suffix=")"/>
|
||||
</if>
|
||||
</choose>
|
||||
</if>
|
||||
</choose>
|
||||
<text macro="accessed-date"/>
|
||||
</macro>
|
||||
<!-- 其他责任者 -->
|
||||
<macro name="secondary-contributor">
|
||||
<names variable="translator">
|
||||
<name>
|
||||
<name-part name="family" text-case="uppercase"/>
|
||||
<name-part name="given"/>
|
||||
</name>
|
||||
<label form="short" prefix=", "/>
|
||||
</names>
|
||||
</macro>
|
||||
<!-- 连续出版物中的析出文献的出处项(年、卷、期等信息) -->
|
||||
<macro name="periodical-publishing">
|
||||
<group>
|
||||
<group delimiter=": ">
|
||||
<group>
|
||||
<group delimiter=", ">
|
||||
<text macro="container-title" text-case="title"/>
|
||||
<choose>
|
||||
<if type="article-newspaper">
|
||||
<text macro="issued-date"/>
|
||||
</if>
|
||||
<else>
|
||||
<text macro="issued-year"/>
|
||||
</else>
|
||||
</choose>
|
||||
<text variable="volume"/>
|
||||
</group>
|
||||
<text variable="issue" prefix="(" suffix=")"/>
|
||||
</group>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
<text macro="accessed-date"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 题名 -->
|
||||
<macro name="title">
|
||||
<group delimiter=", ">
|
||||
<group delimiter=": ">
|
||||
<text variable="title"/>
|
||||
<group delimiter=" ">
|
||||
<choose>
|
||||
<if variable="container-title" type="paper-conference" match="none">
|
||||
<text macro="book-volume"/>
|
||||
</if>
|
||||
</choose>
|
||||
<choose>
|
||||
<if type="bill legal_case legislation patent regulation report standard" match="any">
|
||||
<text variable="number"/>
|
||||
</if>
|
||||
</choose>
|
||||
</group>
|
||||
</group>
|
||||
<choose>
|
||||
<if variable="container-title" type="paper-conference" match="none">
|
||||
<choose>
|
||||
<if variable="event-date">
|
||||
<text variable="event-place"/>
|
||||
<date variable="event-date" form="text"/>
|
||||
</if>
|
||||
</choose>
|
||||
</if>
|
||||
</choose>
|
||||
</group>
|
||||
<text macro="type-code" prefix="[" suffix="]"/>
|
||||
</macro>
|
||||
<!-- 文献类型标识 -->
|
||||
<macro name="type-code">
|
||||
<group delimiter="/">
|
||||
<choose>
|
||||
<if type="article">
|
||||
<choose>
|
||||
<if variable="archive">
|
||||
<text value="A"/>
|
||||
</if>
|
||||
<else>
|
||||
<text value="M"/>
|
||||
</else>
|
||||
</choose>
|
||||
</if>
|
||||
<else-if type="article-journal article-magazine periodical" match="any">
|
||||
<text value="J"/>
|
||||
</else-if>
|
||||
<else-if type="article-newspaper">
|
||||
<text value="N"/>
|
||||
</else-if>
|
||||
<else-if type="bill collection legal_case legislation regulation" match="any">
|
||||
<text value="A"/>
|
||||
</else-if>
|
||||
<else-if type="book chapter" match="any">
|
||||
<text value="M"/>
|
||||
</else-if>
|
||||
<else-if type="dataset">
|
||||
<text value="DS"/>
|
||||
</else-if>
|
||||
<else-if type="map">
|
||||
<text value="CM"/>
|
||||
</else-if>
|
||||
<else-if type="paper-conference">
|
||||
<text value="C"/>
|
||||
</else-if>
|
||||
<else-if type="patent">
|
||||
<text value="P"/>
|
||||
</else-if>
|
||||
<else-if type="post post-weblog webpage" match="any">
|
||||
<text value="EB"/>
|
||||
</else-if>
|
||||
<else-if type="report">
|
||||
<text value="R"/>
|
||||
</else-if>
|
||||
<else-if type="software">
|
||||
<text value="CP"/>
|
||||
</else-if>
|
||||
<else-if type="standard">
|
||||
<text value="S"/>
|
||||
</else-if>
|
||||
<else-if type="thesis">
|
||||
<text value="D"/>
|
||||
</else-if>
|
||||
<else>
|
||||
<text value="Z"/>
|
||||
</else>
|
||||
</choose>
|
||||
<choose>
|
||||
<if variable="URL DOI" match="any">
|
||||
<text value="OL"/>
|
||||
</if>
|
||||
</choose>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 获取和访问路径以及 DOI -->
|
||||
<macro name="url-doi">
|
||||
<group delimiter=". ">
|
||||
<text variable="URL"/>
|
||||
<text variable="DOI" prefix="DOI:"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 连续出版物的年卷期 -->
|
||||
<macro name="year-volume-issue">
|
||||
<group>
|
||||
<group delimiter=", ">
|
||||
<text macro="issued-year"/>
|
||||
<text variable="volume"/>
|
||||
</group>
|
||||
<text variable="issue" prefix="(" suffix=")"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 专著和电子资源 -->
|
||||
<macro name="monograph-layout">
|
||||
<group delimiter=". " suffix=".">
|
||||
<text macro="author"/>
|
||||
<text macro="title"/>
|
||||
<text macro="secondary-contributor"/>
|
||||
<text macro="edition"/>
|
||||
<text macro="publishing"/>
|
||||
<text macro="url-doi"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 专著中的析出文献 -->
|
||||
<macro name="chapter-in-book-layout">
|
||||
<group delimiter=". " suffix=".">
|
||||
<text macro="author"/>
|
||||
<group delimiter="//">
|
||||
<group delimiter=". ">
|
||||
<text macro="title"/>
|
||||
<text macro="secondary-contributor"/>
|
||||
</group>
|
||||
<group delimiter=". ">
|
||||
<text macro="container-author"/>
|
||||
<text macro="container-title"/>
|
||||
</group>
|
||||
</group>
|
||||
<text macro="edition"/>
|
||||
<text macro="publishing"/>
|
||||
<text macro="url-doi"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 连续出版物 -->
|
||||
<macro name="serial-layout">
|
||||
<group delimiter=". " suffix=".">
|
||||
<text macro="author"/>
|
||||
<text macro="title"/>
|
||||
<text macro="year-volume-issue"/>
|
||||
<text macro="publishing"/>
|
||||
<text variable="URL"/>
|
||||
<text variable="DOI" prefix="DOI:"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 连续出版物中的析出文献 -->
|
||||
<macro name="article-in-periodical-layout">
|
||||
<group delimiter=". " suffix=".">
|
||||
<text macro="author"/>
|
||||
<text macro="title"/>
|
||||
<text macro="periodical-publishing"/>
|
||||
<text macro="url-doi"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 专利文献 -->
|
||||
<macro name="patent-layout">
|
||||
<group delimiter=". " suffix=".">
|
||||
<text macro="author"/>
|
||||
<text macro="title"/>
|
||||
<group>
|
||||
<text macro="issued-date"/>
|
||||
<text macro="accessed-date"/>
|
||||
</group>
|
||||
<text macro="url-doi"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 正文中引用的文献标注格式 -->
|
||||
<macro name="citation-layout">
|
||||
<group>
|
||||
<text variable="citation-number"/>
|
||||
</group>
|
||||
</macro>
|
||||
<!-- 参考文献表格式 -->
|
||||
<macro name="entry-layout">
|
||||
<choose>
|
||||
<if type="article-journal article-magazine article-newspaper" match="any">
|
||||
<text macro="article-in-periodical-layout"/>
|
||||
</if>
|
||||
<else-if type="periodical">
|
||||
<text macro="serial-layout"/>
|
||||
</else-if>
|
||||
<else-if type="patent">
|
||||
<text macro="patent-layout"/>
|
||||
</else-if>
|
||||
<else-if type="paper-conference" variable="container-title" match="any">
|
||||
<text macro="chapter-in-book-layout"/>
|
||||
</else-if>
|
||||
<else>
|
||||
<text macro="monograph-layout"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<citation collapse="citation-number" after-collapse-delimiter=",">
|
||||
<layout vertical-align="sup" delimiter="," prefix="[" suffix="]">
|
||||
<text macro="citation-layout"/>
|
||||
</layout>
|
||||
</citation>
|
||||
<bibliography entry-spacing="0" et-al-min="4" et-al-use-first="3" second-field-align="flush">
|
||||
<!-- 取消这部分注释可以使用 CSL-M 的功能支持双语 -->
|
||||
<!-- <layout locale="en"><text variable="citation-number" prefix="[" suffix="]"/><text macro="entry-layout"/></layout> -->
|
||||
<layout>
|
||||
<text variable="citation-number" prefix="[" suffix="]"/>
|
||||
<text macro="entry-layout"/>
|
||||
</layout>
|
||||
</bibliography>
|
||||
</style>
|
|
@ -1,240 +0,0 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Academic Letter LaTeX and RMarkdown Structure %
|
||||
% Author: Pedro Henrique Pereira Braga %
|
||||
% %
|
||||
% License: %
|
||||
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/) %
|
||||
% %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Set the font size (11pt, for now) and paper size (e.g. letterpaper, a4paper)
|
||||
\documentclass[11pt, letterpaper]{letter}
|
||||
|
||||
%----------------------------------------------------------------------
|
||||
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
|
||||
%----------------------------------------------------------------------
|
||||
|
||||
\usepackage{graphicx} % Required for including pictures
|
||||
\usepackage{fancyhdr} % Allows the use of fancy headers and footers
|
||||
|
||||
\usepackage{microtype} % For typography improvement
|
||||
|
||||
\usepackage{url} % Allows the use of hyperlinks
|
||||
\urlstyle{same} % Allows hyperlink fonts to be the same as the mainfont
|
||||
\usepackage[hidelinks]{hyperref} % Allows the use of hyperlinks and
|
||||
% removes the blue boxes around the link
|
||||
|
||||
\pagestyle{empty} % Removes headers and footers
|
||||
|
||||
\usepackage{setspace} % Allows the use of double spacing in the letter body
|
||||
|
||||
\setlength\parindent{1cm} % Paragraph indentation
|
||||
|
||||
% Create a new command for the horizontal rule in the document which allows
|
||||
% thickness specification
|
||||
\makeatletter
|
||||
\def\@texttop{} % force the address to start above
|
||||
\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress
|
||||
\thispagestyle{firstpage}%
|
||||
{\raggedleft\@date\par}%
|
||||
\else % home address
|
||||
\thispagestyle{empty}%
|
||||
{\raggedleft\begin{tabular}{l@{}}\ignorespaces
|
||||
\fromaddress \\*[2\parskip]%
|
||||
\@date \end{tabular}\par}%
|
||||
\fi
|
||||
%\vspace{2\parskip}% <-- Removed
|
||||
%{\raggedright \toname \\ \toaddress \par}% <-- Removed
|
||||
%\vspace{2\parskip}% <-- Removed
|
||||
#1\par\nobreak}
|
||||
\let\ps@empty\ps@plain
|
||||
\let\ps@firstpage\ps@plain
|
||||
\makeatother
|
||||
|
||||
%--------------------------------------------------------------------------
|
||||
% FONTS
|
||||
%--------------------------------------------------------------------------
|
||||
|
||||
\usepackage[T1]{fontenc} % Output font encoding for international characters
|
||||
% \usepackage[utf8]{inputenc} % Required for inputting international characters
|
||||
\usepackage[quiet]{fontspec} % Allows the use of fontspec
|
||||
\setmainfont{Calibri}
|
||||
% \usepackage{txfonts} % Allows the use of Lato fonts
|
||||
|
||||
|
||||
%----------------------------------------------------------------------------
|
||||
% DOCUMENT MARGINS
|
||||
%----------------------------------------------------------------------------
|
||||
|
||||
\usepackage{geometry} % Required for adjusting page dimensions
|
||||
|
||||
\geometry{
|
||||
headheight = 0.7in, % Header height
|
||||
top=1.5in, % Top margin
|
||||
bottom=1.5cm, % Bottom margin
|
||||
left=3cm, % Left margin
|
||||
right=3cm, % Right margin
|
||||
% showframe, % Uncomment to show how the type block is set on the page
|
||||
}
|
||||
|
||||
%-----------------------------------------------------------------------------
|
||||
% AUTHOR AND RECIPIENTS NEW COMMANDS AND DETAILS STRUCTURE
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
\newcommand{\authordetails}[1]{\renewcommand{\authordetails}{#1}}
|
||||
\newcommand{\recipientdetails}[1]{\renewcommand{\recipientdetails}{#1}}
|
||||
|
||||
%-----------------------------------------------------------------------------
|
||||
% HEADER STRUCTURE
|
||||
%-----------------------------------------------------------------------------
|
||||
|
||||
\address{
|
||||
% Include the author's details on the right side of the page under the line
|
||||
\raggedleft{
|
||||
\footnotesize{ % Use a smaller font size
|
||||
$author$\\ % Author name
|
||||
\authordetails\\
|
||||
\hspace{1mm}
|
||||
}
|
||||
}
|
||||
\vspace{-0.05\textheight} % Move the date and letter content up
|
||||
}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% COMPOSE THE ENTIRE HEADER
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\renewcommand{\opening}[1]{
|
||||
{\fromaddress
|
||||
\vspace{0.05\textheight}\\ % Print the sender's address here and add some whitespace to allow the printing of the date
|
||||
\raggedleft{$date$} % Include the date, aligned to the right
|
||||
\par % par
|
||||
}
|
||||
{\raggedright
|
||||
\toname\\
|
||||
\toaddress
|
||||
\par} % Print the recipient's name and adress
|
||||
\vspace{0.25cm} % White vertical space after recipient's address
|
||||
\noindent #1 % Following this, insert the opening info
|
||||
}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% SIGNATURE STRUCTURE
|
||||
%------------------------------------------------------------------------------
|
||||
% The signature is a combination of the author's name, title and institution
|
||||
\signature{$author$, on behalf of all authors\\
|
||||
Email: $from_email$}
|
||||
|
||||
% I will later combine the option of inserting a signature within it
|
||||
|
||||
\renewcommand{\closing}[1]{
|
||||
\vspace{2.5mm} % Some whitespace after the letter content and before the signature
|
||||
\noindent % Stop paragraph indentation
|
||||
% \hspace*{\longindentation} % Move the signature right to the value of \longindentation
|
||||
\parbox{\indentedwidth}{
|
||||
\raggedright
|
||||
#1 % Print the signature text
|
||||
% \vskip 1.65cm % Whitespace between the closing text and author's name for a physical signature
|
||||
\\\includegraphics[height=0.6in, keepaspectratio=true]{$from_sign$}\\
|
||||
\fromsig % Prints the value of \signature{}, i.e. author name and title
|
||||
}
|
||||
}
|
||||
|
||||
%-------------------------------------------------------------------------------
|
||||
% AUTHOR'S INFORMATION
|
||||
%-------------------------------------------------------------------------------
|
||||
|
||||
\authordetails{
|
||||
$from_position$\\
|
||||
$from_department$\\ % Sender's department/institution
|
||||
$from_institution$\\
|
||||
$from_address$ % Sender's address
|
||||
% $from_city$, $from_state_province$\\ % Sender's city, state or province,
|
||||
% $from_postalcode$\\ % postal code
|
||||
% $from_country$
|
||||
}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% RECIPIENT'S INFORMATION
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\recipientdetails{
|
||||
$to_professional_title$ $to_name$\\
|
||||
$if(to_journal)$
|
||||
\textit{$to_journal$}
|
||||
$endif$
|
||||
}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% HEADER CONTENTS
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\fancypagestyle{firstpage}{
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{
|
||||
\includegraphics[height=0.6in, keepaspectratio=true]{$from_institution_logo$}
|
||||
}
|
||||
\fancyhead[R]{$author$\\
|
||||
\footnotesize{
|
||||
$from_email$\\ % Sender's email address
|
||||
% $from_personal_website$ \\ % Sender's URL
|
||||
$from_phone$ % Sender's phone number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\fancypagestyle{plain}{
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{
|
||||
\includegraphics[height=0.6in, keepaspectratio=true]{$from_institution_logo$}
|
||||
}
|
||||
\fancyhead[R]{$author$\\
|
||||
\footnotesize{
|
||||
$from_email$\\ % Sender's email address
|
||||
% $from_personal_website$ \\ % Sender's URL
|
||||
$from_phone$ % Sender's phone number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\fancypagestyle{empty}{
|
||||
\fancyhf{}
|
||||
\fancyhead[L]{
|
||||
\includegraphics[height=0.6in, keepaspectratio=true]{$from_institution_logo$}
|
||||
}
|
||||
\fancyhead[R]{$author$\\
|
||||
\footnotesize{
|
||||
$from_email$\\ % Sender's email address
|
||||
% $from_personal_website$ \\ % Sender's URL
|
||||
$from_phone$ % Sender's phone number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
\pagestyle{plain}
|
||||
|
||||
\begin{document}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% TO ADDRESS
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\begin{letter}{\recipientdetails}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
% LETTER CONTENT
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\opening{$opening_greeting$}
|
||||
% \begin{doublespacing}
|
||||
|
||||
$body$
|
||||
|
||||
% \end{doublespacing}
|
||||
\closing{$closing_greeting$}
|
||||
|
||||
%------------------------------------------------------------------------------
|
||||
|
||||
\end{letter}
|
||||
\end{document}
|
|
@ -1,426 +0,0 @@
|
|||
$-- Keeping in template layout for backward compatibility
|
||||
\documentclass[$if(layout)$$layout$$else$$for(classoption)$$classoption$$sep$,$endfor$$endif$]{elsarticle} %review=doublespace preprint=single 5p=2 column
|
||||
%%% Begin My package additions %%%%%%%%%%%%%%%%%%%
|
||||
\usepackage[hyphens]{url}
|
||||
$if(journal)$
|
||||
\journal{$journal$} % Sets Journal name
|
||||
$endif$
|
||||
\usepackage{lineno} % add
|
||||
$if(linenumbers)$
|
||||
\linenumbers % turns line numbering on
|
||||
$endif$
|
||||
\usepackage{graphicx}
|
||||
\usepackage{xstring}
|
||||
\usepackage[table]{xcolor}
|
||||
%%%%%%%%%%%%%%%% end my additions to header
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lmodern}
|
||||
\usepackage{amssymb,amsmath}
|
||||
\usepackage{ifxetex,ifluatex}
|
||||
\usepackage{fixltx2e} % provides \textsubscript
|
||||
% use upquote if available, for straight quotes in verbatim environments
|
||||
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||
\usepackage[utf8]{inputenc}
|
||||
$if(euro)$
|
||||
\usepackage{eurosym}
|
||||
$endif$
|
||||
\else % if luatex or xelatex
|
||||
\usepackage{fontspec}
|
||||
\ifxetex
|
||||
\usepackage{xltxtra,xunicode}
|
||||
\fi
|
||||
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
|
||||
\newcommand{\euro}{€}
|
||||
$if(mainfont)$
|
||||
\setmainfont{$mainfont$}
|
||||
$endif$
|
||||
$if(sansfont)$
|
||||
\setsansfont{$sansfont$}
|
||||
$endif$
|
||||
$if(monofont)$
|
||||
\setmonofont{$monofont$}
|
||||
$endif$
|
||||
$if(mathfont)$
|
||||
\setmathfont{$mathfont$}
|
||||
$endif$
|
||||
\fi
|
||||
% use microtype if available
|
||||
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
|
||||
$if(geometry)$
|
||||
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
|
||||
$endif$
|
||||
$if(natbib)$
|
||||
\usepackage{natbib}
|
||||
\setcitestyle{$natbiboptions$}
|
||||
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
|
||||
$endif$
|
||||
$if(listings)$
|
||||
\usepackage{listings}
|
||||
$endif$
|
||||
$if(lhs)$
|
||||
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
|
||||
$endif$
|
||||
$if(verbatim-in-note)$
|
||||
\usepackage{fancyvrb}
|
||||
$endif$
|
||||
$if(graphics)$
|
||||
\usepackage{graphicx}
|
||||
$endif$
|
||||
\ifxetex
|
||||
\usepackage[setpagesize=false, % page size defined by xetex
|
||||
unicode=false, % unicode breaks when used with xetex
|
||||
xetex]{hyperref}
|
||||
\else
|
||||
\usepackage[unicode=true]{hyperref}
|
||||
\fi
|
||||
\hypersetup{breaklinks=true,
|
||||
bookmarks=true,
|
||||
pdfauthor={$author-meta$},
|
||||
pdftitle={$title-meta$},
|
||||
colorlinks=$if(colorlinks)$true$else$false$endif$,
|
||||
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
|
||||
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
|
||||
pdfborder={0 0 0}}
|
||||
\urlstyle{same} % don't use monospace font for urls
|
||||
$if(links-as-notes)$
|
||||
% Make links footnotes instead of hotlinks:
|
||||
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
|
||||
$endif$
|
||||
$if(strikeout)$
|
||||
\usepackage[normalem]{ulem}
|
||||
% avoid problems with \sout in headers with hyperref:
|
||||
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
|
||||
$endif$
|
||||
$if(numbersections)$
|
||||
\setcounter{secnumdepth}{5}
|
||||
$else$
|
||||
\setcounter{secnumdepth}{0}
|
||||
$endif$
|
||||
$if(verbatim-in-note)$
|
||||
\VerbatimFootnotes % allows verbatim text in footnotes
|
||||
$endif$
|
||||
$if(lang)$
|
||||
\ifxetex
|
||||
\usepackage{polyglossia}
|
||||
\setmainlanguage{$mainlang$}
|
||||
\else
|
||||
\usepackage[$lang$]{babel}
|
||||
\fi
|
||||
$endif$
|
||||
% Pandoc toggle for numbering sections (defaults to be off)
|
||||
$if(numbersections)$
|
||||
$else$
|
||||
\setcounter{secnumdepth}{0}
|
||||
$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$
|
||||
$for(header-includes)$
|
||||
$header-includes$
|
||||
$endfor$
|
||||
|
||||
\usepackage{xifthen}
|
||||
% set special color for EST
|
||||
\ifthenelse{\equal{$journal$}{Environmental Science \& Technology}}
|
||||
{\definecolor{seccol}{RGB}{56, 95, 66}}
|
||||
{\definecolor{seccol}{RGB}{0, 0, 0}}
|
||||
|
||||
$if(uppersections)$
|
||||
\usepackage{titlesec}
|
||||
\titleformat{\section}
|
||||
{\color{seccol}\large\bfseries\MakeUppercase}{\thesection}{1em}{}
|
||||
$endif$
|
||||
$if(sectiononnewpage)$
|
||||
\AddToHook{cmd/section/before}{\clearpage}
|
||||
$endif$
|
||||
|
||||
\usepackage{enumitem}
|
||||
\usepackage{fontspec}
|
||||
\usepackage{float}
|
||||
\setmainfont{Helvetica}
|
||||
\usepackage[normalem]{ulem}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{nameref} %needed by zref-xr
|
||||
\usepackage{zref-xr,zref-hyperref,zref-user}
|
||||
\usepackage{xr-hyper}
|
||||
|
||||
% force to use \zref
|
||||
$if(msname)$
|
||||
\def\msname{$msname$}
|
||||
\zexternaldocument*{\msname}
|
||||
\renewcommand{\ref}{\zref}
|
||||
$endif$
|
||||
$if(smname)$
|
||||
\def\smname{$smname$}
|
||||
\zexternaldocument*{\smname}
|
||||
$endif$
|
||||
|
||||
\zxrsetup{toltxlabel=true}
|
||||
{\catcode`\#=12 \gdef\hashchar{#1}}
|
||||
\makeatletter
|
||||
\newcommand\hzref[1]{\edef\next{%
|
||||
\noexpand\href{%
|
||||
\zref@extractdefault{#1}{url}{}%
|
||||
\zref@ifrefcontainsprop{#1}{anchor}{%
|
||||
\hashchar\zref@extract{#1}{anchor}}{}}%
|
||||
{\noexpand\zref{#1}}}\next}
|
||||
\makeatother
|
||||
|
||||
|
||||
|
||||
$if(revision)$
|
||||
% \usepackage{xcolor}
|
||||
\usepackage{adjustbox}
|
||||
\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}
|
||||
\setenumerate{labelsep=*, leftmargin=1.0pc}
|
||||
% setup hyperlink for page and line number
|
||||
\def\msname{$if(msname)$$msname$$else$MS$endif$}
|
||||
\def\smname{$if(smname)$$smname$$else$SM$endif$}
|
||||
\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}}
|
||||
$endif$
|
||||
|
||||
% def default corresponding authors and equal contributing authors variables
|
||||
\def\hascorr{0}
|
||||
\def\haseqc{0}
|
||||
% check if corresponding author(s) and equal contributing authors are available
|
||||
$for(author)$$if(author.correspondence)$\def\hascorr{1}$endif$$if(author.equalcontribution)$\def\haseqc{1}$endif$ $endfor$
|
||||
|
||||
\newcommand{\getcorrauthinfo}{
|
||||
\subsection{Corresponding Author(s)}
|
||||
\def\a{} \def\b{} \def\c{}
|
||||
\hspace{-2.2em}
|
||||
$for(author)$
|
||||
$if(author.correspondence)$
|
||||
\textbf{$author.name$:}
|
||||
\vspace{-1em}
|
||||
\begin{enumerate}[labelindent=-12pt,label=\arabic*.,itemindent=0em,leftmargin=!, itemsep = -10pt]
|
||||
$for(author.institute)$ \def\a{$author.institute$}
|
||||
$for(institute)$ \def\b{$institute.id$} \def\c{$institute.name$}
|
||||
\ifx \a\b \item \c; \fi
|
||||
$endfor$
|
||||
$endfor$
|
||||
$if(author.email)$\item email: $author.email$;$endif$
|
||||
$if(author.orcid)$\item orcid: $author.orcid$;$endif$
|
||||
$if(author.tel)$\item Tel: $author.tel$;$endif$
|
||||
$if(author.fax)$\item Fax: $author.fax$$endif$
|
||||
\end{enumerate}
|
||||
$endif$
|
||||
$endfor$
|
||||
}
|
||||
|
||||
\newcommand{\getotherauthinfo}{
|
||||
\subsection{Author(s)}
|
||||
\def\a{} \def\b{} \def\c{}
|
||||
\hspace{-2.2em}
|
||||
$for(author)$
|
||||
$if(author.correspondence)$
|
||||
$else$
|
||||
\textbf{$author.name$:}
|
||||
\vspace{-1em}
|
||||
\begin{enumerate}[labelindent=-12pt,label=\arabic*.,itemindent=0em,leftmargin=!, itemsep = -10pt]
|
||||
$for(author.institute)$ \def\a{$author.institute$} $for(institute)$ \def\b{$institute.id$} \def\c{$institute.name$}
|
||||
\ifx \a\b \item \c; \fi
|
||||
$endfor$
|
||||
$endfor$
|
||||
$if(author.email)$\item email: $author.email$;$endif$
|
||||
$if(author.orcid)$\item orcid: $author.orcid$;$endif$
|
||||
$if(author.tel)$\item Tel: $author.tel$;$endif$
|
||||
$if(author.fax)$\item Fax: $author.fax$$endif$
|
||||
\end{enumerate}
|
||||
$endif$
|
||||
$endfor$
|
||||
}
|
||||
|
||||
$preamble$
|
||||
|
||||
% remove the two line around Abstract
|
||||
$if(abstract)$
|
||||
$else$
|
||||
\makeatletter
|
||||
\renewcommand{\MaketitleBox}{%
|
||||
\resetTitleCounters
|
||||
\def\baselinestretch{1}%
|
||||
\begin{center}
|
||||
\def\baselinestretch{1}%
|
||||
\large \@title \par
|
||||
\vskip 18pt
|
||||
\normalsize\elsauthors \par
|
||||
\vskip 30pt
|
||||
\footnotesize \itshape \elsaddress \par
|
||||
\end{center}
|
||||
\vskip 12pt
|
||||
}
|
||||
\makeatother
|
||||
$endif$
|
||||
|
||||
\begin{document}
|
||||
$for(include-before)$
|
||||
$include-before$
|
||||
$endfor$
|
||||
\begin{frontmatter}
|
||||
|
||||
\title{$title$$if(subtitle)$\\\Large{$subtitle$}$endif$}
|
||||
$for(author)$\author$if(authorwithinstitute)$[$for(author.institute)$$author.institute$$sep$,$endfor$]$endif${$author.name$$if(author.correspondence)$\corref{corrauth}$endif$$if(author.equalcontribution)$\corref{eqcon}$endif$ $if(author.footnote)$\fnref{$author.footnote$}$endif$}$if(author.email)$\ead{$author.email$}$endif$$endfor$
|
||||
$if(authorwithinstitute)$ $for(institute)$ \address[$institute.id$]{$institute.name$} $endfor$ $endif$
|
||||
% generate corresponding authors.
|
||||
% \StrBehind is from xstring package
|
||||
\ifnum \hascorr=1
|
||||
\def\corrauths{
|
||||
$for(author)$$if(author.correspondence)$and $author.name$ ($author.email$) $endif$$endfor$}
|
||||
\cortext[corrauth]{Corresponding to \StrBehind*{\corrauths}{and }.}
|
||||
\fi
|
||||
|
||||
% generate equal contributing authors.
|
||||
\ifnum \haseqc=1
|
||||
\def\eqa{$for(author)$$if(author.equalcontribution)$and $author.name$ $endif$$endfor$}
|
||||
\cortext[eqcon]{\StrBehind*{\eqa}{and } are equally contributed to this work.}
|
||||
\fi
|
||||
|
||||
$for(footnote)$
|
||||
\fntext[$footnote.id$]{$footnote.text$}
|
||||
$endfor$
|
||||
|
||||
$if(abstract)$
|
||||
\begin{abstract}
|
||||
$abstract$
|
||||
\end{abstract}
|
||||
$if(keywords)$
|
||||
\begin{keyword}
|
||||
$for(keywords/allbutlast)$$keywords$ \sep $endfor$
|
||||
$for(keywords/last)$$keywords$$endfor$
|
||||
\end{keyword}
|
||||
$endif$
|
||||
$endif$
|
||||
\end{frontmatter}
|
||||
|
||||
$body$
|
||||
|
||||
$if(authorwithinstitute)$
|
||||
$else$
|
||||
\section{Author Information}
|
||||
|
||||
\getcorrauthinfo{}
|
||||
|
||||
\getotherauthinfo{}
|
||||
|
||||
$endif$
|
||||
|
||||
|
||||
$if(natbib)$
|
||||
$if(bibliography)$
|
||||
$if(biblio-title)$
|
||||
$if(book-class)$
|
||||
\renewcommand\bibname{$biblio-title$}
|
||||
$else$
|
||||
\renewcommand\refname{$biblio-title$}
|
||||
$endif$
|
||||
$endif$
|
||||
\bibliography{$bibliography$}
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$for(include-after)$
|
||||
$include-after$
|
||||
$endfor$
|
||||
\end{document}
|
|
@ -1,239 +0,0 @@
|
|||
<?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>2014-03-04T00:09:00+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>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-GB">
|
||||
<!-- Generated with https://github.com/citation-style-language/utilities/tree/master/generate_dependent_styles/data/npg -->
|
||||
<info>
|
||||
<title>Nature Biotechnology</title>
|
||||
<id>http://www.zotero.org/styles/nature-biotechnology</id>
|
||||
<link href="http://www.zotero.org/styles/nature-biotechnology" rel="self"/>
|
||||
<link href="http://www.zotero.org/styles/nature" rel="independent-parent"/>
|
||||
<link href="http://www.nature.com/nbt/pdf/gta.pdf" rel="documentation"/>
|
||||
<category citation-format="numeric"/>
|
||||
<category field="biology"/>
|
||||
<issn>1087-0156</issn>
|
||||
<eissn>1546-1696</eissn>
|
||||
<updated>2014-06-17T02:29:16+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>
|
|
@ -1,154 +0,0 @@
|
|||
<?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="sort-only" default-locale="en-GB">
|
||||
<info>
|
||||
<title>Nature</title>
|
||||
<id>http://www.zotero.org/styles/nature</id>
|
||||
<link href="http://www.zotero.org/styles/nature" rel="self"/>
|
||||
<link href="http://www.nature.com/nature/authors/gta/index.html#a5.4" rel="documentation"/>
|
||||
<link href="http://www.nature.com/srep/publish/guidelines#references" rel="documentation"/>
|
||||
<author>
|
||||
<name>Michael Berkowitz</name>
|
||||
<email>mberkowi@gmu.edu</email>
|
||||
</author>
|
||||
<category citation-format="numeric"/>
|
||||
<category field="science"/>
|
||||
<category field="generic-base"/>
|
||||
<issn>0028-0836</issn>
|
||||
<eissn>1476-4687</eissn>
|
||||
<updated>2022-07-02T13:18:26+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="title">
|
||||
<choose>
|
||||
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
|
||||
<text variable="title" font-style="italic"/>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="title"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="author">
|
||||
<names variable="author">
|
||||
<name sort-separator=", " delimiter=", " and="symbol" initialize-with=". " delimiter-precedes-last="never" name-as-sort-order="all"/>
|
||||
<label form="short" prefix=", "/>
|
||||
<et-al font-style="italic"/>
|
||||
</names>
|
||||
</macro>
|
||||
<macro name="access">
|
||||
<choose>
|
||||
<if variable="volume" type="article" match="any"/>
|
||||
<else-if variable="DOI">
|
||||
<text variable="DOI" prefix="doi:"/>
|
||||
</else-if>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="issuance">
|
||||
<choose>
|
||||
<if type="bill book graphic legal_case legislation motion_picture song thesis chapter paper-conference" match="any">
|
||||
<group delimiter="; " suffix=".">
|
||||
<group delimiter=", " prefix="(" suffix=")">
|
||||
<text variable="publisher" form="long"/>
|
||||
<date variable="issued">
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</group>
|
||||
</group>
|
||||
</if>
|
||||
<else-if type="article">
|
||||
<group delimiter=" ">
|
||||
<choose>
|
||||
<if variable="genre" match="any">
|
||||
<text variable="genre" text-case="capitalize-first"/>
|
||||
</if>
|
||||
<else>
|
||||
<text term="article" text-case="capitalize-first"/>
|
||||
</else>
|
||||
</choose>
|
||||
<text term="at"/>
|
||||
<choose>
|
||||
<if variable="DOI" match="any">
|
||||
<text variable="DOI" prefix="https://doi.org/"/>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="URL"/>
|
||||
</else>
|
||||
</choose>
|
||||
<date date-parts="year" form="text" variable="issued" prefix="(" suffix=")"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="report webpage post post-weblog" match="any">
|
||||
<group delimiter=" ">
|
||||
<text variable="URL"/>
|
||||
<date date-parts="year" form="text" variable="issued" prefix="(" suffix=")"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else>
|
||||
<date variable="issued" prefix="(" suffix=")">
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="container-title">
|
||||
<choose>
|
||||
<if type="article-journal">
|
||||
<text variable="container-title" font-style="italic" form="short"/>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="editor">
|
||||
<choose>
|
||||
<if type="chapter paper-conference" match="any">
|
||||
<names variable="editor" prefix="(" suffix=")">
|
||||
<label form="short" suffix=" "/>
|
||||
<name and="symbol" delimiter-precedes-last="never" initialize-with=". " name-as-sort-order="all"/>
|
||||
</names>
|
||||
</if>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="volume">
|
||||
<choose>
|
||||
<if type="article-journal" match="any">
|
||||
<text variable="volume" font-weight="bold" suffix=","/>
|
||||
</if>
|
||||
<else>
|
||||
<group delimiter=" ">
|
||||
<label variable="volume" form="short"/>
|
||||
<text variable="volume"/>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<citation collapse="citation-number">
|
||||
<sort>
|
||||
<key variable="citation-number"/>
|
||||
</sort>
|
||||
<layout vertical-align="sup" delimiter=",">
|
||||
<text variable="citation-number"/>
|
||||
</layout>
|
||||
</citation>
|
||||
<bibliography et-al-min="6" et-al-use-first="1" second-field-align="flush" entry-spacing="0" line-spacing="2">
|
||||
<layout suffix=".">
|
||||
<text variable="citation-number" suffix="."/>
|
||||
<group delimiter=" ">
|
||||
<text macro="author" suffix="."/>
|
||||
<text macro="title" suffix="."/>
|
||||
<choose>
|
||||
<if type="chapter paper-conference" match="any">
|
||||
<text term="in"/>
|
||||
</if>
|
||||
</choose>
|
||||
<text macro="container-title"/>
|
||||
<text macro="editor"/>
|
||||
<text macro="volume"/>
|
||||
<text variable="page"/>
|
||||
<text macro="issuance"/>
|
||||
<text macro="access"/>
|
||||
</group>
|
||||
</layout>
|
||||
</bibliography>
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,432 +0,0 @@
|
|||
$-- Keeping in template layout for backward compatibility
|
||||
\documentclass[$if(layout)$$layout$$else$$for(classoption)$$classoption$$sep$,$endfor$$endif$]{_extensions/inst/tex/supp} %review=doublespace preprint=single 5p=2 column
|
||||
%%% Begin My package additions %%%%%%%%%%%%%%%%%%%
|
||||
\usepackage[hyphens]{url}
|
||||
$if(journal)$
|
||||
\journal{$journal$} % Sets Journal name
|
||||
$endif$
|
||||
\usepackage{lineno} % add
|
||||
$if(linenumbers)$
|
||||
\linenumbers % turns line numbering on
|
||||
$endif$
|
||||
\usepackage{graphicx}
|
||||
\usepackage{xstring}
|
||||
\usepackage{xcolor}
|
||||
%%%%%%%%%%%%%%%% end my additions to header
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lmodern}
|
||||
\usepackage{amssymb,amsmath}
|
||||
\usepackage{ifxetex,ifluatex}
|
||||
\usepackage{fixltx2e} % provides \textsubscript
|
||||
% use upquote if available, for straight quotes in verbatim environments
|
||||
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
|
||||
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||
\usepackage[utf8]{inputenc}
|
||||
$if(euro)$
|
||||
\usepackage{eurosym}
|
||||
$endif$
|
||||
\else % if luatex or xelatex
|
||||
\usepackage{fontspec}
|
||||
\ifxetex
|
||||
\usepackage{xltxtra,xunicode}
|
||||
\fi
|
||||
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
|
||||
\newcommand{\euro}{€}
|
||||
$if(mainfont)$
|
||||
\setmainfont{$mainfont$}
|
||||
$endif$
|
||||
$if(sansfont)$
|
||||
\setsansfont{$sansfont$}
|
||||
$endif$
|
||||
$if(monofont)$
|
||||
\setmonofont{$monofont$}
|
||||
$endif$
|
||||
$if(mathfont)$
|
||||
\setmathfont{$mathfont$}
|
||||
$endif$
|
||||
\fi
|
||||
% use microtype if available
|
||||
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
|
||||
$if(geometry)$
|
||||
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
|
||||
$endif$
|
||||
$if(natbib)$
|
||||
\usepackage{natbib}
|
||||
\setcitestyle{$natbiboptions$}
|
||||
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
|
||||
$endif$
|
||||
$if(listings)$
|
||||
\usepackage{listings}
|
||||
$endif$
|
||||
$if(lhs)$
|
||||
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
|
||||
$endif$
|
||||
$if(verbatim-in-note)$
|
||||
\usepackage{fancyvrb}
|
||||
$endif$
|
||||
$if(graphics)$
|
||||
\usepackage{graphicx}
|
||||
$endif$
|
||||
\ifxetex
|
||||
\usepackage[setpagesize=false, % page size defined by xetex
|
||||
unicode=false, % unicode breaks when used with xetex
|
||||
xetex]{hyperref}
|
||||
\else
|
||||
\usepackage[unicode=true]{hyperref}
|
||||
\fi
|
||||
\hypersetup{breaklinks=true,
|
||||
bookmarks=true,
|
||||
pdfauthor={$author-meta$},
|
||||
pdftitle={$title-meta$},
|
||||
colorlinks=$if(colorlinks)$true$else$false$endif$,
|
||||
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
|
||||
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
|
||||
pdfborder={0 0 0}}
|
||||
\urlstyle{same} % don't use monospace font for urls
|
||||
$if(links-as-notes)$
|
||||
% Make links footnotes instead of hotlinks:
|
||||
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
|
||||
$endif$
|
||||
$if(strikeout)$
|
||||
\usepackage[normalem]{ulem}
|
||||
% avoid problems with \sout in headers with hyperref:
|
||||
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
|
||||
$endif$
|
||||
$if(numbersections)$
|
||||
\setcounter{secnumdepth}{5}
|
||||
$else$
|
||||
\setcounter{secnumdepth}{0}
|
||||
$endif$
|
||||
$if(verbatim-in-note)$
|
||||
\VerbatimFootnotes % allows verbatim text in footnotes
|
||||
$endif$
|
||||
$if(lang)$
|
||||
\ifxetex
|
||||
\usepackage{polyglossia}
|
||||
\setmainlanguage{$mainlang$}
|
||||
\else
|
||||
\usepackage[$lang$]{babel}
|
||||
\fi
|
||||
$endif$
|
||||
% Pandoc toggle for numbering sections (defaults to be off)
|
||||
$if(numbersections)$
|
||||
$else$
|
||||
\setcounter{secnumdepth}{0}
|
||||
$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$
|
||||
$for(header-includes)$
|
||||
$header-includes$
|
||||
$endfor$
|
||||
|
||||
|
||||
\usepackage{xifthen}
|
||||
% set special color for EST
|
||||
\ifthenelse{\equal{$journal$}{Environmental Science \& Technology}}
|
||||
{\definecolor{seccol}{RGB}{56, 95, 66}}
|
||||
{\definecolor{seccol}{RGB}{0, 0, 0}}
|
||||
|
||||
$if(uppersections)$
|
||||
\usepackage{titlesec}
|
||||
\titleformat{\section}
|
||||
{\color{seccol}\large\bfseries\MakeUppercase}{\thesection}{1em}{}
|
||||
$endif$
|
||||
$if(sectiononnewpage)$
|
||||
\AddToHook{cmd/section/before}{\clearpage}
|
||||
$endif$
|
||||
|
||||
\usepackage{enumitem}
|
||||
\usepackage{fontspec}
|
||||
\usepackage{float}
|
||||
\setmainfont{Helvetica}
|
||||
\usepackage[normalem]{ulem}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{nameref} %needed by zref-xr
|
||||
\usepackage{zref-xr,zref-hyperref,zref-user}
|
||||
\usepackage{xr-hyper}
|
||||
|
||||
% force to use \zref
|
||||
$if(msname)$
|
||||
\def\msname{$msname$}
|
||||
\zexternaldocument*{\msname}
|
||||
\renewcommand{\ref}{\zref}
|
||||
$endif$
|
||||
$if(smname)$
|
||||
\def\smname{$smname$}
|
||||
\zexternaldocument*{\smname}
|
||||
$endif$
|
||||
|
||||
\zxrsetup{toltxlabel=true}
|
||||
{\catcode`\#=12 \gdef\hashchar{#1}}
|
||||
\makeatletter
|
||||
\newcommand\hzref[1]{\edef\next{%
|
||||
\noexpand\href{%
|
||||
\zref@extractdefault{#1}{url}{}%
|
||||
\zref@ifrefcontainsprop{#1}{anchor}{%
|
||||
\hashchar\zref@extract{#1}{anchor}}{}}%
|
||||
{\noexpand\zref{#1}}}\next}
|
||||
\makeatother
|
||||
|
||||
|
||||
|
||||
$if(revision)$
|
||||
% \usepackage{xcolor}
|
||||
\usepackage{adjustbox}
|
||||
\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}
|
||||
\setenumerate{labelsep=*, leftmargin=1.0pc}
|
||||
% setup hyperlink for page and line number
|
||||
\def\msname{$if(msname)$$msname$$else$MS$endif$}
|
||||
\def\smname{$if(smname)$$smname$$else$SM$endif$}
|
||||
\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}}
|
||||
$endif$
|
||||
|
||||
|
||||
% def default corresponding authors and equal contributing authors variables
|
||||
\def\hascorr{0}
|
||||
\def\haseqc{0}
|
||||
% check if corresponding author(s) and equal contributing authors are available
|
||||
$for(author)$$if(author.correspondence)$\def\hascorr{1}$endif$$if(author.equalcontribution)$\def\haseqc{1}$endif$ $endfor$
|
||||
|
||||
\newcommand{\getcorrauthinfo}{
|
||||
\subsection{Corresponding Author(s)}
|
||||
\def\a{} \def\b{} \def\c{}
|
||||
\hspace{-2.2em}
|
||||
$for(author)$
|
||||
$if(author.correspondence)$
|
||||
\textbf{$author.name$:}
|
||||
\vspace{-1em}
|
||||
\begin{enumerate}[labelindent=-12pt,label=\arabic*.,itemindent=0em,leftmargin=!, itemsep = -10pt]
|
||||
$for(author.institute)$ \def\a{$author.institute$}
|
||||
$for(institute)$ \def\b{$institute.id$} \def\c{$institute.name$}
|
||||
\ifx \a\b \item \c; \fi
|
||||
$endfor$
|
||||
$endfor$
|
||||
$if(author.email)$\item email: $author.email$;$endif$
|
||||
$if(author.orcid)$\item orcid: $author.orcid$;$endif$
|
||||
$if(author.tel)$\item Tel: $author.tel$;$endif$
|
||||
$if(author.fax)$\item Fax: $author.fax$$endif$
|
||||
\end{enumerate}
|
||||
$endif$
|
||||
$endfor$
|
||||
}
|
||||
|
||||
\newcommand{\getotherauthinfo}{
|
||||
\subsection{Author(s)}
|
||||
\def\a{} \def\b{} \def\c{}
|
||||
\hspace{-2.2em}
|
||||
$for(author)$
|
||||
$if(author.correspondence)$
|
||||
$else$
|
||||
\textbf{$author.name$:}
|
||||
\vspace{-1em}
|
||||
\begin{enumerate}[labelindent=-12pt,label=\arabic*.,itemindent=0em,leftmargin=!, itemsep = -10pt]
|
||||
$for(author.institute)$ \def\a{$author.institute$} $for(institute)$ \def\b{$institute.id$} \def\c{$institute.name$}
|
||||
\ifx \a\b \item \c; \fi
|
||||
$endfor$
|
||||
$endfor$
|
||||
$if(author.email)$\item email: $author.email$;$endif$
|
||||
$if(author.orcid)$\item orcid: $author.orcid$;$endif$
|
||||
$if(author.tel)$\item Tel: $author.tel$;$endif$
|
||||
$if(author.fax)$\item Fax: $author.fax$$endif$
|
||||
\end{enumerate}
|
||||
$endif$
|
||||
$endfor$
|
||||
}
|
||||
|
||||
$preamble$
|
||||
|
||||
% remove the two line around Abstract
|
||||
$if(abstract)$
|
||||
$else$
|
||||
\makeatletter
|
||||
\renewcommand{\MaketitleBox}{%
|
||||
\resetTitleCounters
|
||||
\def\baselinestretch{1}%
|
||||
\begin{center}
|
||||
\def\baselinestretch{1}%
|
||||
\large \@title \par
|
||||
\vskip 18pt
|
||||
\normalsize\elsauthors \par
|
||||
\vskip 30pt
|
||||
\footnotesize \itshape \elsaddress \par
|
||||
\end{center}
|
||||
\vskip 12pt
|
||||
}
|
||||
\makeatother
|
||||
$endif$
|
||||
|
||||
\begin{document}
|
||||
$for(include-before)$
|
||||
$include-before$
|
||||
$endfor$
|
||||
\begin{frontmatter}
|
||||
|
||||
\title{$title$$if(subtitle)$\\\Large{$subtitle$}$endif$}
|
||||
$for(author)$\author$if(authorwithinstitute)$[$for(author.institute)$$author.institute$$sep$,$endfor$]$endif${$author.name$$if(author.correspondence)$\corref{corrauth}$endif$$if(author.equalcontribution)$\corref{eqcon}$endif$ $if(author.footnote)$\fnref{$author.footnote$}$endif$}$if(author.email)$\ead{$author.email$}$endif$$endfor$
|
||||
$if(authorwithinstitute)$ $for(institute)$ \address[$institute.id$]{$institute.name$} $endfor$ $endif$
|
||||
% generate corresponding authors.
|
||||
% \StrBehind is from xstring package
|
||||
\ifnum \hascorr=1
|
||||
\def\corrauths{
|
||||
$for(author)$$if(author.correspondence)$and $author.name$ ($author.email$) $endif$$endfor$}
|
||||
\cortext[corrauth]{Corresponding to \StrBehind*{\corrauths}{and }.}
|
||||
\fi
|
||||
|
||||
% generate equal contributing authors.
|
||||
\ifnum \haseqc=1
|
||||
\def\eqa{$for(author)$$if(author.equalcontribution)$and $author.name$ $endif$$endfor$}
|
||||
\cortext[eqcon]{\StrBehind*{\eqa}{and } are equally contributed to this work.}
|
||||
\fi
|
||||
|
||||
$for(footnote)$
|
||||
\fntext[$footnote.id$]{$footnote.text$}
|
||||
$endfor$
|
||||
|
||||
$if(abstract)$
|
||||
\begin{abstract}
|
||||
$abstract$
|
||||
\end{abstract}
|
||||
$if(keywords)$
|
||||
\begin{keyword}
|
||||
$for(keywords/allbutlast)$$keywords$ \sep $endfor$
|
||||
$for(keywords/last)$$keywords$$endfor$
|
||||
\end{keyword}
|
||||
$endif$
|
||||
$endif$
|
||||
\end{frontmatter}
|
||||
|
||||
$body$
|
||||
|
||||
$if(authorwithinstitute)$
|
||||
$else$
|
||||
\section{Author Information}
|
||||
|
||||
\getcorrauthinfo{}
|
||||
|
||||
\getotherauthinfo{}
|
||||
|
||||
\section{Notes}
|
||||
|
||||
The authors declare no competing financial interest.
|
||||
|
||||
$endif$
|
||||
|
||||
|
||||
$if(natbib)$
|
||||
$if(bibliography)$
|
||||
$if(biblio-title)$
|
||||
$if(book-class)$
|
||||
\renewcommand\bibname{$biblio-title$}
|
||||
$else$
|
||||
\renewcommand\refname{$biblio-title$}
|
||||
$endif$
|
||||
$endif$
|
||||
\bibliography{$bibliography$}
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$for(include-after)$
|
||||
$include-after$
|
||||
$endfor$
|
||||
\end{document}
|
|
@ -1,181 +0,0 @@
|
|||
<?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="sort-only" default-locale="en-GB">
|
||||
<info>
|
||||
<title>The ISME Journal</title>
|
||||
<id>http://www.zotero.org/styles/the-isme-journal</id>
|
||||
<link href="http://www.zotero.org/styles/the-isme-journal" rel="self"/>
|
||||
<link href="http://www.zotero.org/styles/journal-of-frailty-and-aging" rel="template"/>
|
||||
<link href="http://www.nature.com/ismej/ismej_new_gta.pdf" rel="documentation"/>
|
||||
<author>
|
||||
<name>Patrick O'Brien</name>
|
||||
<email>obrienpat86@gmail.com</email>
|
||||
</author>
|
||||
<category citation-format="numeric"/>
|
||||
<category field="biology"/>
|
||||
<issn>1751-7362</issn>
|
||||
<eissn>1751-7370</eissn>
|
||||
<summary>The ISME Journal style, which is not the same as for Nature</summary>
|
||||
<updated>2018-03-19T15:30:26+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="author">
|
||||
<names variable="author">
|
||||
<name sort-separator=" " initialize-with="" name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/>
|
||||
<label form="short" strip-periods="true" prefix=" (" suffix=")"/>
|
||||
<substitute>
|
||||
<names variable="editor"/>
|
||||
<names variable="translator"/>
|
||||
</substitute>
|
||||
</names>
|
||||
</macro>
|
||||
<macro name="editor">
|
||||
<text term="in" text-case="capitalize-first" suffix=": "/>
|
||||
<names variable="editor">
|
||||
<name sort-separator=" " initialize-with="" name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/>
|
||||
<label form="short" strip-periods="true" prefix=" (" suffix=")."/>
|
||||
</names>
|
||||
</macro>
|
||||
<macro name="edition">
|
||||
<choose>
|
||||
<if is-numeric="edition">
|
||||
<group delimiter=" ">
|
||||
<number variable="edition" form="ordinal"/>
|
||||
<text term="edition" form="short" strip-periods="true"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="edition"/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="title">
|
||||
<choose>
|
||||
<if type="book">
|
||||
<group delimiter=", " suffix=". ">
|
||||
<text variable="title"/>
|
||||
<text macro="edition"/>
|
||||
</group>
|
||||
</if>
|
||||
<else>
|
||||
<text variable="title" suffix=". "/>
|
||||
</else>
|
||||
</choose>
|
||||
</macro>
|
||||
<macro name="publisher">
|
||||
<group delimiter=", ">
|
||||
<text variable="publisher"/>
|
||||
<text variable="publisher-place"/>
|
||||
</group>
|
||||
</macro>
|
||||
<macro name="year-date">
|
||||
<date variable="issued">
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</macro>
|
||||
<citation collapse="citation-number">
|
||||
<sort>
|
||||
<key variable="citation-number"/>
|
||||
</sort>
|
||||
<layout prefix="[" suffix="]" delimiter=", ">
|
||||
<text variable="citation-number"/>
|
||||
</layout>
|
||||
</citation>
|
||||
<bibliography et-al-min="7" et-al-use-first="6" second-field-align="flush" line-spacing="2" entry-spacing="0">
|
||||
<layout>
|
||||
<text variable="citation-number" suffix=". "/>
|
||||
<group delimiter=". ">
|
||||
<text macro="author"/>
|
||||
<text macro="title"/>
|
||||
</group>
|
||||
<choose>
|
||||
<if type="chapter">
|
||||
<text macro="editor"/>
|
||||
<group delimiter=". " suffix=". ">
|
||||
<group prefix=" " delimiter=", ">
|
||||
<text variable="container-title" font-style="italic"/>
|
||||
<text macro="edition"/>
|
||||
</group>
|
||||
<text macro="year-date"/>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<group delimiter=" ">
|
||||
<label variable="page" form="short" strip-periods="true"/>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</if>
|
||||
<else-if type="paper-conference">
|
||||
<text macro="editor"/>
|
||||
<group delimiter=". " suffix=". ">
|
||||
<group prefix=" " delimiter=", ">
|
||||
<text variable="container-title" form="short" font-style="italic"/>
|
||||
<text macro="edition"/>
|
||||
</group>
|
||||
<text macro="year-date"/>
|
||||
<group delimiter=", ">
|
||||
<text macro="publisher"/>
|
||||
<group delimiter=" ">
|
||||
<label variable="page" form="short" strip-periods="true"/>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="article-journal">
|
||||
<group delimiter="; " suffix=". ">
|
||||
<group delimiter=" ">
|
||||
<text variable="container-title" suffix=" " form="short" strip-periods="true" font-style="italic"/>
|
||||
<text macro="year-date"/>
|
||||
</group>
|
||||
<group delimiter=": ">
|
||||
<text variable="volume" font-weight="bold"/>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
|
||||
<group delimiter=". " suffix=". ">
|
||||
<text variable="container-title" suffix=" " font-style="italic"/>
|
||||
<text macro="year-date"/>
|
||||
<text macro="publisher"/>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="webpage">
|
||||
<group suffix=". ">
|
||||
<text variable="container-title" suffix=". " font-style="italic"/>
|
||||
<text variable="URL" suffix=". "/>
|
||||
<date variable="accessed">
|
||||
<date-part prefix="Accessed " name="day" suffix=" "/>
|
||||
<date-part name="month" form="short" suffix=" " strip-periods="true"/>
|
||||
<date-part name="year"/>
|
||||
</date>
|
||||
</group>
|
||||
</else-if>
|
||||
<else-if type="thesis">
|
||||
<group delimiter=". " suffix=". ">
|
||||
<text variable="container-title" suffix=" " font-style="italic"/>
|
||||
<text macro="year-date"/>
|
||||
<group delimiter=", ">
|
||||
<text variable="genre"/>
|
||||
<text variable="publisher"/>
|
||||
</group>
|
||||
</group>
|
||||
</else-if>
|
||||
<else>
|
||||
<group>
|
||||
<group delimiter=". " suffix=". ">
|
||||
<text variable="container-title" form="short" suffix=" " strip-periods="true" font-style="italic"/>
|
||||
<text macro="year-date"/>
|
||||
<text macro="publisher"/>
|
||||
</group>
|
||||
<group prefix=", " delimiter=": ">
|
||||
<text variable="volume" font-weight="bold"/>
|
||||
<text variable="page"/>
|
||||
</group>
|
||||
</group>
|
||||
</else>
|
||||
</choose>
|
||||
</layout>
|
||||
</bibliography>
|
||||
</style>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,21 +0,0 @@
|
|||
title: Simplemenu
|
||||
author: Martijn De Jongh (Martino)
|
||||
version: 2.0.0
|
||||
quarto-required: ">=1.2.198"
|
||||
contributes:
|
||||
revealjs-plugins:
|
||||
-
|
||||
name: Simplemenu
|
||||
script: simplemenu.js
|
||||
stylesheet: simplemenu.css
|
||||
config:
|
||||
simplemenu:
|
||||
menubarclass: "menubar"
|
||||
menuclass: "menu"
|
||||
activeclass: "active"
|
||||
activeelement: "li"
|
||||
flat: false
|
||||
barhtml:
|
||||
header: ""
|
||||
footer: ""
|
||||
scale: 0.67
|
|
@ -1,190 +0,0 @@
|
|||
.menubar {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-transition: -webkit-transform 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
transition: -webkit-transform 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
-o-transition: transform 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
transition: transform 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
transition: transform 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985), -webkit-transform 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
-webkit-transform: translateY(-100%);
|
||||
-ms-transform: translateY(-100%);
|
||||
transform: translateY(-100%);
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
font-size: clamp(16px, var(--r-main-font-size) * var(--simplemenu-scale, 0.75), 80px);
|
||||
line-height: 1;
|
||||
}
|
||||
.menubar * {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html:not(.print-pdf) body:not(.hide-menubar) .reveal.ready:not(.hide-menubar) .menubar {
|
||||
-webkit-transform: translateY(0);
|
||||
-ms-transform: translateY(0);
|
||||
transform: translateY(0);
|
||||
}
|
||||
body.hide-menubar .reveal.ready .menubar a {
|
||||
-webkit-transition: opacity 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
-o-transition: opacity 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
transition: opacity 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
}
|
||||
.menubar.bottom {
|
||||
-webkit-transform: translateY(100%);
|
||||
-ms-transform: translateY(100%);
|
||||
transform: translateY(100%);
|
||||
}
|
||||
.menubar:before, .menubar:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-bottom: 1px solid currentColor;
|
||||
opacity: 0.3;
|
||||
}
|
||||
.menubar:before {
|
||||
top: 0;
|
||||
}
|
||||
.menubar:after {
|
||||
bottom: 0;
|
||||
}
|
||||
.menubar:before {
|
||||
opacity: 0;
|
||||
}
|
||||
.menubar.bottom:after {
|
||||
opacity: 0;
|
||||
}
|
||||
.menubar.bottom:before {
|
||||
opacity: 0.3;
|
||||
}
|
||||
.print-pdf .pdf-page:not(.hide-menubar) .menubar {
|
||||
-webkit-transform: translateY(0);
|
||||
-ms-transform: translateY(0);
|
||||
transform: translateY(0);
|
||||
}
|
||||
.menubar a {
|
||||
-webkit-transition: opacity 0.2s ease-in-out;
|
||||
-o-transition: opacity 0.2s ease-in-out;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
padding: 0.4em 0;
|
||||
}
|
||||
.menubar > ul {
|
||||
-webkit-transition: opacity 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
-o-transition: opacity 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
transition: opacity 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985);
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
gap: 1.5em;
|
||||
}
|
||||
.menubar > ul li {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
flex: 1;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
.menubar > ul li:before {
|
||||
display: none;
|
||||
}
|
||||
.menubar > ul li + li {
|
||||
margin: 0;
|
||||
}
|
||||
.menubar > ul a {
|
||||
-webkit-box-flex: 0;
|
||||
-ms-flex: 0;
|
||||
flex: 0;
|
||||
white-space: nowrap;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
opacity: 0.33;
|
||||
padding: 0.5em;
|
||||
color: currentColor;
|
||||
}
|
||||
.menubar > ul a:hover {
|
||||
color: currentColor;
|
||||
opacity: 0.75;
|
||||
}
|
||||
.menubar > ul li a.active, .menubar > ul li.active a {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.hide-menu .menu, .hide-menu .menu, [data-state=hide-menu] .menu {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.reveal .slide-number, .menubar .slide-number {
|
||||
background: none;
|
||||
font-family: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
.reveal .slide-number a, .menubar .slide-number a {
|
||||
padding: 0;
|
||||
opacity: 0.33;
|
||||
color: currentColor;
|
||||
}
|
||||
.reveal .slide-number a:hover, .menubar .slide-number a:hover {
|
||||
color: currentColor;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.menubar .slide-number {
|
||||
display: -webkit-box !important;
|
||||
display: -ms-flexbox !important;
|
||||
display: flex !important;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: row;
|
||||
flex-direction: row;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
font-size: 0.75em;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
bottom: auto;
|
||||
z-index: 0;
|
||||
padding: 0;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.slides ~ .menubar, .menubar.bottom {
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.slides ~ .menubar ~ .controls {
|
||||
margin-bottom: clamp(16px, 2.5 * var(--r-main-font-size) * var(--simplemenu-scale, 0.75), 100px);
|
||||
}
|
|
@ -1,644 +0,0 @@
|
|||
|
||||
/*****************************************************************
|
||||
* @author: Martijn De Jongh (Martino), martijn.de.jongh@gmail.com
|
||||
* https://github.com/Martinomagnifico
|
||||
*
|
||||
* Simplemenu.js for Reveal.js
|
||||
* Version 2.0.1
|
||||
*
|
||||
* @license
|
||||
* MIT licensed
|
||||
*
|
||||
* Thanks to:
|
||||
* - Hakim El Hattab, Reveal.js
|
||||
******************************************************************/
|
||||
|
||||
|
||||
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Simplemenu = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
const Plugin = () => {
|
||||
let options = {};
|
||||
const vars = {};
|
||||
const sections = {};
|
||||
const mainArray = [];
|
||||
let autoListItems = [];
|
||||
let manualListItems = [];
|
||||
|
||||
const debugLog = text => {
|
||||
if (options.debug) console.log(text);
|
||||
};
|
||||
|
||||
const isObject = item => {
|
||||
return item && typeof item === 'object' && !Array.isArray(item);
|
||||
};
|
||||
|
||||
const mergeDeep = function (target) {
|
||||
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
sources[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
if (!sources.length) return target;
|
||||
const source = sources.shift();
|
||||
|
||||
if (isObject(target) && isObject(source)) {
|
||||
for (const key in source) {
|
||||
if (isObject(source[key])) {
|
||||
if (!target[key]) Object.assign(target, {
|
||||
[key]: {}
|
||||
});
|
||||
mergeDeep(target[key], source[key]);
|
||||
} else {
|
||||
Object.assign(target, {
|
||||
[key]: source[key]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mergeDeep(target, ...sources);
|
||||
};
|
||||
|
||||
const selectionArray = (container, selectors) => {
|
||||
let selections = container.querySelectorAll(selectors);
|
||||
let selectionarray = Array.prototype.slice.call(selections);
|
||||
return selectionarray;
|
||||
};
|
||||
|
||||
const pluginPath = filename => {
|
||||
let path;
|
||||
let pluginScript = document.querySelector(`script[src$="${filename}"]`);
|
||||
|
||||
if (pluginScript) {
|
||||
path = pluginScript.getAttribute("src").slice(0, -1 * filename.length);
|
||||
} else {
|
||||
path = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('simplemenu.js', document.baseURI).href)).slice(0, (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('simplemenu.js', document.baseURI).href)).lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
return path;
|
||||
};
|
||||
|
||||
const isBefore = (a, b) => {
|
||||
var all = document.getElementsByTagName('*');
|
||||
|
||||
for (var i = 0; i < all.length; ++i) {
|
||||
if (all[i] === a) return true;else if (all[i] === b) return false;
|
||||
}
|
||||
};
|
||||
|
||||
const isStack = section => {
|
||||
let isStack = false;
|
||||
|
||||
for (let i = 0; i < section.childNodes.length; i++) {
|
||||
if (section.childNodes[i].tagName == "SECTION") {
|
||||
isStack = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isStack;
|
||||
};
|
||||
|
||||
const createNode = thehtml => {
|
||||
const fragment = document.createRange().createContextualFragment(thehtml);
|
||||
return fragment.firstElementChild;
|
||||
};
|
||||
|
||||
const loadStyle = (url, type, callback) => {
|
||||
let head = document.querySelector('head');
|
||||
let style = document.createElement('link');
|
||||
style.rel = 'stylesheet';
|
||||
style.href = url;
|
||||
|
||||
let finish = () => {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call();
|
||||
callback = null;
|
||||
}
|
||||
};
|
||||
|
||||
style.onload = finish;
|
||||
|
||||
style.onreadystatechange = function () {
|
||||
if (this.readyState === 'loaded') {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
head.appendChild(style);
|
||||
};
|
||||
|
||||
const checkOccurrence = (array, element) => {
|
||||
let counter = 0;
|
||||
|
||||
for (let i = 0; i <= array.length; i++) {
|
||||
if (array[i] == element) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
return counter;
|
||||
};
|
||||
|
||||
const menuArray = () => {
|
||||
const matchString = vars.matchString;
|
||||
let menulist = selectionArray(vars.viewport, `.${options.menuclass}`) ? selectionArray(vars.viewport, `.${options.menuclass}`) : [];
|
||||
let automenus = [];
|
||||
let manualmenus = [];
|
||||
|
||||
if (menulist.length) {
|
||||
menulist.forEach(menu => {
|
||||
if (menu.getElementsByTagName('li').length < 1) {
|
||||
menu.setAttribute('data-simplemenu-auto', '');
|
||||
automenus.push(menu);
|
||||
} else {
|
||||
if (options.selectby == "data-name" || options.selectby == "name") {
|
||||
let existingListItems = selectionArray(menu, `.${options.menuclass} ${options.activeelement}`);
|
||||
existingListItems.forEach(listItem => {
|
||||
if (!listItem.dataset[matchString]) {
|
||||
let content = listItem.textContent || listItem.querySelector('a').textContent;
|
||||
listItem.setAttribute(`data-${matchString}`, content);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
manualmenus.push(menu);
|
||||
}
|
||||
});
|
||||
return {
|
||||
automenus: automenus,
|
||||
manualmenus: manualmenus
|
||||
};
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const setScale = revealScale => {
|
||||
let totalScale = revealScale * vars.userScale;
|
||||
vars.viewport.style.setProperty('--simplemenu-scale', totalScale.toFixed(3));
|
||||
};
|
||||
|
||||
const moveRevealUI = (curUiEl, newUiEl) => {
|
||||
let newUiElClassList = newUiEl.classList;
|
||||
newUiEl.parentNode.replaceChild(curUiEl, newUiEl);
|
||||
curUiEl.classList = newUiElClassList;
|
||||
};
|
||||
|
||||
const getRevealUI = () => {
|
||||
let revealUIs = ['controls', 'slide-number'];
|
||||
revealUIs.forEach(uielement => {
|
||||
let curUiEl = vars.deck.getRevealElement().querySelector(`.reveal > .${uielement}`);
|
||||
let newUiEl = vars.deck.getRevealElement().querySelector(`.reveal > * .${uielement}`);
|
||||
|
||||
if (curUiEl && newUiEl) {
|
||||
moveRevealUI(curUiEl, newUiEl);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function copyDataAttributes(source, target) {
|
||||
[...source.attributes].filter(attr => attr.nodeName.indexOf('data') > -1).forEach(attr => {
|
||||
target.setAttribute(attr.nodeName, attr.nodeValue);
|
||||
});
|
||||
}
|
||||
|
||||
const prepareSlides = () => {
|
||||
debugLog("Preparing slides");
|
||||
sections.all = selectionArray(vars.viewport, "section");
|
||||
sections.all.forEach(section => {
|
||||
// In Markdown environments, setting a data-name of a stack is not directly possible.
|
||||
// Satting a data-stack-name on the first child solves this.
|
||||
if (!section.parentNode.dataset.name && section.dataset && section.dataset.stackName) {
|
||||
section.parentNode.dataset.name = section.dataset.stackName;
|
||||
} // If a section has a data-sm='none', it will also remove the data-name.
|
||||
|
||||
|
||||
if (section.dataset && section.dataset[vars.matchString] && section.dataset[vars.matchString] == "false" && section.dataset.name) {
|
||||
delete section.dataset.name;
|
||||
}
|
||||
}); // Get all of the kinds of sections
|
||||
|
||||
sections.top = sections.all.filter(section => section.parentNode.classList.contains('slides') && !(section.dataset[vars.matchString] && section.dataset[vars.matchString] == "false"));
|
||||
sections.named = sections.top.filter(section => section.dataset.name || section.getAttribute('name'));
|
||||
sections.namedvisible = sections.named.filter(section => section.dataset.visibility != "hidden"); // Go through all the named sections
|
||||
|
||||
let namedsectionMatches = [];
|
||||
sections.named.forEach(namedsection => {
|
||||
// The 'name' attribute is also allowed.
|
||||
let matchName = namedsection.dataset.name || namedsection.getAttribute('name'); // Named sections can have the same name, but should then be differentiated.
|
||||
|
||||
namedsectionMatches.push(matchName);
|
||||
let dupsBefore = matchName && checkOccurrence(namedsectionMatches, matchName) > 1 ? `-${checkOccurrence(namedsectionMatches, matchName)}` : null;
|
||||
let match = dupsBefore ? matchName + dupsBefore : matchName; // We set the name of the match as a data-attribute
|
||||
|
||||
namedsection.setAttribute(`data-${vars.matchString}`, match); // If the (named) section is not a stack and does not have an ID, we need to give it one.
|
||||
|
||||
if (!isStack(namedsection) && !namedsection.id) {
|
||||
// Note: Quarto will already have assigned an ID, but it may also have been done manually.
|
||||
namedsection.id = match.toLowerCase().replace(/\W/g, '');
|
||||
} else if (isStack(namedsection)) {
|
||||
// Find the first (visible) section inside a stack.
|
||||
let allsects = selectionArray(namedsection, `section`);
|
||||
let allVisibleSects = allsects.filter(section => section.dataset.visibility != "hidden");
|
||||
let firstChildSection = allVisibleSects[0];
|
||||
|
||||
if (firstChildSection && !firstChildSection.id) {
|
||||
firstChildSection.id = match.toLowerCase().replace(/\W/g, '');
|
||||
|
||||
if (namedsection.id == firstChildSection.id) {
|
||||
namedsection.removeAttribute('id');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
let currentMatch = null;
|
||||
let currentid = null; // Get all the sections that are actually slides
|
||||
|
||||
sections.regular = sections.all.filter(section => !isStack(section) && section.dataset.visibility != "hidden"); // Go through all the sections
|
||||
|
||||
sections.regular.forEach((section, i) => {
|
||||
// Filling an array with the needed comparison information
|
||||
let isChildSection = isStack(section.parentNode) && section.parentNode.tagName == "SECTION";
|
||||
let theSection = isChildSection ? section.parentNode : section;
|
||||
let dataname = theSection.dataset.name;
|
||||
let name = theSection.getAttribute(`name`);
|
||||
let dataintl = theSection.getAttribute(vars.langattribute) ? theSection.getAttribute(vars.langattribute) : null;
|
||||
let parentid = section.parentNode.id ? section.parentNode.id : null;
|
||||
let id = section.id ? section.id : isChildSection ? parentid : null;
|
||||
let match = theSection.dataset[vars.matchString];
|
||||
|
||||
if (match) {
|
||||
currentMatch = match;
|
||||
}
|
||||
|
||||
if (id || match == "false") {
|
||||
currentid = i;
|
||||
}
|
||||
|
||||
if (options.flat) {
|
||||
if (match != "false") {
|
||||
match = currentMatch;
|
||||
}
|
||||
}
|
||||
|
||||
if (match == "false") {
|
||||
match = null;
|
||||
}
|
||||
|
||||
if (dataname == "false") {
|
||||
dataname = null;
|
||||
}
|
||||
|
||||
let sectionObject = {
|
||||
index: i,
|
||||
...(section && {
|
||||
section
|
||||
}),
|
||||
...(dataname && {
|
||||
dataname
|
||||
}),
|
||||
...(name && {
|
||||
name
|
||||
}),
|
||||
...(id && {
|
||||
id
|
||||
}),
|
||||
...(match && {
|
||||
match
|
||||
}),
|
||||
...(currentid && {
|
||||
currentid
|
||||
}),
|
||||
...(dataintl && {
|
||||
dataintl
|
||||
})
|
||||
};
|
||||
mainArray.push(sectionObject);
|
||||
});
|
||||
};
|
||||
|
||||
const prepareMenubars = () => {
|
||||
debugLog("Preparing menubars");
|
||||
let menubars = selectionArray(vars.viewport, `.${options.menubarclass}`) ? selectionArray(vars.viewport, `.${options.menubarclass}`) : [];
|
||||
|
||||
if (options.barhtml.header) {
|
||||
// Generate header menubar
|
||||
let bar = createNode(options.barhtml.header);
|
||||
menubars.push(bar);
|
||||
vars.slides.before(bar);
|
||||
}
|
||||
|
||||
if (options.barhtml.footer) {
|
||||
// Generate footer menubar
|
||||
let bar = createNode(options.barhtml.footer);
|
||||
menubars.push(bar);
|
||||
vars.slides.after(bar);
|
||||
}
|
||||
|
||||
if (menubars.length) {
|
||||
// If menubar (pre-existing or just added):
|
||||
setScale(vars.deck.getScale());
|
||||
menubars.forEach((menubar, i) => {
|
||||
let barLocation = isBefore(menubar, vars.slides) ? "top" : "bottom";
|
||||
menubar.classList.add(barLocation);
|
||||
|
||||
if (!menubar.id) {
|
||||
menubar.id = `${options.menubarclass}${barLocation}`;
|
||||
}
|
||||
|
||||
menubar.classList.add("ready");
|
||||
});
|
||||
vars.menubars = menubars;
|
||||
} else {
|
||||
console.log("There are no menubars. You can still use Simplemenu to populate empty menus like in an Agenda or Table Of Contents.");
|
||||
}
|
||||
};
|
||||
|
||||
const prepareMenus = () => {
|
||||
debugLog("Preparing menus");
|
||||
let menus = menuArray();
|
||||
|
||||
if (!menus || menus && !menus.automenus) {
|
||||
console.log("There are no menus. Please add one or more menus manually or through the 'barhtml' option.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (menus.automenus.length >= 1 && sections.namedvisible.length >= 1) {
|
||||
// There are empty menus. Autofill them.
|
||||
let idArray = [];
|
||||
const autoMenuLinks = sections.namedvisible.map(section => {
|
||||
let match = section.dataset[vars.matchString];
|
||||
let name = section.dataset.name || section.getAttribute(`name`) || section.id;
|
||||
let id = section.id || name.toLowerCase().replace(/\W/g, '');
|
||||
idArray.push(id);
|
||||
|
||||
if (vars.quarto) {
|
||||
id = mainArray.find(item => item.match === match).id;
|
||||
}
|
||||
|
||||
let duplicatesBefore = checkOccurrence(idArray, id) > 1 ? `-${checkOccurrence(idArray, id)}` : '';
|
||||
let href = vars.quarto ? id : id + duplicatesBefore;
|
||||
let smmatchString = ` data-${vars.matchString}="${match}"`;
|
||||
let nameString = section.getAttribute(`name`) ? ` name="${section.getAttribute(`name`)}"` : '';
|
||||
let intlString = section.getAttribute(vars.langattribute) ? ` ${vars.langattribute}="${section.getAttribute(vars.langattribute)}"` : '';
|
||||
return `<li><a href="#/${href}"${intlString}${nameString}${smmatchString}>${name}</a></li>`;
|
||||
}).reduce((combinedHTML, itemHTML) => {
|
||||
let orderedHTML = vars.rtl ? itemHTML + combinedHTML : combinedHTML + itemHTML;
|
||||
return orderedHTML;
|
||||
});
|
||||
menus.automenus.forEach(automenu => {
|
||||
automenu.innerHTML = autoMenuLinks;
|
||||
});
|
||||
autoListItems = menus.automenus.map(menu => Array.from(menu.querySelectorAll(options.activeelement))).flat();
|
||||
}
|
||||
|
||||
if (menus.manualmenus.length >= 1) {
|
||||
// There are pre-existing menus. Fix link to ID if needed.
|
||||
// Only get the listitems
|
||||
manualListItems = menus.manualmenus.map(menu => Array.from(menu.querySelectorAll(options.activeelement))).flat();
|
||||
manualListItems.forEach(listItem => {
|
||||
// Get the anchorlinks
|
||||
let linker = listItem.tagName == "a" ? listItem : listItem.querySelector('a');
|
||||
let linkhref = linker.getAttribute('href');
|
||||
|
||||
if (linkhref === "#") {
|
||||
let newLink = listItem.dataset[vars.matchString].toLowerCase().replace(/\W/g, '');
|
||||
linker.href = `#/${newLink}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const preparePrint = () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const hasPrintParam = urlParams.has('print-pdf');
|
||||
|
||||
if (hasPrintParam) {
|
||||
mainArray.forEach(item => {
|
||||
let printSection = item.section;
|
||||
let datainfo = document.createElement("div");
|
||||
datainfo.classList.add("datainfo");
|
||||
copyDataAttributes(printSection, datainfo);
|
||||
let moreData = ['match', 'name', 'dataname', 'currentid', 'id', 'dataintl'];
|
||||
moreData.forEach(moreDataItem => {
|
||||
if (item[moreDataItem]) {
|
||||
datainfo.dataset[moreDataItem] = item[moreDataItem];
|
||||
}
|
||||
});
|
||||
printSection.appendChild(datainfo);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const prepare = resolve => {
|
||||
prepareSlides();
|
||||
prepareMenubars();
|
||||
prepareMenus();
|
||||
preparePrint();
|
||||
return setTimeout(resolve, 0);
|
||||
};
|
||||
|
||||
const compare = (listItem, section) => {
|
||||
let menukind = listItem.parentNode.hasAttribute('data-simplemenu-auto') ? "auto" : "manual";
|
||||
let sectionmatch = section.match ? section.match : null;
|
||||
|
||||
if (menukind == "manual") {
|
||||
if (options.selectby == "id") {
|
||||
sectionmatch = section.id ? section.id : section.currentid ? mainArray[section.currentid].id : null;
|
||||
} else if (options.selectby == "name") {
|
||||
sectionmatch = section.name;
|
||||
} else {
|
||||
sectionmatch = section.dataname;
|
||||
}
|
||||
}
|
||||
|
||||
if (sectionmatch) {
|
||||
let menumatch = listItem.dataset[vars.matchString] || listItem.querySelector('a').dataset[vars.matchString];
|
||||
|
||||
if (options.selectby == "id" && menukind == "manual") {
|
||||
let href = listItem.href || listItem.querySelector('a').href;
|
||||
let lastHref = href ? href.substring(href.lastIndexOf("/") + 1) : '';
|
||||
menumatch = lastHref;
|
||||
}
|
||||
|
||||
if (options.selectby == "data-name" && menukind == "manual") {
|
||||
sectionmatch = section.dataname ? section.dataname : null;
|
||||
}
|
||||
|
||||
if (menumatch && menumatch == sectionmatch) {
|
||||
listItem.classList.add(options.activeclass);
|
||||
} else {
|
||||
listItem.classList.remove(options.activeclass);
|
||||
}
|
||||
} else {
|
||||
listItem.classList.remove(options.activeclass);
|
||||
}
|
||||
};
|
||||
|
||||
const checkSlidesNormal = event => {
|
||||
const index = sections.regular.indexOf(event.currentSlide);
|
||||
let section = mainArray[index];
|
||||
autoListItems.filter(listItem => {
|
||||
compare(listItem, section);
|
||||
});
|
||||
manualListItems.filter(listItem => {
|
||||
compare(listItem, section);
|
||||
});
|
||||
};
|
||||
|
||||
const checkSlidesPDF = event => {
|
||||
let pdfPages = selectionArray(vars.viewport, '.slides .pdf-page'); // Check if any menubar has a slide number
|
||||
|
||||
let anyMenubarHasSlidenumber = false;
|
||||
|
||||
if (vars.menubars) {
|
||||
vars.menubars.forEach(menubar => {
|
||||
anyMenubarHasSlidenumber = !!menubar.getElementsByClassName("slide-number");
|
||||
});
|
||||
}
|
||||
|
||||
pdfPages.forEach(pdfPage => {
|
||||
// The original section has gone, so we rebuild it with the saved data-attributes
|
||||
let datainfo = pdfPage.getElementsByClassName("datainfo")[0];
|
||||
let section = {};
|
||||
section.name = datainfo.dataset.name;
|
||||
section.dataname = datainfo.dataset.dataname;
|
||||
section.currentid = datainfo.dataset.currentid;
|
||||
section.match = datainfo.dataset.match;
|
||||
section.id = datainfo.dataset.id;
|
||||
|
||||
if (datainfo.dataset.state) {
|
||||
let newClasses = datainfo.dataset.state.split(" ");
|
||||
newClasses.forEach(newClass => {
|
||||
pdfPage.classList.add(newClass);
|
||||
let vp = vars.deck.getRevealElement().closest(".reveal-viewport");
|
||||
vp.classList.remove(newClass);
|
||||
});
|
||||
} // If any menubar has a slide number, turn the original one on this slide off
|
||||
|
||||
|
||||
if (anyMenubarHasSlidenumber && pdfPage.getElementsByClassName("slide-number").length > 0) {
|
||||
pdfPage.getElementsByClassName("slide-number")[0].style.display = "none";
|
||||
}
|
||||
|
||||
if (vars.menubars) {
|
||||
vars.menubars.forEach(menubar => {
|
||||
let bar = menubar.cloneNode(true);
|
||||
pdfPage.appendChild(bar);
|
||||
let listItems = selectionArray(bar, `.${options.menuclass} ${options.activeelement}`);
|
||||
listItems.forEach(listItem => {
|
||||
compare(listItem, section);
|
||||
}); // If there is a slidenumber in the menu,
|
||||
|
||||
let newSN = pdfPage.querySelector(`.${options.menubarclass} .slide-number`);
|
||||
let oldSN = pdfPage.querySelector(`:scope > .slide-number`);
|
||||
|
||||
if (newSN && oldSN) {
|
||||
// ...then fill it with the current (total) slidenumber.
|
||||
newSN.textContent = oldSN.textContent;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (vars.menubars) {
|
||||
vars.menubars.forEach(menubar => {
|
||||
menubar.parentNode.removeChild(menubar);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const chapterize = event => {
|
||||
if (event && event.type == "ready") {
|
||||
debugLog(mainArray);
|
||||
getRevealUI();
|
||||
}
|
||||
|
||||
if (event && (event.type == "ready" || event.type == "slidechanged")) {
|
||||
checkSlidesNormal(event);
|
||||
}
|
||||
|
||||
if (event && event.type == "pdf-ready") {
|
||||
checkSlidesPDF();
|
||||
}
|
||||
};
|
||||
|
||||
const simpleMenu = (deck, options, es5Filename) => {
|
||||
deck.configure({
|
||||
hash: true
|
||||
});
|
||||
vars.deck = deck;
|
||||
vars.viewport = deck.getRevealElement().tagName == "BODY" ? document : deck.getRevealElement();
|
||||
vars.slides = deck.getSlidesElement();
|
||||
vars.langattribute = deck.getConfig().internation ? deck.getConfig().internation.langattribute ? deck.getConfig().internation.langattribute : "data-i18n" : false;
|
||||
vars.rtl = deck.getConfig().rtl;
|
||||
vars.quarto = document.querySelector('[name=generator]') && document.querySelector('[name=generator]').content.includes("quarto") ? true : false;
|
||||
vars.matchString = "sm";
|
||||
vars.userScale = options.scale;
|
||||
deck.addEventListener('ready', chapterize, false);
|
||||
deck.addEventListener('slidechanged', chapterize, false);
|
||||
deck.addEventListener('pdf-ready', chapterize, false);
|
||||
deck.addEventListener('resize', _ref => {
|
||||
let {
|
||||
scale
|
||||
} = _ref;
|
||||
return setScale(scale);
|
||||
}, false);
|
||||
const SimplemenuStylePath = options.csspath ? options.csspath : `${pluginPath(es5Filename)}simplemenu.css` || 'plugin/simplemenu/simplemenu.css';
|
||||
return new Promise(resolve => {
|
||||
if (options.csspath === false) {
|
||||
return prepare(resolve);
|
||||
} else {
|
||||
loadStyle(SimplemenuStylePath, 'stylesheet', async () => prepare(resolve));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const init = deck => {
|
||||
let defaultOptions = {
|
||||
menubarclass: 'menubar',
|
||||
menuclass: 'menu',
|
||||
activeclass: 'active',
|
||||
activeelement: 'li',
|
||||
selectby: 'id',
|
||||
barhtml: {
|
||||
header: '',
|
||||
footer: ''
|
||||
},
|
||||
flat: false,
|
||||
scale: 0.67,
|
||||
csspath: ''
|
||||
};
|
||||
options = deck.getConfig().simplemenu || {};
|
||||
options = mergeDeep(defaultOptions, options);
|
||||
let wronginputs = false;
|
||||
let warning = '';
|
||||
|
||||
if (options.selectby !== "id" && options.selectby !== "data-name" && options.selectby !== "name") {
|
||||
wronginputs = true;
|
||||
warning = 'The selectby option can be only "id", "data-name" or "name".';
|
||||
}
|
||||
|
||||
if (wronginputs) {
|
||||
console.log('Simplemenu did not load:');
|
||||
console.log(warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
return simpleMenu(deck, options, "simplemenu.js");
|
||||
};
|
||||
|
||||
return {
|
||||
id: 'simplemenu',
|
||||
init: init
|
||||
};
|
||||
};
|
||||
|
||||
return Plugin;
|
||||
|
||||
}));
|
|
@ -1,8 +0,0 @@
|
|||
title: Critic-markup
|
||||
author: mloubout
|
||||
version: 1.0.3
|
||||
quarto-required: ">=1.2.198"
|
||||
contributes:
|
||||
filters:
|
||||
- critic-markup.lua
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
|
||||
local maybesubs = false
|
||||
local stk_end = false
|
||||
|
||||
add = pandoc.RawInline('html', "<ins>")
|
||||
adde = pandoc.RawInline('html', "</ins>")
|
||||
|
||||
rm = pandoc.RawInline('html', "<del>")
|
||||
rme = pandoc.RawInline('html', "</del>")
|
||||
rmeadd = pandoc.RawInline('html', "</del><ins>")
|
||||
|
||||
mark = pandoc.RawInline('html', "<mark>")
|
||||
marke = pandoc.RawInline('html', "</mark>")
|
||||
|
||||
comm = pandoc.RawInline('html', [[<span class="critic comment">]])
|
||||
comme = pandoc.RawInline('html', "</span>")
|
||||
|
||||
ruless = {['{%+%+']=add, ['{\u{2013}']=rm, ['{==']=mark, ['{>>']=comm, ['{~~']=rm,
|
||||
['%+%+}']=adde, ['\u{2013}}']=rme, ['==}']=marke, ['<<}']=comme, ['~~}']=rme, ['~>']=rmeadd}
|
||||
|
||||
-- Strikeout before/after
|
||||
st_b = '{'
|
||||
st_e = '}'
|
||||
|
||||
local scriptcode = [[
|
||||
|
||||
<div id="criticnav">
|
||||
<ul>
|
||||
<li id="markup-button">Markup</li>
|
||||
<li id="original-button">Original</li>
|
||||
<li id="edited-button">Edited</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function critic() {
|
||||
|
||||
$('.content').addClass('markup');
|
||||
$('#markup-button').addClass('active');
|
||||
$('ins.break').unwrap();
|
||||
$('span.critic.comment').wrap('<span class="popoverc" /></span>');
|
||||
$('span.critic.comment').before('‡');
|
||||
}
|
||||
|
||||
function original() {
|
||||
$('#original-button').addClass('active');
|
||||
$('#edited-button').removeClass('active');
|
||||
$('#markup-button').removeClass('active');
|
||||
|
||||
$('.content').addClass('original');
|
||||
$('.content').removeClass('edited');
|
||||
$('.content').removeClass('markup');
|
||||
}
|
||||
|
||||
function edited() {
|
||||
$('#original-button').removeClass('active');
|
||||
$('#edited-button').addClass('active');
|
||||
$('#markup-button').removeClass('active');
|
||||
|
||||
$('.content').removeClass('original');
|
||||
$('.content').addClass('edited');
|
||||
$('.content').removeClass('markup');
|
||||
}
|
||||
|
||||
function markup() {
|
||||
$('#original-button').removeClass('active');
|
||||
$('#edited-button').removeClass('active');
|
||||
$('#markup-button').addClass('active');
|
||||
|
||||
$('.content').removeClass('original');
|
||||
$('.content').removeClass('edited');
|
||||
$('.content').addClass('markup');
|
||||
}
|
||||
|
||||
var o = document.getElementById("original-button");
|
||||
var e = document.getElementById("edited-button");
|
||||
var m = document.getElementById("markup-button");
|
||||
|
||||
window.onload = critic();
|
||||
o.onclick = original;
|
||||
e.onclick = edited;
|
||||
m.onclick = markup;
|
||||
</script>
|
||||
]]
|
||||
|
||||
function cirtiblock(blocks, k, v)
|
||||
local newblock = {}
|
||||
for ti,t in pairs(blocks) do
|
||||
if t.text then
|
||||
i, j = t.text:find(k)
|
||||
if i then
|
||||
newblock[#newblock + 1] = pandoc.Str(t.text:sub(1, i-1))
|
||||
newblock[#newblock + 1] = v
|
||||
newblock[#newblock + 1] = pandoc.Str(t.text:sub(j+1, t.text:len()))
|
||||
else
|
||||
newblock[#newblock + 1] = t
|
||||
end
|
||||
else
|
||||
newblock[#newblock + 1] = t
|
||||
end
|
||||
end
|
||||
return newblock
|
||||
end
|
||||
|
||||
|
||||
if FORMAT:match 'html' then
|
||||
|
||||
function Str (el)
|
||||
local replaced = {el}
|
||||
-- Check for standard substitutions
|
||||
for k,v in pairs(ruless) do
|
||||
replaced = cirtiblock(replaced, k, v)
|
||||
end
|
||||
return replaced
|
||||
end
|
||||
|
||||
function Strikeout (strk)
|
||||
return strk.content
|
||||
end
|
||||
|
||||
-- Check Inlines for Strikeout (~~) and remove brackets before/after for replacement
|
||||
function Inlines (inlines)
|
||||
for i = #inlines-1,2,-1 do
|
||||
if inlines[i] and inlines[i].t == 'Strikeout' and inlines[i+1] then
|
||||
if inlines[i+1].t == 'Str' then
|
||||
if inlines[i+1].text == st_e then
|
||||
inlines[i+1] = adde
|
||||
end
|
||||
end
|
||||
end
|
||||
if inlines[i] and inlines[i].t == 'Strikeout' and inlines[i-1] then
|
||||
if inlines[i-1].t == 'Str' then
|
||||
if inlines[i-1].text == st_b then
|
||||
inlines[i-1] = rm
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return inlines
|
||||
end
|
||||
end
|
||||
|
||||
--- From the lightbox filter
|
||||
local function add_header_includes(meta, blocks)
|
||||
|
||||
local header_includes = pandoc.List(blocks)
|
||||
|
||||
-- add any exisiting meta['header-includes']
|
||||
-- it could be a MetaList or a single String
|
||||
if meta['header-includes'] then
|
||||
if type(meta['header-includes']) == 'List' then
|
||||
header_includes:extend(meta['header-includes'])
|
||||
else
|
||||
header_includes:insert(meta['header-includes'])
|
||||
end
|
||||
end
|
||||
|
||||
meta['header-includes'] = pandoc.MetaBlocks(header_includes)
|
||||
return meta
|
||||
end
|
||||
|
||||
|
||||
function criticheader (meta)
|
||||
quarto.doc.add_html_dependency({
|
||||
name = 'critic',
|
||||
scripts = {'critic.min.js'},
|
||||
stylesheets = {'critic.css'}
|
||||
})
|
||||
-- inject the rendering code
|
||||
quarto.doc.include_text("after-body", scriptcode)
|
||||
end
|
||||
|
||||
-- All pass with Meta first
|
||||
return {{Meta = criticheader}, {Inlines = Inlines}, {Strikeout = Strikeout}, {Str = Str}}
|
|
@ -1,131 +0,0 @@
|
|||
.fullcontent {
|
||||
padding-top: 30px !important;
|
||||
}
|
||||
|
||||
#criticnav {
|
||||
position: fixed;
|
||||
z-index: 1100;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
border-bottom: solid 1px #696f75;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: rgba(255,255,255,0.95);
|
||||
color: #696f75;
|
||||
font-size: 14px;
|
||||
font-family: "Helvetica Neue", helvetica, arial, sans-serif !important
|
||||
}
|
||||
|
||||
#criticnav ul {
|
||||
list-style-type: none;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
#criticnav ul li {
|
||||
display: block;
|
||||
width: 15%;
|
||||
min-width: 100px;
|
||||
text-align: center;
|
||||
padding: 5px 0 3px !important;
|
||||
margin: 5px 2px !important;
|
||||
line-height: 1em;
|
||||
float: left;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
border-radius: 20px;
|
||||
border: 1px solid rgba(255,255,255,0);
|
||||
color: #777 !important
|
||||
}
|
||||
|
||||
#criticnav ul li:before {
|
||||
content: none !important
|
||||
}
|
||||
|
||||
#criticnav ul li.active {
|
||||
border: 1px solid #696f75
|
||||
}
|
||||
|
||||
.original del {
|
||||
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.original ins,
|
||||
.original span.popoverc,
|
||||
.original ins.break {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.edited ins {
|
||||
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.edited del,
|
||||
.edited span.popoverc,
|
||||
.edited ins.break {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.original mark,
|
||||
.edited mark {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.markup mark {
|
||||
background-color: #fffd38;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markup del {
|
||||
background-color: rgba(183,47,47,0.4);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markup ins {
|
||||
background-color: rgba(152,200,86,0.4);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markup ins.break {
|
||||
display: block;
|
||||
line-height: 2px;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.markup ins.break span {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.markup .popoverc {
|
||||
background-color: #e5b000;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.markup .popoverc .critic.comment {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.markup .popoverc:hover span.critic.comment {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 200px;
|
||||
left: 30%;
|
||||
font-size: 0.8em;
|
||||
color: #ccc;
|
||||
background-color: #333;
|
||||
z-index: 10;
|
||||
padding: 0.5em 1em;
|
||||
border-radius: 0.5em;
|
||||
}
|
||||
|
||||
@media print {
|
||||
#criticnav {
|
||||
display: none !important
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +0,0 @@
|
|||
name: abstract-section
|
||||
author: Albert Krewinkel
|
||||
version: 1.0.0
|
||||
contributes:
|
||||
filters:
|
||||
- abstract-section.lua
|
|
@ -1,59 +0,0 @@
|
|||
--[[
|
||||
abstract-to-meta – move an "abstract" section into document metadata
|
||||
|
||||
Copyright: © 2017–2021 Albert Krewinkel
|
||||
License: MIT – see LICENSE file for details
|
||||
]]
|
||||
local abstract = {}
|
||||
|
||||
--- Extract abstract from a list of blocks.
|
||||
function abstract_from_blocklist (blocks)
|
||||
local body_blocks = {}
|
||||
local looking_at_abstract = false
|
||||
|
||||
for _, block in ipairs(blocks) do
|
||||
if block.t == 'Header' and block.level == 1 then
|
||||
if block.identifier == 'abstract' then
|
||||
looking_at_abstract = true
|
||||
else
|
||||
looking_at_abstract = false
|
||||
body_blocks[#body_blocks + 1] = block
|
||||
end
|
||||
elseif looking_at_abstract then
|
||||
if block.t == 'HorizontalRule' then
|
||||
looking_at_abstract = false
|
||||
else
|
||||
abstract[#abstract + 1] = block
|
||||
end
|
||||
else
|
||||
body_blocks[#body_blocks + 1] = block
|
||||
end
|
||||
end
|
||||
|
||||
return body_blocks
|
||||
end
|
||||
|
||||
if PANDOC_VERSION >= {2,9,2} then
|
||||
-- Check all block lists with pandoc 2.9.2 or later
|
||||
return {{
|
||||
Blocks = abstract_from_blocklist,
|
||||
Meta = function (meta)
|
||||
if not meta.abstract and #abstract > 0 then
|
||||
meta.abstract = pandoc.MetaBlocks(abstract)
|
||||
end
|
||||
return meta
|
||||
end
|
||||
}}
|
||||
else
|
||||
-- otherwise, just check the top-level block-list
|
||||
return {{
|
||||
Pandoc = function (doc)
|
||||
local meta = doc.meta
|
||||
local other_blocks = abstract_from_blocklist(doc.blocks)
|
||||
if not meta.abstract and #abstract > 0 then
|
||||
meta.abstract = pandoc.MetaBlocks(abstract)
|
||||
end
|
||||
return pandoc.Pandoc(other_blocks, meta)
|
||||
end,
|
||||
}}
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
name: author-info-blocks
|
||||
author: Albert Krewinkel
|
||||
version: 1.0.0
|
||||
contributes:
|
||||
filters:
|
||||
- author-info-blocks.lua
|
|
@ -1,179 +0,0 @@
|
|||
local List = require("pandoc.List")
|
||||
local utils = require("pandoc.utils")
|
||||
local stringify = utils.stringify
|
||||
local byAuthor
|
||||
local byAffiliation
|
||||
local Authors = {}
|
||||
local Affiliations = {}
|
||||
|
||||
local authorHoriz
|
||||
|
||||
local Corresponding = nil
|
||||
local function make_correspondance(name, email)
|
||||
correspondance = List:new({
|
||||
pandoc.Str("* Corresponding Author: "),
|
||||
pandoc.Str(name),
|
||||
pandoc.Str(" ("),
|
||||
pandoc.Link(email, "mailto:" .. email),
|
||||
pandoc.Str(")"),
|
||||
})
|
||||
Corresponding = List:new({ pandoc.Para(correspondance) })
|
||||
end
|
||||
|
||||
local equalCont
|
||||
local function make_equal_contributor()
|
||||
eq_statement = pandoc.Str("† These authors contributed equally to this work.")
|
||||
equalCont = List:new({ pandoc.Para(eq_statement) })
|
||||
end
|
||||
|
||||
local function create_author_list(byAuthor)
|
||||
local authors = {}
|
||||
for i, author in ipairs(byAuthor) do
|
||||
local sups = {}
|
||||
|
||||
for j, aff in ipairs(author.affiliations) do
|
||||
table.insert(sups, aff.number)
|
||||
end
|
||||
sups_str = table.concat(sups, ",")
|
||||
|
||||
local name = stringify(author.name.literal)
|
||||
|
||||
if author.attributes ~= nil then
|
||||
if author.attributes["equal-contributor"] ~= nil and author.attributes["equal-contributor"] then
|
||||
sups_str = sups_str .. ",†"
|
||||
make_equal_contributor()
|
||||
end
|
||||
if author.attributes.corresponding ~= nil and author.attributes.corresponding then
|
||||
local email = stringify(author.email)
|
||||
sups_str = sups_str .. ",*"
|
||||
make_correspondance(name, email)
|
||||
end
|
||||
end
|
||||
|
||||
local authorEntry = List:new({
|
||||
pandoc.Str(name),
|
||||
pandoc.Superscript(pandoc.Str(sups_str)),
|
||||
})
|
||||
|
||||
if authorHoriz and i < #byAuthor then
|
||||
authorEntry:extend({ pandoc.Str(", ") })
|
||||
end
|
||||
|
||||
table.insert(authors, pandoc.Span(authorEntry))
|
||||
end
|
||||
|
||||
if authorHoriz then
|
||||
Authors = { pandoc.Para(authors) }
|
||||
else
|
||||
Authors = authors
|
||||
end
|
||||
end
|
||||
|
||||
local function create_affiliation_list(byAffiliation)
|
||||
for i, aff in ipairs(byAffiliation) do
|
||||
local full_aff = pandoc.List({})
|
||||
if aff.name then
|
||||
full_aff:insert(stringify(aff.name))
|
||||
end
|
||||
|
||||
if aff.address then
|
||||
full_aff:insert(stringify(aff.address))
|
||||
end
|
||||
|
||||
if aff.city then
|
||||
full_aff:insert(stringify(aff.city))
|
||||
end
|
||||
|
||||
if aff["postal-code"] then
|
||||
full_aff:insert(stringify(aff["postal-code"]))
|
||||
end
|
||||
|
||||
if aff.region then
|
||||
full_aff:insert(stringify(aff.region))
|
||||
end
|
||||
|
||||
if aff.country then
|
||||
full_aff:insert(stringify(aff.country))
|
||||
end
|
||||
|
||||
local entry = table.concat(full_aff, ", ")
|
||||
entry = aff.number .. ". " .. entry .. "."
|
||||
table.insert(Affiliations, pandoc.Para(pandoc.Str(entry)))
|
||||
end
|
||||
end
|
||||
|
||||
local Abstract = nil
|
||||
local function create_abstract(ab)
|
||||
Abstract = {}
|
||||
table.insert(Abstract, pandoc.Header(1, "Abstract"))
|
||||
table.insert(Abstract, pandoc.Para(ab))
|
||||
end
|
||||
|
||||
local Keywords = nil
|
||||
local function create_keyword_list(kw)
|
||||
Keywords = {}
|
||||
-- quarto.log.output(kw)
|
||||
local kws = pandoc.List({})
|
||||
for i, keyword in ipairs(kw) do
|
||||
kws:insert(stringify(keyword))
|
||||
end
|
||||
local kwentry = table.concat(kws, "; ")
|
||||
kwentry = "Keywords: " .. kwentry .. "."
|
||||
table.insert(Keywords, pandoc.Para(pandoc.Str(kwentry)))
|
||||
end
|
||||
|
||||
local function remove_author_meta(meta)
|
||||
meta.author = nil
|
||||
meta.authors = nil
|
||||
meta.affiliations = nil
|
||||
meta["by-author"] = nil
|
||||
meta["by-affiliation"] = nil
|
||||
meta["abstract"] = nil
|
||||
return meta
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
Meta = function(meta)
|
||||
byAuthor = meta["by-author"]
|
||||
byAffiliation = meta["by-affiliation"]
|
||||
if meta["author-horizontal"] ~= nil then
|
||||
authorHoriz = meta["author-horizontal"]
|
||||
else
|
||||
authorHoriz = true
|
||||
end
|
||||
create_author_list(byAuthor)
|
||||
create_affiliation_list(byAffiliation)
|
||||
if meta["abstract"] ~= nil then
|
||||
create_abstract(meta["abstract"])
|
||||
end
|
||||
if meta["keywords"] ~= nil then
|
||||
create_keyword_list(meta["keywords"])
|
||||
end
|
||||
return meta
|
||||
end,
|
||||
},
|
||||
{
|
||||
Pandoc = function(doc)
|
||||
local meta = doc.meta
|
||||
local body = List:new({})
|
||||
body:extend(Authors)
|
||||
body:extend(Affiliations)
|
||||
if equalCont ~= nil then
|
||||
body:extend(equalCont)
|
||||
end
|
||||
if Corresponding ~= nil then
|
||||
body:extend(Corresponding)
|
||||
end
|
||||
if Abstract then
|
||||
body:extend(Abstract)
|
||||
end
|
||||
if Keywords then
|
||||
body:extend(Keywords)
|
||||
end
|
||||
body:extend(doc.blocks)
|
||||
meta = remove_author_meta(meta)
|
||||
return pandoc.Pandoc(body, meta)
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
name: scholarly-metadata
|
||||
author: Albert Krewinkel
|
||||
version: 1.0.0
|
||||
contributes:
|
||||
filters:
|
||||
- scholarly-metadata.lua
|
|
@ -1,197 +0,0 @@
|
|||
--[[
|
||||
ScholarlyMeta – normalize author/affiliation meta variables
|
||||
|
||||
Copyright (c) 2017-2021 Albert Krewinkel, Robert Winkler
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
]]
|
||||
local List = require("pandoc.List")
|
||||
|
||||
--- Returns the type of a metadata value.
|
||||
--
|
||||
-- @param v a metadata value
|
||||
-- @treturn string one of `Blocks`, `Inlines`, `List`, `Map`, `string`, `boolean`
|
||||
local function metatype(v)
|
||||
if PANDOC_VERSION <= "2.16.2" then
|
||||
local metatag = type(v) == "table" and v.t and v.t:gsub("^Meta", "")
|
||||
return metatag and metatag ~= "Map" and metatag or type(v)
|
||||
end
|
||||
return pandoc.utils.type(v)
|
||||
end
|
||||
|
||||
local type = pandoc.utils.type or metatype
|
||||
|
||||
-- Split a string at commas.
|
||||
local function comma_separated_values(str)
|
||||
local acc = List:new({})
|
||||
for substr in str:gmatch("([^,]*)") do
|
||||
acc[#acc + 1] = substr:gsub("^%s*", ""):gsub("%s*$", "") -- trim
|
||||
end
|
||||
return acc
|
||||
end
|
||||
|
||||
--- Ensure the return value is a list.
|
||||
local function ensure_list(val)
|
||||
if type(val) == "List" then
|
||||
return val
|
||||
elseif type(val) == "Inlines" then
|
||||
-- check if this is really a comma-separated list
|
||||
local csv = comma_separated_values(pandoc.utils.stringify(val))
|
||||
if #csv >= 2 then
|
||||
return csv
|
||||
end
|
||||
return List:new({ val })
|
||||
elseif type(val) == "table" and #val > 0 then
|
||||
return List:new(val)
|
||||
else
|
||||
-- Anything else, use as a singleton (or empty list if val == nil).
|
||||
return List:new({ val })
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns a function which checks whether an object has the given ID.
|
||||
local function has_id(id)
|
||||
return function(x)
|
||||
return x.id == id
|
||||
end
|
||||
end
|
||||
|
||||
--- Copy all key-value pairs of the first table into the second iff there is no
|
||||
-- such key yet in the second table.
|
||||
-- @returns the second argument
|
||||
function add_missing_entries(a, b)
|
||||
for k, v in pairs(a) do
|
||||
b[k] = b[k] or v
|
||||
end
|
||||
return b
|
||||
end
|
||||
|
||||
--- Create an object with a name. The name is either taken directly from the
|
||||
-- `name` field, or from the *only* field name (i.e., key) if the object is a
|
||||
-- dictionary with just one entry. If neither exists, the name is left unset
|
||||
-- (`nil`).
|
||||
function to_named_object(obj)
|
||||
local named = {}
|
||||
if type(obj) == "Inlines" then
|
||||
-- Treat inlines as the name
|
||||
named.name = obj
|
||||
named.id = pandoc.utils.stringify(obj)
|
||||
elseif type(obj) ~= "table" then
|
||||
-- if the object isn't a table, just use its value as a name.
|
||||
named.name = pandoc.MetaInlines({ pandoc.Str(tostring(obj)) })
|
||||
named.id = tostring(obj)
|
||||
elseif obj.name ~= nil then
|
||||
-- object has name attribute → just create a copy of the object
|
||||
add_missing_entries(obj, named)
|
||||
named.id = pandoc.utils.stringify(named.id or named.name)
|
||||
elseif next(obj) and next(obj, next(obj)) == nil then
|
||||
-- Single-entry table. The entry's key is taken as the name, the value
|
||||
-- contains the attributes.
|
||||
key, attribs = next(obj)
|
||||
if type(attribs) == "string" or type(attribs) == "Inlines" then
|
||||
named.name = attribs
|
||||
else
|
||||
add_missing_entries(attribs, named)
|
||||
named.name = named.name or pandoc.MetaInlines({ pandoc.Str(tostring(key)) })
|
||||
end
|
||||
named.id = named.id and pandoc.utils.stringify(named.id) or key
|
||||
else
|
||||
-- this is not a named object adhering to the usual conventions.
|
||||
error("not a named object: " .. tostring(obj))
|
||||
end
|
||||
return named
|
||||
end
|
||||
|
||||
--- Resolve affiliations placeholders to full named objects
|
||||
local function resolve_affiliations(affiliations, known_affiliations)
|
||||
local unresolved_affiliations
|
||||
if affiliations == nil then
|
||||
unresolved_affiliations = {}
|
||||
elseif type(affiliations) == "string" or type(affiliations) == "number" then
|
||||
unresolved_affiliations = { affiliations }
|
||||
else
|
||||
unresolved_affiliations = affiliations
|
||||
end
|
||||
|
||||
local result = List:new({})
|
||||
for i, inst in ipairs(unresolved_affiliations) do
|
||||
result[i] = known_affiliations[tonumber(inst)]
|
||||
or known_affiliations:find_if(has_id(pandoc.utils.stringify(inst)))
|
||||
or to_named_object(inst)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
--- Insert a named object into a list; if an object of the same name exists
|
||||
-- already, add all properties only present in the new object to the existing
|
||||
-- item.
|
||||
function merge_on_id(list, namedObj)
|
||||
local elem, idx = list:find_if(has_id(namedObj.id))
|
||||
local res = elem and add_missing_entries(namedObj, elem) or namedObj
|
||||
local obj_idx = idx or (#list + 1)
|
||||
-- return res, obj_idx
|
||||
list[obj_idx] = res
|
||||
return res, #list
|
||||
end
|
||||
|
||||
--- Flatten a list of lists.
|
||||
local function flatten(lists)
|
||||
local result = List:new({})
|
||||
for _, lst in ipairs(lists) do
|
||||
result:extend(lst)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
--- Canonicalize authors and affiliations
|
||||
local function canonicalize(raw_author, raw_affiliations)
|
||||
local affiliations = ensure_list(raw_affiliations):map(to_named_object)
|
||||
local authors = ensure_list(raw_author):map(to_named_object)
|
||||
|
||||
for _, author in ipairs(authors) do
|
||||
author.affiliations = resolve_affiliations(ensure_list(author.affiliations), affiliations)
|
||||
end
|
||||
|
||||
-- Merge affiliations defined in author objects with those defined in the
|
||||
-- top-level list.
|
||||
local author_insts = flatten(authors:map(function(x)
|
||||
return x.affiliations
|
||||
end))
|
||||
for _, inst in ipairs(author_insts) do
|
||||
merge_on_id(affiliations, inst)
|
||||
end
|
||||
|
||||
-- Add list indices to affiliations for numbering and reference purposes
|
||||
for idx, inst in ipairs(affiliations) do
|
||||
inst.index = pandoc.MetaInlines({ pandoc.Str(tostring(idx)) })
|
||||
end
|
||||
|
||||
-- replace affiliations with their indices
|
||||
local to_index = function(inst)
|
||||
return tostring(select(2, affiliations:find_if(has_id(inst.id))))
|
||||
end
|
||||
for _, author in ipairs(authors) do
|
||||
author.affiliations = pandoc.MetaList(author.affiliations:map(to_index))
|
||||
end
|
||||
|
||||
return authors, affiliations
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
Meta = function(meta)
|
||||
meta.author, meta.affiliations = canonicalize(meta.author, meta.affiliations)
|
||||
return meta
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
title: LaTeX Environment
|
||||
author: RStudio, PBC
|
||||
version: 1.1.0
|
||||
quarto-required: ">=1.2.198"
|
||||
contributes:
|
||||
filters:
|
||||
- latex-environment.lua
|
||||
format:
|
||||
pdf: default
|
|
@ -1,133 +0,0 @@
|
|||
-- environment.lua
|
||||
-- Copyright (C) 2020 by RStudio, PBC
|
||||
|
||||
local classEnvironments = pandoc.MetaMap({})
|
||||
local classCommands = pandoc.MetaMap({})
|
||||
|
||||
-- helper that identifies arrays
|
||||
local function tisarray(t)
|
||||
local i = 0
|
||||
for _ in pairs(t) do
|
||||
i = i + 1
|
||||
if t[i] == nil then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- reads the environments
|
||||
local function readEnvironments(meta)
|
||||
local env = meta['environments']
|
||||
if env ~= nil then
|
||||
if tisarray(env) then
|
||||
-- read an array of strings
|
||||
for i, v in ipairs(env) do
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classEnvironments[value] = value
|
||||
end
|
||||
else
|
||||
-- read key value pairs
|
||||
for k, v in pairs(env) do
|
||||
local key = pandoc.utils.stringify(k)
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classEnvironments[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function readCommands(meta)
|
||||
local env = meta['commands']
|
||||
if env ~= nil then
|
||||
if tisarray(env) then
|
||||
-- read an array of strings
|
||||
for i, v in ipairs(env) do
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classCommands[value] = value
|
||||
end
|
||||
else
|
||||
-- read key value pairs
|
||||
for k, v in pairs(env) do
|
||||
local key = pandoc.utils.stringify(k)
|
||||
local value = pandoc.utils.stringify(v)
|
||||
classCommands[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function readEnvsAndCommands(meta)
|
||||
readEnvironments(meta)
|
||||
readCommands(meta)
|
||||
end
|
||||
|
||||
-- use the environments from metadata to
|
||||
-- emit a custom environment for latex
|
||||
local function writeEnvironments(divEl)
|
||||
if quarto.doc.is_format("latex") then
|
||||
for k, v in pairs(classEnvironments) do
|
||||
if divEl.attr.classes:includes(k) then
|
||||
-- process this into a latex environment
|
||||
local beginEnv = '\\begin' .. '{' .. v .. '}'
|
||||
local endEnv = '\n\\end{' .. v .. '}'
|
||||
|
||||
-- check if custom options or arguments are present
|
||||
-- and add them to the environment accordingly
|
||||
local opts = divEl.attr.attributes['options']
|
||||
if opts then
|
||||
beginEnv = beginEnv .. '[' .. opts .. ']'
|
||||
end
|
||||
|
||||
local args = divEl.attr.attributes['arguments']
|
||||
if args then
|
||||
beginEnv = beginEnv .. '{' .. args .. '}'
|
||||
end
|
||||
|
||||
-- if the first and last div blocks are paragraphs then we can
|
||||
-- bring the environment begin/end closer to the content
|
||||
if divEl.content[1].t == "Para" and divEl.content[#divEl.content].t == "Para" then
|
||||
table.insert(divEl.content[1].content, 1, pandoc.RawInline('tex', beginEnv .. "\n"))
|
||||
table.insert(divEl.content[#divEl.content].content, pandoc.RawInline('tex', "\n" .. endEnv))
|
||||
else
|
||||
table.insert(divEl.content, 1, pandoc.RawBlock('tex', beginEnv))
|
||||
table.insert(divEl.content, pandoc.RawBlock('tex', endEnv))
|
||||
end
|
||||
return divEl
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- use the environments from metadata to
|
||||
-- emit a custom environment for latex
|
||||
local function writeCommands(spanEl)
|
||||
if quarto.doc.is_format("latex") then
|
||||
for k, v in pairs(classCommands) do
|
||||
if spanEl.attr.classes:includes(k) then
|
||||
|
||||
-- resolve the begin command
|
||||
local beginCommand = pandoc.RawInline('latex', '\\' .. pandoc.utils.stringify(v) .. '{')
|
||||
local opts = spanEl.attr.attributes['options']
|
||||
if opts then
|
||||
beginCommand = pandoc.RawInline('latex', '\\' .. pandoc.utils.stringify(v) .. '[' .. opts .. ']{')
|
||||
end
|
||||
|
||||
-- the end command
|
||||
local endCommand = pandoc.RawInline('latex', '}')
|
||||
|
||||
-- attach the raw inlines to the span contents
|
||||
local result = spanEl.content
|
||||
table.insert(result, 1, beginCommand)
|
||||
table.insert(result, endCommand)
|
||||
|
||||
return result
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Run in two passes so we process metadata
|
||||
-- and then process the divs
|
||||
return {
|
||||
{ Meta = readEnvsAndCommands },
|
||||
{ Div = writeEnvironments, Span = writeCommands }
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
title: Pointer
|
||||
author: Posit Software, PBC
|
||||
version: 0.1.0
|
||||
quarto-required: ">=1.2.198"
|
||||
contributes:
|
||||
revealjs-plugins:
|
||||
- name: RevealPointer
|
||||
script: pointer.js
|
||||
stylesheet: pointer.css
|
||||
config:
|
||||
pointer:
|
||||
key: "q"
|
||||
color: "red"
|
||||
pointerSize: 16
|
||||
alwaysVisible: false
|
|
@ -1 +0,0 @@
|
|||
.cursor-dot,.cursor-dot-outline{pointer-events:none;position:absolute;top:0;left:0;border-radius:50%;opacity:0;transform:translate(-50%,-50%);transition:opacity 0.3s ease-in-out,transform 0.3s ease-in-out;}.cursor-dot{width:12px;height:12px;background-color:red;z-index:99;}.no-cursor{cursor:none;}.no-cursor a,.no-cursor div,.no-cursor span{cursor:none;}
|
|
@ -1 +0,0 @@
|
|||
var RevealPointer=function(){"use strict";var e={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pausebreak:19,capslock:20,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,leftarrow:37,uparrow:38,rightarrow:39,downarrow:40,insert:45,delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,leftwindowkey:91,rightwindowkey:92,selectkey:93,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,subtract:109,decimalpoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,semicolon:186,equalsign:187,comma:188,dash:189,period:190,forwardslash:191,graveaccent:192,openbracket:219,backslash:220,closebracket:221,singlequote:222};return function(){var t={},o=!1,a=null,n={x:0,y:0,isVisible:!1},i={x:0,y:0,scale:1};function l(o){var a;null==(t=o.pointer||{}).key?t.key="q":t.key=t.key.toLowerCase(),null!=t.pointerSize&&"number"==typeof t.pointerSize||(t.pointerSize=12),null!=t.tailLength&&"number"==typeof t.tailLength||(t.tailLength=10),null!=t.color&&"string"==typeof t.color||(t.color="red"),null!=t.alwaysVisible&&"boolean"==typeof t.alwaysVisible||(t.alwaysVisible=!1),t.keyCode=(a=t.key,e[a])}function s(){a.style.top="".concat((n.y-i.y)/i.scale,"px"),a.style.left="".concat((n.x-i.x)/i.scale,"px"),n.isVisible?a.style.opacity="0.8":a.style.opacity="0",1!==i.scale?(a.style.width="".concat(t.pointerSize/i.scale,"px"),a.style.height="".concat(t.pointerSize/i.scale,"px")):(a.style.width="".concat(t.pointerSize,"px"),a.style.height="".concat(t.pointerSize,"px"))}function c(e){n.x=e.pageX,n.y=e.pageY;var t=document.body.style.transform;""!==t?(i.x=Number.parseInt(/translate\((.*)px,/gm.exec(t)[1]),i.y=Number.parseInt(/px,\s(.*)px\)/gm.exec(t)[1]),i.scale=Number.parseFloat(/scale\((.)\)/gm.exec(t)[1])):(i.x=0,i.y=0,i.scale=1),requestAnimationFrame(s)}function r(){(o=!o)?(document.addEventListener("mousemove",c),document.body.classList.add("no-cursor"),n.isVisible=!0):(document.removeEventListener("mousemove",c),document.body.classList.remove("no-cursor"),n.isVisible=!1,requestAnimationFrame(s))}return{id:"pointer",init:function(e){var o;l(e.getConfig()),t.alwaysVisible?r():e.addKeyBinding({keyCode:t.keyCode,key:t.key},(function(){r()})),(o=document.createElement("div")).className="cursor-dot",o.style.width="".concat(t.pointerSize,"px"),o.style.height="".concat(t.pointerSize,"px"),o.style.backgroundColor=t.color,t.alwaysVisible&&(o.style.opacity="0.8"),document.body.appendChild(o),a=o}}}}();
|
|
@ -1,19 +0,0 @@
|
|||
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
|
@ -1,239 +0,0 @@
|
|||
<?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
|
@ -1,166 +0,0 @@
|
|||
-- 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,
|
||||
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
\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
|
|
@ -1,41 +0,0 @@
|
|||
\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}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
\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}}
|
||||
|
|
@ -1 +0,0 @@
|
|||
\setlength{\parindent}{6pt}
|
|
@ -1 +0,0 @@
|
|||
/*-- scss:defaults --*/
|
|
@ -1,8 +0,0 @@
|
|||
title: Reveal-header
|
||||
author: Shafayet Khan Shafee
|
||||
version: 1.2.6
|
||||
quarto-required: ">=1.2.0"
|
||||
contributes:
|
||||
filters:
|
||||
- reveal-header.lua
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz@8..60&display=swap');*/
|
||||
|
||||
|
||||
:root {
|
||||
--header-font-size: max(10px, 1.4vw);
|
||||
--header-font-color: #898E8B;
|
||||
--header-margin: 0px 0px 0px 0px;
|
||||
/*--header-font-family: 'Source Serif 4', serif;*/
|
||||
}
|
||||
|
||||
.reveal .reveal-header {
|
||||
top: 0;
|
||||
margin: 3.2px 0px 2px 0px;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 5;
|
||||
/*font-family: var(--header-font-family);*/
|
||||
}
|
||||
|
||||
.reveal .reveal-header p {
|
||||
color: var(--header-font-color);
|
||||
text-align: center;
|
||||
margin: var(--header-margin);
|
||||
font-size: var(--header-font-size);
|
||||
}
|
||||
|
||||
.reveal-header .sc-title p,
|
||||
.reveal-header .sb-title p {
|
||||
font-size: max(10px, 1.45vw);
|
||||
filter: brightness(0.85);
|
||||
}
|
||||
|
||||
.reveal-header .sc-title p { float: left; margin-left: 0.5vw}
|
||||
.reveal-header .sb-title p { float: right; margin-right: 0.5vw}
|
||||
.reveal-header.no-logo .sc-title p {margin-left: 6vw}
|
||||
|
||||
|
||||
.reveal .header-logo img {
|
||||
margin: var(--header-margin);
|
||||
padding-left: 1vw;
|
||||
padding-top: 5px;
|
||||
height: 100%;
|
||||
width: auto;
|
||||
max-width: max(60px, 10vw);
|
||||
max-height: max(60px, 10vh);
|
||||
}
|
||||
|
||||
|
||||
/* .reveal .slides { margin-top: 3vh !important;} */
|
||||
.inverse-header { color: #c5d7ce !important;}
|
||||
|
||||
|
||||
div.slides section:not(.title-slide):not(#title-slide):not(.stack) {
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
||||
/* On screens that are 600px or less*/
|
||||
@media screen and (max-width: 600px) {
|
||||
.reveal .header-logo img {
|
||||
padding-top: 0px;
|
||||
margin: 0px 0px 5px 0px;
|
||||
}
|
||||
|
||||
.reveal-header .sc-title p { margin-left: 1vw; }
|
||||
.reveal-header.no-logo .sc-title p {margin-left: 2vw; }
|
||||
div.reveal.has-logo div.slide-number { font-size: 10px; }
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
div.header-logo { grid-area: logo;}
|
||||
|
||||
.no-logo div.header-logo { grid-area: unset !important; }
|
||||
|
||||
div.sc-title { grid-area: sc;}
|
||||
div.sb-title { grid-area: sb;}
|
||||
div.header-text { grid-area: ht;}
|
||||
div.reveal.has-logo div.slide-number {
|
||||
grid-area: sn;
|
||||
top: unset !important;
|
||||
right: unset !important;
|
||||
bottom: unset !important;
|
||||
padding: 5px 5px 5px 5px;
|
||||
justify-self: center;
|
||||
/*font-family: var(--header-font-family);*/
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
div.reveal-header {
|
||||
display: grid;
|
||||
grid-template-columns: 0.4fr 0.4fr 2fr 0.4fr 0.3fr;
|
||||
grid-template-areas: "logo sc ht sb sn";
|
||||
column-gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div.reveal-header.no-logo {
|
||||
grid-template-columns: 0.7fr 2fr 0.7fr 0.05fr;
|
||||
grid-template-areas: "sc ht sb sn";
|
||||
margin-top: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
/* On screens that are 600px or less*/
|
||||
@media screen and (max-width: 600px) {
|
||||
|
||||
div.reveal-header {
|
||||
grid-template-columns: 0.4fr 0.4fr 1fr 0.4fr 0.3fr;
|
||||
grid-template-areas: "logo sc ht sb sn";
|
||||
}
|
||||
|
||||
div.reveal-header.no-logo {
|
||||
grid-template-columns: 0.7fr 1fr 0.7fr 0.05fr;
|
||||
grid-template-areas: "sc ht sb sn";
|
||||
}
|
||||
|
||||
.reveal-header .sc-title p { margin-left: 1vw; }
|
||||
.reveal-header.no-logo .sc-title p {margin-left: 2vw; }
|
||||
div.reveal.has-logo div.slide-number { font-size: 10px; }
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
div.header-logo { grid-area: logo;}
|
||||
|
||||
.no-logo div.header-logo { grid-area: unset !important; }
|
||||
|
||||
div.sc-title { grid-area: sc;}
|
||||
div.header-text { grid-area: ht;}
|
||||
div.sb-title { grid-area: sb;}
|
||||
div.reveal.has-logo div.slide-number {
|
||||
grid-area: sn;
|
||||
top: unset !important;
|
||||
right: unset !important;
|
||||
bottom: unset !important;
|
||||
padding: 5px 5px 5px 5px;
|
||||
justify-self: center;
|
||||
/*font-family: var(--header-font-family);*/
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
div.reveal-header {
|
||||
display: grid;
|
||||
grid-template-columns: 0.35fr 1.2fr 0.1fr 1.2fr 0.2fr;
|
||||
grid-template-areas: "logo sc ht sb sn";
|
||||
column-gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div.reveal-header.no-logo {
|
||||
grid-template-columns: 1fr 0.1fr 1fr 0.15fr;
|
||||
grid-template-areas: "sc ht sb sn";
|
||||
margin-top: 1.5vh;
|
||||
}
|
||||
|
||||
|
||||
/* On screens that are 600px or less*/
|
||||
@media screen and (max-width: 600px) {
|
||||
|
||||
div.reveal-header {
|
||||
grid-template-columns: 0.2fr 1.2fr 0.1fr 1.2fr 0.4fr;
|
||||
grid-template-areas: "logo sc ht sb sn";
|
||||
}
|
||||
|
||||
div.reveal-header.no-logo {
|
||||
grid-template-columns: 1fr 0.1fr 1fr 0.25fr;
|
||||
grid-template-areas: "sc ht sb sn";
|
||||
}
|
||||
|
||||
.reveal-header .sc-title p { margin-left: 1vw; }
|
||||
.reveal-header.no-logo .sc-title p {margin-left: 2vw; }
|
||||
div.reveal.has-logo div.slide-number { font-size: 10px; }
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* reveal-header
|
||||
* A filter that adds header text and logo.
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2023 Shafayet Khan Shafee.
|
||||
*/
|
||||
|
||||
function header() {
|
||||
|
||||
// add the header structure as the firstChild of div.reveal-header
|
||||
function add_header() {
|
||||
let header = document.querySelector("div.reveal-header");
|
||||
let reveal = document.querySelector(".reveal");
|
||||
reveal.insertBefore(header, reveal.firstChild);
|
||||
|
||||
logo_img = document.querySelector('.header-logo img');
|
||||
if (logo_img.getAttribute('src') == null) {
|
||||
if (logo_img?.getAttribute('data-src') != null) {
|
||||
logo_img.src = logo_img?.getAttribute('data-src') || "";
|
||||
logo_img.removeAttribute('data-src');
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// add the class inverse-header for slide with has-dark-background class
|
||||
// otherwise remove it.
|
||||
function add_class(has_dark, header_paras) {
|
||||
header_paras.forEach(el => {
|
||||
el.classList.remove('inverse-header');
|
||||
if(has_dark) {
|
||||
el.classList.add('inverse-header');
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// dynamically changing the header
|
||||
function change_header(dheader, cheader, ctext) {
|
||||
// dhead => dynamic header
|
||||
// chead => constant header
|
||||
// ctext => contstant header_text inner html
|
||||
if (dheader !== null) {
|
||||
cheader.innerHTML = dheader.innerHTML;
|
||||
} else {
|
||||
cheader.innerHTML = ctext;
|
||||
};
|
||||
};
|
||||
|
||||
function hide_from_title_slide(element) {
|
||||
Reveal.on( 'slidechanged' , event => {
|
||||
if (event.currentSlide.matches('#title-slide')) {
|
||||
element.style.visibility = 'hidden';
|
||||
} else {
|
||||
element.style.visibility = 'visible';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
if (Reveal.isReady()) {
|
||||
|
||||
add_header();
|
||||
|
||||
if (document.querySelector('div.reveal.has-logo') != null) {
|
||||
var slide_number = document.querySelector('div.slide-number');
|
||||
var header = document.querySelector("div.reveal-header");
|
||||
header.appendChild(slide_number);
|
||||
};
|
||||
|
||||
// Get the default header text element and innner HTML (i.e. literal text)
|
||||
var header_text = document.querySelector("div.header-text p");
|
||||
const header_inner_html = header_text.innerHTML;
|
||||
|
||||
var header_paras = document.querySelectorAll("div.reveal-header p");
|
||||
var dark = Reveal.getCurrentSlide().classList.contains('has-dark-background');
|
||||
add_class(dark, header_paras);
|
||||
|
||||
Reveal.on( 'slidechanged', event => {
|
||||
var has_dark = event.currentSlide.classList.contains('has-dark-background');
|
||||
add_class(has_dark, header_paras);
|
||||
});
|
||||
|
||||
// make the visibility of slide specific header text defined in slide body none
|
||||
document.querySelectorAll('div.header').forEach(el => {
|
||||
el.style.display = 'none';
|
||||
});
|
||||
|
||||
|
||||
// change the header if currently loaded slide has the header div defined
|
||||
// which won't be captured by slidechanged event unless we change slides.
|
||||
let dynamic_header = Reveal.getCurrentSlide().querySelector('div.header p');
|
||||
change_header(dynamic_header, header_text, header_inner_html);
|
||||
|
||||
Reveal.on( 'slidechanged', event => {
|
||||
let dyn_header = event.currentSlide.querySelector('div.header p');
|
||||
change_header(dyn_header, header_text, header_inner_html);
|
||||
});
|
||||
|
||||
/************** header text in title slide if title or ***********************/
|
||||
/************* subtitle is used as header text ***********************/
|
||||
|
||||
var title_text = document.querySelector('.reveal-header .title-text p');
|
||||
if (title_text != null) {
|
||||
title_text.style.visibility = 'hidden';
|
||||
hide_from_title_slide(title_text);
|
||||
};
|
||||
|
||||
/*************** hide header text and logo on title slide ********************/
|
||||
|
||||
var hide_header_text = document.querySelector('.header-text').getAttribute('data-hide-from-titleslide');
|
||||
var hide_header_logo = document.querySelector('.header-logo').getAttribute('data-hide-from-titleslide');
|
||||
|
||||
if (hide_header_text == 'true') {
|
||||
header_text.style.visibility = 'hidden';
|
||||
hide_from_title_slide(header_text);
|
||||
}
|
||||
|
||||
if (hide_header_logo == 'true') {
|
||||
logo_img.style.visibility = 'hidden';
|
||||
hide_from_title_slide(logo_img);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
window.addEventListener("load", (event) => {
|
||||
header();
|
||||
});
|
|
@ -1,93 +0,0 @@
|
|||
/**
|
||||
* reveal-header
|
||||
* A filter that adds header text and logo.
|
||||
*
|
||||
* MIT License
|
||||
* Copyright (c) 2023 Shafayet Khan Shafee.
|
||||
*/
|
||||
|
||||
function add_sc_sb_title() {
|
||||
|
||||
function get_title() {
|
||||
var h1_arr = [];
|
||||
var h2_arr = [];
|
||||
|
||||
Reveal.getSlides().forEach(el => {
|
||||
if (!el.matches('#title-slide')) {
|
||||
var h1 = el.querySelector('.title-slide h1')?.innerText;
|
||||
var h2 = el.querySelector('.title-slide h2')?.innerText;
|
||||
h1_arr.push(h1);
|
||||
h2_arr.push(h2);
|
||||
};
|
||||
});
|
||||
|
||||
return [h1_arr, h2_arr]
|
||||
};
|
||||
|
||||
function fill_array(ar) {
|
||||
let last_val = ar[0] || " ";
|
||||
for (let i = 1; i < ar.length; i++) {
|
||||
if (typeof ar[i] === 'undefined') {
|
||||
ar[i] = last_val;
|
||||
} else {
|
||||
last_val = ar[i];
|
||||
}
|
||||
}
|
||||
return ar
|
||||
};
|
||||
|
||||
|
||||
if (Reveal.isReady()) {
|
||||
|
||||
if (document.querySelector('div.reveal-header img').getAttribute('src').length == 0) {
|
||||
document.querySelector('div.reveal-header').classList.add('no-logo')
|
||||
}
|
||||
|
||||
var [h1_array, h2_array] = get_title();
|
||||
var filled_h1_array = fill_array(h1_array);
|
||||
var filled_h2_array = fill_array(h2_array);
|
||||
|
||||
Reveal.getSlides().forEach((el, idx) => {
|
||||
if (!el.matches('#title-slide')) {
|
||||
el.setAttribute('data-sc-title', filled_h1_array[(idx - 1)])
|
||||
el.setAttribute('data-sb-title', filled_h2_array[(idx - 1)])
|
||||
}
|
||||
});
|
||||
|
||||
Reveal.on( 'slidechanged', event => {
|
||||
let sp = Reveal.getSlidesElement().querySelector('.stack.present');
|
||||
|
||||
if (sp != null) {
|
||||
let header = document.querySelector("div.reveal-header");
|
||||
|
||||
// handling h1 section title (`.sc-title`)
|
||||
var section_text = event.currentSlide.getAttribute('data-sc-title') || " ";
|
||||
if (event.currentSlide.matches('.title-slide.level1')) {
|
||||
header.querySelector('.sc-title p').innerText = "";
|
||||
} else if (event.currentSlide.matches('.title-slide.level2')) {
|
||||
header.querySelector('.sc-title p').innerText = section_text;
|
||||
} else {
|
||||
header.querySelector('.sc-title p').innerText = section_text;
|
||||
};
|
||||
|
||||
// handling h2 section title (`.sb-title`)
|
||||
var sbsection_text = event.currentSlide.getAttribute('data-sb-title') || " ";
|
||||
if (event.currentSlide.matches('.title-slide.level1')) {
|
||||
header.querySelector('.sb-title p').innerText = "";
|
||||
} else if (event.currentSlide.matches('.title-slide.level2')) {
|
||||
header.querySelector('.sb-title p').innerText = "";
|
||||
} else {
|
||||
header.querySelector('.sb-title p').innerText = sbsection_text;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
window.addEventListener("load", (event) => {
|
||||
add_sc_sb_title();
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
--[[
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Shafayet Khan Shafee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
]]--
|
||||
|
||||
|
||||
local function ensureHtmlDeps()
|
||||
quarto.doc.add_html_dependency({
|
||||
name = "reveal-header",
|
||||
version = "1.0.0",
|
||||
scripts = {
|
||||
{ path = "resources/js/add_header.js", attribs = {defer = "true"}}
|
||||
},
|
||||
stylesheets = {"resources/css/add_header.css"}
|
||||
})
|
||||
end
|
||||
|
||||
local function sc_sb_title()
|
||||
quarto.doc.add_html_dependency({
|
||||
name = "sc-sb-title",
|
||||
version = "1.0.0",
|
||||
scripts = {
|
||||
{ path = "resources/js/sc_sb_title.js", attribs = {defer = "true"}}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function grid_htext()
|
||||
quarto.doc.add_html_dependency({
|
||||
name = "grid-htext",
|
||||
version = "1.0.0",
|
||||
stylesheets = {"resources/css/grid_htext.css"}
|
||||
})
|
||||
end
|
||||
|
||||
local function grid_no_htext()
|
||||
quarto.doc.add_html_dependency({
|
||||
name = "grid-no-htext",
|
||||
version = "1.0.0",
|
||||
stylesheets = {"resources/css/grid_no_htext.css"}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if quarto.doc.is_format('revealjs') then
|
||||
-- Ensuring the dependencies got loaded before proceeding
|
||||
ensureHtmlDeps()
|
||||
function Pandoc(doc)
|
||||
local blocks = doc.blocks
|
||||
local str = pandoc.utils.stringify
|
||||
local meta = doc.meta
|
||||
if meta['sc-sb-title'] then
|
||||
sc_sb_title()
|
||||
end
|
||||
if meta['header'] then
|
||||
grid_htext()
|
||||
else
|
||||
grid_no_htext()
|
||||
end
|
||||
local header_text = meta['header'] and str(meta['header']) or " "
|
||||
local header_para_class = {class = "header-text"}
|
||||
if meta['title-as-header'] then
|
||||
header_text = meta['title']
|
||||
header_para_class = {class = "header-text title-text"}
|
||||
end
|
||||
if meta['subtitle-as-header'] then
|
||||
header_text = meta['subtitle']
|
||||
header_para_class = {class = "header-text title-text"}
|
||||
end
|
||||
-- make divs structure for holding text and logo.
|
||||
local header_logo = meta['header-logo'] and str(meta['header-logo']) or ""
|
||||
local header_img = pandoc.Div(pandoc.Image("", header_logo, ""), {class = "header-logo"})
|
||||
local header_section = pandoc.Div(pandoc.Para(" "), {class = "sc-title"})
|
||||
local header_sbsection = pandoc.Div(pandoc.Para(" "), {class = "sb-title"})
|
||||
local header_para = pandoc.Div(pandoc.Para(header_text), header_para_class)
|
||||
if meta['hide-from-titleSlide'] then
|
||||
local hide = str(meta['hide-from-titleSlide'])
|
||||
if hide == "text" then
|
||||
header_para.attributes['hide-from-titleslide'] = "true"
|
||||
elseif hide == "logo" then
|
||||
header_img.attributes['hide-from-titleslide'] = "true"
|
||||
elseif hide == "all" then
|
||||
header_para.attributes['hide-from-titleslide'] = "true"
|
||||
header_img.attributes['hide-from-titleslide'] = "true"
|
||||
end
|
||||
end
|
||||
local div = pandoc.Div(
|
||||
{
|
||||
header_img,
|
||||
header_section,
|
||||
header_para,
|
||||
header_sbsection
|
||||
},
|
||||
{class = 'reveal-header'})
|
||||
table.insert(blocks, div)
|
||||
return doc
|
||||
end
|
||||
end
|
|
@ -1,541 +0,0 @@
|
|||
---
|
||||
title: "数据可视化"
|
||||
subtitle: 《区域水环境污染数据分析实践》<br>Data analysis practice of regional water environment pollution
|
||||
author: 苏命、王为东<br>中国科学院大学资源与环境学院<br>中国科学院生态环境研究中心
|
||||
date: today
|
||||
lang: zh
|
||||
format:
|
||||
revealjs:
|
||||
theme: dark
|
||||
slide-number: true
|
||||
chalkboard:
|
||||
buttons: true
|
||||
preview-links: auto
|
||||
lang: zh
|
||||
toc: true
|
||||
toc-depth: 1
|
||||
toc-title: 大纲
|
||||
logo: ./_extensions/inst/img/ucaslogo.png
|
||||
css: ./_extensions/inst/css/revealjs.css
|
||||
pointer:
|
||||
key: "p"
|
||||
color: "#32cd32"
|
||||
pointerSize: 18
|
||||
revealjs-plugins:
|
||||
- pointer
|
||||
filters:
|
||||
- d2
|
||||
---
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
knitr::opts_chunk$set(echo = TRUE)
|
||||
source("../../coding/_common.R")
|
||||
library(tidyverse)
|
||||
library(palmerpenguins)
|
||||
library(ggthemes)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 查看数据
|
||||
|
||||
```{r}
|
||||
penguins
|
||||
```
|
||||
|
||||
## 查看数据
|
||||
|
||||
```{r}
|
||||
glimpse(penguins)
|
||||
```
|
||||
|
||||
## 效果
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins, with a
|
||||
#| best fit line of the relationship between these two variables
|
||||
#| overlaid. The plot displays a positive, fairly linear, and relatively
|
||||
#| strong relationship between these two variables. Species (Adelie,
|
||||
#| Chinstrap, and Gentoo) are represented with different colors and
|
||||
#| shapes. The relationship between body mass and flipper length is
|
||||
#| roughly the same for these three species, and Gentoo penguins are
|
||||
#| larger than penguins from the other two species.
|
||||
penguins |>
|
||||
ggplot(aes(x = flipper_length_mm, y = body_mass_g)) +
|
||||
geom_point(aes(color = species, shape = species)) +
|
||||
geom_smooth(method = "lm") +
|
||||
labs(
|
||||
title = "Body mass and flipper length",
|
||||
subtitle = "Dimensions for Adelie, Chinstrap, and Gentoo Penguins",
|
||||
x = "Flipper length (mm)",
|
||||
y = "Body mass (g)",
|
||||
color = "Species",
|
||||
shape = "Species"
|
||||
) +
|
||||
scale_color_colorblind()
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| A blank, gray plot area.
|
||||
|
||||
ggplot(data = penguins)
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| The plot shows flipper length on the x-axis, with values that range from
|
||||
#| 170 to 230, and body mass on the y-axis, with values that range from 3000
|
||||
#| to 6000.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
)
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. The plot
|
||||
#| displays a positive, linear, and relatively strong relationship between
|
||||
#| these two variables.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. The plot
|
||||
#| displays a positive, fairly linear, and relatively strong relationship
|
||||
#| between these two variables. Species (Adelie, Chinstrap, and Gentoo)
|
||||
#| are represented with different colors.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g, color = species)
|
||||
) +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. Overlaid
|
||||
#| on the scatterplot are three smooth curves displaying the
|
||||
#| relationship between these variables for each species (Adelie,
|
||||
#| Chinstrap, and Gentoo). Different penguin species are plotted in
|
||||
#| different colors for the points and the smooth curves.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g, color = species)
|
||||
) +
|
||||
geom_point() +
|
||||
geom_smooth(method = "lm")
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. Overlaid
|
||||
#| on the scatterplot is a single line of best fit displaying the
|
||||
#| relationship between these variables for each species (Adelie,
|
||||
#| Chinstrap, and Gentoo). Different penguin species are plotted in
|
||||
#| different colors for the points only.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point(mapping = aes(color = species)) +
|
||||
geom_smooth(method = "lm")
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. Overlaid
|
||||
#| on the scatterplot is a single line of best fit displaying the
|
||||
#| relationship between these variables for each species (Adelie,
|
||||
#| Chinstrap, and Gentoo). Different penguin species are plotted in
|
||||
#| different colors and shapes for the points only.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point(mapping = aes(color = species, shape = species)) +
|
||||
geom_smooth(method = "lm")
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins, with a
|
||||
#| line of best fit displaying the relationship between these two variables
|
||||
#| overlaid. The plot displays a positive, fairly linear, and relatively
|
||||
#| strong relationship between these two variables. Species (Adelie,
|
||||
#| Chinstrap, and Gentoo) are represented with different colors and
|
||||
#| shapes. The relationship between body mass and flipper length is
|
||||
#| roughly the same for these three species, and Gentoo penguins are
|
||||
#| larger than penguins from the other two species.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point(aes(color = species, shape = species)) +
|
||||
geom_smooth(method = "lm") +
|
||||
labs(
|
||||
title = "Body mass and flipper length",
|
||||
subtitle = "Dimensions for Adelie, Chinstrap, and Gentoo Penguins",
|
||||
x = "Flipper length (mm)", y = "Body mass (g)",
|
||||
color = "Species", shape = "Species"
|
||||
) +
|
||||
scale_color_colorblind()
|
||||
```
|
||||
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins, colored
|
||||
#| by bill depth. A smooth curve of the relationship between body mass
|
||||
#| and flipper length is overlaid. The relationship is positive,
|
||||
#| fairly linear, and moderately strong.
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point(aes(color = bill_depth_mm)) +
|
||||
geom_smooth()
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g, color = island)
|
||||
) +
|
||||
geom_point() +
|
||||
geom_smooth(se = FALSE)
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point() +
|
||||
geom_smooth()
|
||||
|
||||
ggplot() +
|
||||
geom_point(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_smooth(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
)
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(x = flipper_length_mm, y = body_mass_g)
|
||||
) +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
## 分层展示
|
||||
|
||||
```{r}
|
||||
|
||||
ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
## 柱状图
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| A bar chart of frequencies of species of penguins: Adelie
|
||||
#| (approximately 150), Chinstrap (approximately 90), Gentoo
|
||||
#| (approximately 125).
|
||||
|
||||
ggplot(penguins, aes(x = species)) +
|
||||
geom_bar()
|
||||
```
|
||||
|
||||
## 柱状图
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| A bar chart of frequencies of species of penguins, where the bars are
|
||||
#| ordered in decreasing order of their heights (frequencies): Adelie
|
||||
#| (approximately 150), Gentoo (approximately 125), Chinstrap
|
||||
#| (approximately 90).
|
||||
|
||||
ggplot(penguins, aes(x = fct_infreq(species))) +
|
||||
geom_bar()
|
||||
```
|
||||
|
||||
## 直方图
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A histogram of body masses of penguins. The distribution is unimodal
|
||||
#| and right skewed, ranging between approximately 2500 to 6500 grams.
|
||||
|
||||
ggplot(penguins, aes(x = body_mass_g)) +
|
||||
geom_histogram(binwidth = 200)
|
||||
```
|
||||
|
||||
## 直方图
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| layout-ncol: 2
|
||||
#| fig-width: 3
|
||||
#| fig-alt: |
|
||||
#| Two histograms of body masses of penguins, one with binwidth of 20
|
||||
#| (left) and one with binwidth of 2000 (right). The histogram with binwidth
|
||||
#| of 20 shows lots of ups and downs in the heights of the bins, creating a
|
||||
#| jagged outline. The histogram with binwidth of 2000 shows only three bins.
|
||||
|
||||
ggplot(penguins, aes(x = body_mass_g)) +
|
||||
geom_histogram(binwidth = 20)
|
||||
ggplot(penguins, aes(x = body_mass_g)) +
|
||||
geom_histogram(binwidth = 2000)
|
||||
```
|
||||
|
||||
## 密度图
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| A density plot of body masses of penguins. The distribution is unimodal
|
||||
#| and right skewed, ranging between approximately 2500 to 6500 grams.
|
||||
|
||||
ggplot(penguins, aes(x = body_mass_g)) +
|
||||
geom_density()
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 箱图
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| Side-by-side box plots of distributions of body masses of Adelie,
|
||||
#| Chinstrap, and Gentoo penguins. The distribution of Adelie and
|
||||
#| Chinstrap penguins' body masses appear to be symmetric with
|
||||
#| medians around 3750 grams. The median body mass of Gentoo penguins
|
||||
#| is much higher, around 5000 grams, and the distribution of the
|
||||
#| body masses of these penguins appears to be somewhat right skewed.
|
||||
|
||||
ggplot(penguins, aes(x = species, y = body_mass_g)) +
|
||||
geom_boxplot()
|
||||
```
|
||||
|
||||
## 分组
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A density plot of body masses of penguins by species of penguins. Each
|
||||
#| species (Adelie, Chinstrap, and Gentoo) is represented with different
|
||||
#| colored outlines for the density curves.
|
||||
|
||||
ggplot(penguins, aes(x = body_mass_g, color = species)) +
|
||||
geom_density(linewidth = 0.75)
|
||||
```
|
||||
|
||||
## 分组
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A density plot of body masses of penguins by species of penguins. Each
|
||||
#| species (Adelie, Chinstrap, and Gentoo) is represented in different
|
||||
#| colored outlines for the density curves. The density curves are also
|
||||
#| filled with the same colors, with some transparency added.
|
||||
|
||||
ggplot(penguins, aes(x = body_mass_g, color = species, fill = species)) +
|
||||
geom_density(alpha = 0.5)
|
||||
```
|
||||
|
||||
## 分组
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| Bar plots of penguin species by island (Biscoe, Dream, and Torgersen)
|
||||
ggplot(penguins, aes(x = island, fill = species)) +
|
||||
geom_bar()
|
||||
```
|
||||
|
||||
## 分组
|
||||
|
||||
```{r}
|
||||
#| fig-alt: |
|
||||
#| Bar plots of penguin species by island (Biscoe, Dream, and Torgersen)
|
||||
#| the bars are scaled to the same height, making it a relative frequencies
|
||||
#| plot
|
||||
|
||||
ggplot(penguins, aes(x = island, fill = species)) +
|
||||
geom_bar(position = "fill")
|
||||
```
|
||||
|
||||
## 分组
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. The plot
|
||||
#| displays a positive, linear, relatively strong relationship between
|
||||
#| these two variables.
|
||||
|
||||
ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
## 分组
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. The plot
|
||||
#| displays a positive, linear, relatively strong relationship between
|
||||
#| these two variables. The points are colored based on the species of the
|
||||
#| penguins and the shapes of the points represent islands (round points are
|
||||
#| Biscoe island, triangles are Dream island, and squared are Torgersen
|
||||
#| island). The plot is very busy and it's difficult to distinguish the shapes
|
||||
#| of the points.
|
||||
|
||||
ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
|
||||
geom_point(aes(color = species, shape = island))
|
||||
```
|
||||
|
||||
## 分面
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
#| fig-width: 8
|
||||
#| fig-asp: 0.33
|
||||
#| fig-alt: |
|
||||
#| A scatterplot of body mass vs. flipper length of penguins. The shapes and
|
||||
#| colors of points represent species. Penguins from each island are on a
|
||||
#| separate facet. Within each facet, the relationship between body mass and
|
||||
#| flipper length is positive, linear, relatively strong.
|
||||
|
||||
ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
|
||||
geom_point(aes(color = species, shape = species)) +
|
||||
facet_wrap(~island)
|
||||
```
|
||||
|
||||
## 分面
|
||||
|
||||
```{r}
|
||||
#| warning: false
|
||||
|
||||
ggplot(
|
||||
data = penguins,
|
||||
mapping = aes(
|
||||
x = bill_length_mm, y = bill_depth_mm,
|
||||
color = species, shape = species
|
||||
)
|
||||
) +
|
||||
geom_point() +
|
||||
labs(color = "Species")
|
||||
```
|
||||
|
||||
## 练习
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
#| layout-ncol: 2
|
||||
|
||||
ggplot(penguins, aes(x = island, fill = species)) +
|
||||
geom_bar(position = "fill")
|
||||
ggplot(penguins, aes(x = species, fill = island)) +
|
||||
geom_bar(position = "fill")
|
||||
```
|
||||
|
||||
## 练习
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
|
||||
ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
|
||||
geom_point()
|
||||
```
|
||||
|
||||
## 练习
|
||||
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
|
||||
ggplot(mpg, aes(x = class)) + geom_bar()
|
||||
```
|
||||
|
||||
## 练习
|
||||
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
|
||||
ggplot(mpg, aes(x = cty, y = hwy)) + geom_point()
|
||||
```
|
||||
|
||||
## 练习
|
||||
|
||||
```{r}
|
||||
#| echo: false
|
||||
|
||||
ggplot(data = mpg) +
|
||||
geom_point(mapping = aes(x = displ, y = hwy))
|
||||
```
|
||||
|
||||
## 欢迎讨论!{.center}
|
||||
|
||||
|
||||
`r rmdify::slideend(wechat = FALSE, type = "public", tel = FALSE, thislink = "https://drwater.rcees.ac.cn/course/public/RWEP/@PUB/SD/")`
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 61 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue