25

How can I disable smallcaps within \textsc{}?

I would like to be able to disable/toggle smallcaps on a local level so that something like \textsc{o\textrm{open}mp} looks like \textsc{o}open\textsc{mp}. The reason for not doing the latter is to try to make use of the glossaries package with the smallcaps option for abbreviations. This automatically does the outer \textsc{} wrapping.

1
  • 5
    \textsc{o\textup{open}mp} should work.
    – egreg
    Oct 10, 2011 at 22:04

2 Answers 2

30

\textsc acts on the "shape" attribute; so changing again this attribute is what's needed: \textup exactly switches to "upright shape" (or Roman).

\textsc{a\textup{b}c}

will print "a" and "c" in small caps and "b" in the normal font.

1
2

As mentioned by egreg, you can use \textup instead of textsc.

One way to do this is to redefine the meaning of \textrm. I'd recommend limiting it to within the scope where you want to apply this:

\documentclass{article}
\begin{document}
{% Group here so that this is only in effect locally in this group.
\let\OldTextrm\textrm%
\renewcommand{\textrm}[1]{\textup{#1}}%
%
These should be the same:\par
\textsc{o\textrm{open}mp}\par
\textsc{o}open\textsc{mp}\par
}

These should be different:\par
\textsc{o\textrm{open}mp}\par
\textsc{o}open\textsc{mp}\par
\end{document}

You must log in to answer this question.

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