1

Outline: I want to highlight certain references of interest in my biblatex bibliography (using the biber backend, style chem-rsc and within a twocolumn article) with either a single asterisk or a double asterisk underneath the reference number. The text I want to be displayed underneath the entry is contained in the annote field and displays without issue and is not included here. I searched this site and found a way to add asterisks around the entry from moewe and adapted it for my requirements (underneath the reference number and with vertical space between them). Setting \vspace manually so that it aligns somewhat with the second line of text is perfectly fine (in this case \vspace{0.36cm}.

Problem: The adapted solution from moewe works fine but I am running into issues when the references run into the double digits with the asterisks not aligning as I want due to having to specify lengths. I can either have it aligned fine for entries numbered <10 or >10 but not both. I am still learning Latex and learnt what the commands in moewe's answer are doing but I am not sure how to centre the asterisks in relation to the reference number box e.g. (17) as I think that is created in a box or a similar construct via biblatex. If this is possible, how can I centre the asterisks relative to the width of the reference number box above automatically including factoring in potential font size changes?

MWE:

% arara: pdflatex: {options: [-halt-on-error]}
% arara: biber
% arara: pdflatex: {options: [-halt-on-error]}
% arara: clean: {extensions: [log, run.xml, blg, bib, bcf, bbl, aux]}

\documentclass[twocolumn]{article} \usepackage[backend=biber,natbib=true,style=chem-rsc]{biblatex} \addbibresource{biblatex-examples.bib} \addbibresource{\jobname.bib}

\newcommand{\impmarkstar}{\strut\vadjust{\domarksingle}} \newcommand{\domarksingle}{% \vbox to 0pt{ \vspace{0.36cm} \smash{\llap{*\kern-1.46em}} \vss }}

\newcommand{\impmarkdoublestar}{\strut\vadjust{\domarkdouble}} \newcommand{\domarkdouble}{% \vbox to 0pt{ \vspace{0.36cm} \smash{\llap{**\kern-1.7em}} \vss }}

\renewbibmacro*{begentry}{\ifkeyword{star}{\impmarkstar}{}% \ifkeyword{doublestar}{\impmarkdoublestar}{}}

\begin{filecontents}{\jobname.bib} @article{SingleDigitSingleStar, author = {Tim}, title = {Tittle}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2018}, keywords = {star}, } @article{SingleDigitDoubleStar, author = {Tom}, title = {Titled}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2019}, keywords = {doublestar}, } @article{DoubleDigitSingleStar, author = {Zeck}, title = {Titling}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2020}, keywords = {star}, } @article{DoubleDigitDoubleStar, author = {Zack}, title = {Title}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2017}, keywords = {doublestar}, } \end{filecontents}

\nocite{*}

\begin{document}

\cite{SingleDigitSingleStar,SingleDigitDoubleStar} \printbibliography

\end{document}

In the MWE, the asterisks are further to the left then in my main file as I removed columnsep, \footnotesize etc. The references of interest are the first two and the final two references.

Notes: These are from my actual file bibliography (not the MWE and at \footnotesize) with it being specified as a length (*\kern-1.46em} and **\kern-1.7em respectively which I understand is not the best, this is included in the MWE) and how I would like it to be for all references although preferably automatically:

Single asterisk

double asterisk

Example single digit reference number with above lengths:

enter image description here

Additionally as it is somewhat related, if anyone could comment to me if it is possible to only use say the first X biblatex entries in the biblatex-examples.bib I would appreciate it so my MWE's can become more minimal, I have had to use the whole contents of the example .bib for this.

1 Answers1

2

If you want to centre the marker under the label you need to measure the label width of the current entry and work with that. (The label width of the current entry is not available otherwise, so we measure it again using internal macros.)

Then it is just a matter of moving around in the margin until we get where want to be.

\documentclass[twocolumn]{article}
\usepackage[backend=biber,natbib=true,style=chem-rsc]{biblatex}

\makeatletter \newlength\thislabelnumberwidth \newcommand{\measurethislabeldwith}{% \ifundef\abx@field@shorthand {\blx@bbl@labelnumberwidth@numeric{this}} {\blx@bbl@labelnumberwidth@shorthand{this}}} \makeatother

\newcommand{\impmark}[1]{\strut\vadjust{\domark{#1}}} \newcommand{\domark}[1]{% \measurethislabeldwith \vbox to 0pt{% \leavevmode \kern\dimexpr\labelnumberwidth-\thislabelnumberwidth\relax \makebox[\thislabelnumberwidth][c]{#1}}}

\renewbibmacro{begentry}{% \ifkeyword{star}{\impmark{}}{}% \ifkeyword{doublestar}{\impmark{**}}{}}

\begin{filecontents}{\jobname.bib} @article{SingleDigitSingleStar, author = {Tim}, title = {Tittle}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2018}, keywords = {star}, } @article{SingleDigitDoubleStar, author = {Tom}, title = {Titled}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2019}, keywords = {doublestar}, } @article{DoubleDigitSingleStar, author = {Zeck}, title = {Titling}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2020}, keywords = {star}, } @article{DoubleDigitDoubleStar, author = {Zack}, title = {Title}, journal = {Applied Latex and a really long title so that it spans two lines}, year = {2017}, keywords = {doublestar}, } \end{filecontents} \addbibresource{\jobname.bib} \addbibresource{biblatex-examples.bib}

\nocite{*}

\begin{document} \cite{SingleDigitSingleStar,SingleDigitDoubleStar} \printbibliography \end{document}

Marker under label

moewe
  • 175,683
  • This works perfectly in the MWE but is still not central in my main file so I am not sure if another setting is affecting it. I am going to research the commands you used and learn about it but could you look at the edit images I made to see what might be causing that or what I could modify in your code to affect the lengths? –  Aug 02 '21 at 15:34
  • Found the issue, the font size I am using, \footnotesize, is affecting it. Will experiment with your code to adapt it. –  Aug 02 '21 at 15:42
  • 1
    @LaccaseTVersicolor Depending on how and when exactly you set \footnotesize it is possible that \labelnumberwidth is measured in a different font size, which would throw the calculations off. The correct way to set the bibliography font size is \renewcommand*{\bibfont}{\normalfont\footnotesize}. Do not use \AtBeginBibliography. (See, e.g. https://tex.stackexchange.com/q/474994/35864) – moewe Aug 02 '21 at 16:05
  • The comment above solved this problem in case anyone else has the same issue. –  Aug 02 '21 at 16:10
  • @LaccaseTVersicolor Great! Would it be possible to roll back your last edit to the question so that the question does not already contain reference to the code in the answer? That makes things a bit cleaner. – moewe Aug 03 '21 at 04:33
  • Removed the edit as requested, thanks for your help :) –  Aug 03 '21 at 07:35
  • @LaccaseTVersicolor Thanks. That makes the question and answer much easier to follow! – moewe Aug 03 '21 at 10:24