我有一篇论文的参考,例如这张纸。在论文中我做了各种强调和注释,例如这个。在我的文档中,我希望能够使用某种形式的 bibtex / biblatex 条目,例如:
@article{Nolte2020,
doi = {10.1016/j.jmoldx.2020.06.003},
url = {https://doi.org/10.1016/j.jmoldx.2020.06.003},
% ... other fields ...
subreferences = {
h1n1 = {https://hyp.is/94iqCB9_EeuQCNcJXiV1IA/www.jmdjournal.org/article/S1525-1578(20)30360-3/fulltext},
crowd = {https://hyp.is/gTHBhB6_EeudDw8HxXC_sg/www.jmdjournal.org/article/S1525-1578(20)30360-3/fulltext}
}
}
@article{anotherPaper, ... }
然后在文本中执行以下操作:
Lorem \cite{Nolte2020} ipsum dolor sit
amet \cite{Nolte2020,anotherPaper}{h1n1} something else \cite{Nolte2020}{crowd}.
上述文本应呈现为以下文本:
Lorem [1] ipsum dolor sit amet [1a,2] something else [1b].
在参考文献中显示为:
[1] Frederick S. Nolte et al. “Responding to the Challenges of Severe Acute Respiratory
Syndrome Coronavirus 2 (SARS-CoV-2)”. In: The Journal of Molecular Diagnostics 22.8
(Aug.2020), pp. 968–974. DOI: 10.1016/j.jmoldx.2020.06.003
URL: https://doi.org/10.1016/j.jmoldx.2020.06.003
[1a] https://hyp.is/94iqCB9_EeuQCNcJXiV1IA/www.jmdjournal.org/article/S1525-1578(20)30360-3/fulltext
[1b] https://hyp.is/gTHBhB6_EeudDw8HxXC_sg/www.jmdjournal.org/article/S1525-1578(20)30360-3/fulltext
[2] Another paper ...
我认为术语“子引用”可能已经有了特定的定义,并且与我在这里试图传达的定义不同。但有人知道这是否已经可能了吗?如果不可能,请给出答案,以及是否可以将其作为扩展来实现比布拉特克斯不胜感激。我是一名经验丰富的程序员,但对 Latex 还不是很了解,所以想获得一些高水平的建议,或者最好避免重新发明轮子(如果已经做过了)。
答案1
感谢大家的帮助这里和这里以下代码有效。我有在这里推了一个 repo并将致力于将其作为 CTAN 上的一个包发布:
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
%\usepackage{subcitations}
\usepackage{listofitems}
\usepackage{xifthen}
\usepackage{xstring}
\usepackage[backend=biber, style=numeric, subentry]{biblatex}
\begin{filecontents}{\jobname2.bib}
@set{yoon,
entryset = {yoonmain,yoonsub1},
}
@article{yoonmain,
author = {Yoon},
title = {A paper},
journaltitle = {Jounral Title},
date = 2020,
}
@misc{yoonsub1,
url={http://sub1.com}
}
@article{other2,
url={http://other2.example.com}
}
@article{other3,
url={http://other3.example.com}
}
\end{filecontents}
\addbibresource{\jobname2.bib}
\newcommand{\subcite}[2][NOTDEFINED]{%
% Split the names of the references and the sub-citations on commas
\readlist*\mains{#2}%
\ifthenelse{\equal{#1}{NOTDEFINED}}
{\edef\subslen{0}}
{\readlist*\subs{#1}}%
%
% Define string to hold citations
\edef\citations{}%
\foreachitem\x\in\mains[]{%
\ifnum\xcnt>1\relax%
\edef\citations{\citations,\x}%
\else%
\edef\citations{\citations\x}%
\fi%
%
\ifnum\xcnt>\subslen%
\else%
\edef\citations{\citations\subs[\xcnt]}%
\fi%
}%
%
\expandafter\cite\expandafter{\citations}%
\expandafter\nocite\expandafter{#2}%
}
\begin{document}
Lorem \subcite[,sub1]{other2,yoon,other3}
Ipsum \subcite{other2,yoon,other3}
\printbibliography
\end{document}