update template

This commit is contained in:
2025-01-08 10:18:39 +08:00
parent 425607160d
commit 7305aca59a
7 changed files with 251 additions and 161 deletions
+25 -21
View File
@@ -12,42 +12,46 @@ bibliography: [../BB/Ref.bib, ../BB/localRef.bib]
csl: _extensions/inst/tex/elsevier-harvard.csl
format:
elsevier-html:
toc: true
css: _extensions/inst/css/style.css
keep-md: true
epub: default
docx:
reference-doc: _extensions/inst/word/MS.docx
elsevier-pdf:
keep-tex: false
pdf:
# documentclass: article
latex-clean: false # to keep aux
citecolor: blue
colorlinks: true
number-sections: true
sansfont: "Gill Sans"
papersize: a4paper
sansfontoptions:
- Color=39729E
mainfont: "Source Sans 3" #| Verdana (fontsize: 11pt) # Source Sans 3 | Times New Roman| Helvetica | PT Sans
monofont: "JetBrains Mono"
mathfont: "Cambria Math"
CJKmainfont: SimHei
fontsize: 12pt
keep-md: false
include-in-header: "./_extensions/quarto-journals/elsevier/partials/revision.tex"
latex-clean: false
include-in-header: "./_extensions/inst/tex/header.tex"
header-includes:
# - \usepackage{threeparttable}
# - \usepackage{fontspec}
# - \usepackage{endfloat}
- \setmainfont{Calibri}
- \usepackage[UTF8, scheme=plain]{ctex}
- \usepackage{endfloat}
# - \usepackage[UTF8, scheme=plain]{ctex}
- \usepackage{float}
- \usepackage[normalem]{ulem}
- \usepackage[doublespacing]{setspace}
- \usepackage{lineno}
- \linenumbers
journal:
formatting: preprint # preprint | review | doublebind
model: 1p
cite-style: authoryear
# graphical-abstract: "![](../figures/GA3.pdf)"
# highlights:
# - A comprehensive model was contructed to evaluate the risk of odor occurrences
# - Turbidity distribution determine underwater light and MIB-producing *Planktothrix*
# - Increasing flowrate increases turbidity that can control *Planktothrix* and MIB
# - Odor control based on flow regulation in source water is "green" and fundamental
filters:
- latex-environment
- authors-block
- latex-environment
- authors-block
lightbox: auto
commands: [clab]
editor:
markdown:
wrap: sentence
---
@@ -75,7 +79,7 @@ require(lubridate)
require(patchwork)
require(drwateR)
rmdify::rmd_init()
biburl <- "http://drwater.rcees.ac.cn/cloud/s/ref_ming/download/Ref.bib"
biburl <- "https://drc.drwater.net/datapool/public/BB/Ref.bib"
if (!isRendering) { download.file(biburl, destfile = "Ref.bib") }
```
+25 -14
View File
@@ -8,23 +8,32 @@ format:
css: _extensions/inst/css/style.css
docx:
reference-doc: _extensions/inst/word/MS.docx
elsevier-pdf:
classoption: [nopreprintline]
revision: true
keep-tex: true
latex-clean: false
include-in-header: "./_extensions/quarto-journals/elsevier/partials/revision.tex"
pdf:
# documentclass: article
latex-clean: false # to keep aux
citecolor: blue
colorlinks: true
number-sections: false
sansfont: "Gill Sans"
papersize: a4paper
sansfontoptions:
- Color=39729E
mainfont: "Source Sans 3" #| Verdana (fontsize: 11pt) # Source Sans 3 | Times New Roman| Helvetica | PT Sans
monofont: "JetBrains Mono"
mathfont: "Cambria Math"
CJKmainfont: SimHei
fontsize: 12pt
keep-md: false
include-in-header: "./_extensions/inst/tex/header.tex"
header-includes:
- \let\oldsection\section
- \renewcommand{\section}{\clearpage\oldsection}
# - \usepackage{threeparttable}
# - \usepackage{fontspec}
# - \usepackage[nomarkers]{endfloat}
- \usepackage[normalem]{ulem}
- \renewcommand{\thetable}{S\arabic{table}}
- \renewcommand{\thefigure}{S\arabic{figure}}
- \renewcommand{\theequation}{S\arabic{equation}}
- \setmainfont{Calibri}
# - \usepackage{endfloat}
# - \setmainfont{Calibri}
# - \usepackage[UTF8, scheme=plain]{ctex}
# - \usepackage{float}
- \usepackage{float}
- \usepackage[normalem]{ulem}
- \usepackage[doublespacing]{setspace}
- \usepackage{lineno}
@@ -32,9 +41,11 @@ format:
filters:
- latex-environment
- authors-block
lightbox: auto
commands: [clab]
---
```{r}
#| label: setup
#| include: false
@@ -47,7 +58,7 @@ require(lubridate)
require(patchwork)
require(drwateR)
rmdify::rmd_init()
biburl <- "http://drwater.rcees.ac.cn/datapool/public/BB/Ref.bib"
biburl <- "https://drc.drwater.net/datapool/public/BB/Ref.bib"
if (!isRendering) { download.file(biburl, destfile = "Ref.bib") }
```
+3 -3
View File
@@ -284,7 +284,7 @@ $endif$
\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$
$for(author)$$if(author.correspondence)$\def\hascorr{1}$endif$$if(author.equal-contributor)$\def\haseqc{1}$endif$ $endfor$
\newcommand{\getcorrauthinfo}{
\subsection{Corresponding Author(s)}
@@ -361,7 +361,7 @@ $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$
$for(author)$\author$if(authorwithinstitute)$[$for(author.institute)$$author.institute$$sep$,$endfor$]$endif${$author.name$$if(author.correspondence)$\corref{corrauth}$endif$$if(author.equal-contributor)$\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
@@ -373,7 +373,7 @@ $endfor$
% generate equal contributing authors.
\ifnum \haseqc=1
\def\eqa{$for(author)$$if(author.equalcontribution)$and $author.name$ $endif$$endfor$}
\def\eqa{$for(author)$$if(author.equal-contributor)$and $author.name$ $endif$$endfor$}
\cortext[eqcon]{\StrBehind*{\eqa}{and } are equally contributed to this work.}
\fi
+74
View File
@@ -0,0 +1,74 @@
\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}
\setkomafont{author}{\normalsize}
\makeatletter
\renewcommand{\title}[1]{\gdef\@title{\large\textbf{#1}}} % Adjust \Huge or other font commands
% \renewcommand{\author}[1]{\gdef\@author{\normalsize\textrm{#1}}} % Adjust \Huge or other font commands
% \renewcommand{\author}[1]{\normalsize\textit{#1}} % Use \normalsize and \textit for customization
\makeatother
\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}}
@@ -19,178 +19,174 @@ THIS SOFTWARE.
-- from @kapsner
-- [import]
local from_utils = require "utils"
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 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 == 'latex'
and {pandoc.RawInline('latex', '*')}
or {pandoc.Str ''},
equal_contributor = FORMAT == 'latex'
and {pandoc.RawInline('latex', '$\\dagger{}$')}
or {pandoc.Str '*'},
corresponding_author = FORMAT == "latex" and { pandoc.RawInline("latex", "*") } or { pandoc.Str("") },
equal_contributor = FORMAT == "latex" and { pandoc.RawInline("latex", "") } 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["equal-contributor"]
end
return nil
if has_key(author, "attributes") then
return author.attributes["equal-contributor"]
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)}
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
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
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))
}
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["equal-contributor"] 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 'latex' 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
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["equal-contributor"] 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("latex") 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 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
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()}))}
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
@@ -7,6 +7,11 @@
\usepackage{zref-xr,zref-hyperref,zref-user}
\usepackage{xr-hyper}
\makeatletter
\renewcommand{\title}[1]{\gdef\@title{\Large\textbf{#1}}} % Adjust \Huge or other font commands
% \renewcommand{\author}[1]{\gdef\@author{\normalsize\textrm{#1}}} % Adjust \Huge or other font commands
% \renewcommand{\author}[1]{\normalsize\textit{#1}} % Use \normalsize and \textit for customization
\makeatother
\usepackage{adjustbox}
% \usepackage{xcolor}
+6 -6
View File
@@ -8,7 +8,7 @@ author:
- name: Ming Su
email: mingsu@rcees.ac.cn
orcid: 0000-0001-9821-1268
url: https://drwater.rcees.ac.cn
url: https://drwater.net/team/ming-su/
affiliations:
- ref: skleac
- ref: ucas
@@ -110,11 +110,11 @@ project:
website:
title: "Version: {{< var branch >}}"
reader-mode: true
site-url: https://drwater.rcees.ac.cn/{{< var pubtype >}}/{{< var projtype >}}/{{< var reponame >}}/@{{< var branch >}}
repo-url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}
site-url: https://drc.drwater.net/{{< var pubtype >}}/{{< var projtype >}}/{{< var reponame >}}/{{< var branch >}}
repo-url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}
repo-actions: [edit, source, issue]
page-navigation: true
page-footer: "Copyright 2023, [Ming Su](https://drwater.rcees.ac.cn)"
page-footer: "Copyright 2024, [Dr. Water](https://drwater.net)"
navbar:
background: "grey"
search: true
@@ -145,9 +145,9 @@ website:
- icon: git
menu:
- text: Edit
url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}}
url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}}
- text: Issue
url: https://drwater.rcees.ac.cn/git/manuscript/{{< var reponame >}}/issues
url: https://git.drwater.net/manuscript/{{< var reponame >}}/issues
comments:
hypothesis:
theme: clean