Closed bastien-roucaries closed 2 years ago
Do you have a test document for that?
\documentclass{article}
\usepackage{csquotes}
\usepackage[colorlinks,unicode,breaklinks]{hyperref}
\usepackage[backend=biber,backref=true,citetracker,labelnumber=true,sortcites=true, subentry,dateusetime=true,sortsets=true,bibstyle=ext-numeric-comp,citestyle=ext-numeric-comp,mincrossrefs=2,citexref=true]{biblatex}
\begin{filecontents}{\jobname.bib}
@Inproceedings{a,
title = {First},
author = {Leon, F},
crossref = {c}
}
@Inproceedings{b,
title = {Second},
author = {Leon, F},
crossref = {c}
}
@Proceedings{c,
title = {c},
author = {Leon, F},
url = {https://example.com}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareFieldFormat{url}{
\ifcrossrefsource{crossref only}{bug}
}
\begin{document}
\cite{a,b}
\printbibliography
\end{document}
Thanks for the example document.
The problem appears to be caused by the fact that citexref=true,
is implemented internally - as the name suggests - via an actual citation command. That means that the parent entry ends up being cited and thus the "only crossref" test returns false.
On first glance it appears possible to do what we're currently doing with a real cite command with \entrydata
and in fact I find that slightly more attractive anyway, because \cite
commands in the bibliography come with their own set of issues. I'll have to double-check if there the switch causes other problems though.
If you want something to play with, the following works for your setup style=ext-numeric-comp,
\documentclass[british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=ext-numeric-comp, mincrossrefs=2, citexref=true]{biblatex}
\usepackage[colorlinks,unicode,breaklinks]{hyperref}
\makeatletter
\DeclareFieldFormat{outerbbxrefcitedelims}{\mkouterbbx@xrefcitedelims{#1}}
\renewcommand{\bbx@xrefcite}[1]{%
\printtext[outerbbxrefcitedelims]{%
\entrydata{#1}{%
\usebibmacro{cite:init}%
\usebibmacro{cite:comp}%
\usebibmacro{cite:dump}}}}
\makeatother
\begin{filecontents}{\jobname.bib}
@Inproceedings{a,
title = {First},
author = {Leon, F},
crossref = {c}
}
@Inproceedings{b,
title = {Second},
author = {Leon, F},
crossref = {c}
}
@Proceedings{c,
title = {c},
author = {Leon, F},
url = {https://example.com}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareFieldFormat{url}{%
\ifcrossrefsource{crossref only}{bug}%
}
\begin{document}
\cite{a,b}
\printbibliography
\end{document}
Thanks seems to work
Could be possible to unprotect and document the \bbx@xrefcite ? I need this kind of macro for my patent extension
I'll see what I can do in the rewrite, but I don't think I want to make it fully public. It is an internal definition. (And if I had documented it publicly as a cite command, I'd be in big trouble now, because I wouldn't be able to change its definition just like that.)
Initially the idea ways that bbx:inxrefcite
would be the official interface, but some of the styles don't actually use that for aesthetic reasons, so the current situation is a bit unfortunate. Ideally we could also resolve that issue.
If you could explain in more detail what exactly you need this macro for in your project and why that would help me a great deal as it would give me an idea of what interface might be useful.
Turns out I had the required code lying around here in an unused branch for quite some while. If you can find the time it would be great if you could have a look at https://github.com/moewew/biblatex-ext/tree/rebxrefcite and give it a spin.
work like a charm
Thanks for the feedback. The changes are merged to dev
now. I'll release them in the not-to-distant future (think the next weekend) if nothing goes wrong.
biblatex-ext
v0.16 with the fix was sent off to CTAN yesterday and is already available in TeX Live (and I assume soon also in MikTeX).
Hi,
I I use citexref=true I could not use the \ifcrossrefsource test because the citexref create a cite link. Idem for \ifxrefsource
Could you fix it ?