4

I have a reference to a paper, e.g. this paper. With in the paper I have made various highlights and annotations such as this one. In my document I would like to be able to use some form of bibtex / biblatex entry like:

@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, ... }

And then in the text do something like:

Lorem \cite{Nolte2020} ipsum dolor sit
amet \cite{Nolte2020,anotherPaper}{h1n1} something else \cite{Nolte2020}{crowd}.

The text above should get rendered to the following text:

Lorem [1] ipsum dolor sit amet [1a,2] something else [1b].

And in the reference list it's shown as:

[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 ...

I think the term subreference might already have a specific definition and one which is different to what I am trying to communicate here. But does anyone know if this is possible already? If it's not possible, an answer saying so and whether it would be possible to implement as an extension for biblatex would be appreciated. I am an experience programmer but do not yet know Latex very well at all so wanted to get some high level advice or preferably avoid reinventing the wheel if it's already done.

1 Answer 1

0

Thanks to a lot of help here and here the following code works. I have pushed up a repo here and will aim to publish it as a package on 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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .