1

I am used to doing something like the following to replace the sans serif small caps (which don't exist in lmodern) by the ones of xmcss (which comes from sansmathfonts, I guess):

\documentclass{article}
\usepackage{biblatex}

\begin{filecontents}{bib.bib}
    @online{key,
        author={me},
        url={http://example.org}
    }
\end{filecontents}
\addbibresource{bib.bib}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\sffamily
\DeclareFontShape{T1}{lmss}{m}{sc}{<->ssub*xcmss/m/sc}{} % Uses xcmss font instead of lmss for sans serif small caps
\begin{document}
    Some – dash
    \nocite{*}
    \printbibliography
\end{document}

It would be a stretch to say that I really understand what's going on (besides replacing the font). Now, this won't work nicely in LuaLaTeX (for instance, the dash will make problems because There is no ��� (U+2013) in font ec-lmss10!). What can I do in that case?

Edit: I would also be ok with uppercase instead of small caps. But I cannot change what biblatex does.

3
  • 1
    don't use T1 encoded fonts in luatex, so both usepackage[T1]{fontenc} and the DeclareFontShape are wrong in that setting Oct 30, 2023 at 19:22
  • @DavidCarlisle Yes, it does: The bibliography does contain “url” in small caps. This is also why \let\textsc\MakeUppercase won't work.
    – Bubaya
    Oct 30, 2023 at 21:35
  • ah.... sorry see my image, you used a generic name bib.bib and I already had one which didn't get over-written so your example was not used. sorry that was my fault I'll clean up the comments. Oct 30, 2023 at 21:46

1 Answer 1

0

I have a modified example below which uses \textsc in the main body as well as the bib URL..

The NewComputerModern family does have sans serif small caps, so you could use that for just sans serif or for the whole document.

enter image description here

\documentclass{article}
\usepackage{biblatex}

\begin{filecontents}{bib.bib}
    @online{key,
        author={me},
        url={http://example.org}
    }
\end{filecontents}
\addbibresource{bib.bib}

\usepackage{fontspec}

\setsansfont{NewCMSans10-Regular.otf}


\renewcommand{\familydefault}{\sfdefault}
\sffamily

\begin{document}
    Some – dash  \textsc{Some Text In Small Caps}
    \nocite{*}
    \printbibliography
\end{document}
3
  • Thank you. That solves my issue. See my comment to my question why there's no \textsc in my question (and the bibliography that had no apparent connection to the topic).
    – Bubaya
    Oct 30, 2023 at 21:39
  • @Bubaya sorry about that, I fixed my example Oct 30, 2023 at 21:50
  • No worries; I wasn't very explicit about that either. Thank you in any case!
    – Bubaya
    Oct 30, 2023 at 21:59

You must log in to answer this question.

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