bir*_*ird 6 pdf latex r pdflatex quarto
在我的一份文件yaml
中:quarto
---\ntitle: "Hey!"\nauthor:\n - name: Birdy Bird\n affiliations:\n - University of Birds\n - University of Hummingbirds\nformat: pdf\neditor: visual\n---\n
Run Code Online (Sandbox Code Playgroud)\n当我使用 IDE 渲染此文件时Rstudio
,我得到:
我期待他们的数字的从属关系(例如 1、2 作为上标)会出现在某个地方。
\nR版本:
\n> sessionInfo()\nR version 4.2.2 (2022-10-31)\nPlatform: aarch64-apple-darwin20 (64-bit)\nRunning under: macOS Ventura 13.1\n\nMatrix products: default\nLAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib\n\nlocale:\n[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8\n\nattached base packages:\n[1] stats graphics grDevices utils datasets methods base \n\nloaded via a namespace (and not attached):\n[1] compiler_4.2.2 tools_4.2.2 \n
Run Code Online (Sandbox Code Playgroud)\nRstudio版本
\n> rstudioapi::versionInfo()\n$citation\n\nTo cite RStudio in publications use:\n\n Posit team (2022). RStudio: Integrated Development Environment for R. Posit Software, PBC, Boston, MA. URL\n http://www.posit.co/.\n\nA BibTeX entry for LaTeX users is\n\n @Manual{,\n title = {RStudio: Integrated Development Environment for R},\n author = {{Posit team}},\n organization = {Posit Software, PBC},\n address = {Boston, MA},\n year = {2022},\n url = {http://www.posit.co/},\n }\n\n\n$mode\n[1] "desktop"\n\n$version\n[1] \xe2\x80\x982022.12.0.353\xe2\x80\x99\n\n$long_version\n[1] "2022.12.0+353"\n\n$release_name\n[1] "Elsbeth Geranium"\n
Run Code Online (Sandbox Code Playgroud)\n四开版:
\n> quarto::quarto_version()\n[1] \xe2\x80\x981.2.269\xe2\x80\x99\n
Run Code Online (Sandbox Code Playgroud)\n
我的猜测是 Quarto 的默认 pdf 格式不支持作者隶属关系,因为quarto 的 pdf 格式参考中没有此类提及。
在四开本文档中,作者和附属机构讨论了在创建期刊文章四开本扩展时访问作者和附属机构元数据的方法。
但是,可以使用以下LaTeX Partial title.tex
很好地添加作者的隶属关系,该部分使用 Latex 包authblk
进行良好的格式设置和控制格式设置的选项。
(确保将title.tex和quarto-file.qmd放在同一目录中)
标题.tex
$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$
$if(subtitle)$
\subtitle{$subtitle$}
$endif$
$for(by-author)$
\author{$by-author.name.literal$}
$if(by-author.affiliations)$
$for(by-author.affiliations)$
\affil{%
$if(by-author.affiliations.name)$
$by-author.affiliations.name$
$endif$
}
$endfor$
$endif$
$endfor$
\date{$date$}
Run Code Online (Sandbox Code Playgroud)
四开文件.qmd
---
title: "Hey!"
author:
- name: Birdy Bird
affiliations:
- University of Birds
- University of Hummingbirds
- name: None
affiliations:
- University of SO
- University of TeX
format:
pdf:
keep-tex: true
template-partials:
- title.tex
include-in-header:
text: |
\usepackage[noblocks]{authblk}
\renewcommand*{\Authsep}{, }
\renewcommand*{\Authand}{, }
\renewcommand*{\Authands}{, }
\renewcommand\Affilfont{\small}
---
## Quarto
Quarto enables you to weave together content and executable code into a finished
document. To learn more about Quarto see <https://quarto.org>.
Run Code Online (Sandbox Code Playgroud)
在这种情况下需要注意的关键是,该选项affil-id
需要是一个链接作者及其隶属关系的数字,并且它将对应于隶属关系键下的 id。
---
title: "Hey!"
author:
- name: Birdy Bird
affil-id: 1,2
- name: None
affil-id: 3,4
affiliations:
- id: 1
name: University of Birds
- id: 2
name: University of Hummingbirds
- id: 3
name: University of TeX
- id: 4
name: Unversity of SO
format:
pdf:
keep-tex: true
template-partials:
- title.tex
include-in-header:
text: |
\usepackage[noblocks]{authblk}
\renewcommand*{\Authsep}{, }
\renewcommand*{\Authand}{, }
\renewcommand*{\Authands}{, }
\renewcommand\Affilfont{\small}
---
## Quarto
Quarto enables you to weave together content and executable code into a finished
document. To learn more about Quarto see <https://quarto.org>.
Run Code Online (Sandbox Code Playgroud)
在这种情况下,使用以下title.tex
乳胶部分,
$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$
$if(subtitle)$
\subtitle{$subtitle$}
$endif$
$for(by-author)$
\author$if(it.metadata.affil-id)$[$it.metadata.affil-id$]$endif${$it.name.literal$}
$endfor$
$if(by-affiliation)$
$for(by-affiliation)$
\affil[$it.id$]{$it.name$}
$endfor$
$endif$
\date{$date$}
Run Code Online (Sandbox Code Playgroud)
然后按照上面的方式渲染quarto-file.qmd文件,
浏览authblk
文档以了解控制从属关系格式的方法。