If I use \textsc{xyz} with a font that has no small caps (e.g. Latin Modern Sans), the result is typeset in lower case. Is it possible to automatically fallback to all-caps instead? I cannot do this manually since I want to use small caps in a macro.



\acronym{abc} is an acronym.

\item [\textsc{\acronym{abc}}] Trying to use \textbackslash{}acronym with LM Sans
\item[ABC] This is what it should look like

enter image description here


1 Answer 1


My original answer referred the OP to my \fauxsc macro, but that is not what the OP wanted. Importantly, the OP wants the discernment of the availability of small caps in the font to be automatic.

So I revised the answer to provide \detectsc to detect the presence of small caps or not. It works by assuming that an invocation of \textsc in the absence of small caps gets converted to an \textup equivalent. To detect this situation, it places, in two respective boxes, \textsc{i} and \textup{i}. It then compares the width and height of these two boxes. If they are the same, the small caps must be missing, and so it \let\textsc\uppercase, which is the behavior desired by the OP in the absence of a small caps font.

REEDITED so that if a valid sc font is detected by \detectsc, the original definition of \textsc is restored or left intact, as the case may be. This is important if sc is valid in one font family but not another.

Here is my MWE, which can be compiled under pdflatex (uses lmodern) and the xelatex (uses Myriad Pro), with two different results:



  \setsansfont{Myriad Pro}



Compiler: \compiler

\textsc{Abc} before \detokenize{\detectsc}\par
\detectsc \textsc{Abc} after \detokenize{\detectsc}\par
Resetting \detokenize{\textsc}\rmfamily\let\textsc\svtextsc\par
\textsc{Abc} before \detokenize{\detectsc}\par
\detectsc \textsc{Abc} after \detokenize{\detectsc}

Here (with lmodern), detecting the distinction between \textsc and \textup, it leaves \textsc intact.

enter image description here

But under xelatex (with Myriad Pro sans), it detects no distinction in \sffamily between \textup and \textsc, and so it redefines \textsc to be \uppercase. However, in \rmfamily, it will reinstate or leave intact \textsc{} definition.

enter image description here

  • nice! But what about the OP's requirement that \textsc is used when shapes are available, and \fauxsc is used otherwise, automatically?
    – Bordaigorl
    Oct 17, 2015 at 5:32
  • @Bordaigorl I do not know enough to do it automatically. But if I learn how to do so, I will update my answer. Oct 17, 2015 at 15:00
  • In fact, this does not answer my question at all. I don't want to have lower quality small caps but all caps.
    – Nova
    Oct 18, 2015 at 16:19
  • @Erik, Seeing as this answer does not appeal to you at all, I will delete my answer, after giving you a chance to read this comment. Oct 18, 2015 at 16:21
  • 1
    Yes, making it automatic is the point. Otherwise I could just use \uppercase (or write capital letters to begin with).
    – Nova
    Oct 18, 2015 at 16:29

You must log in to answer this question.

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