1

If I have a font in which lookups exist c2sc as built-in, there is a command to make small caps capital letters without incurring complicated codes like this: Convert all-caps words to small caps I mean something like \textsc{...}, but with uppercase?

user41063
  • 1,967
  • 1
    What do you mean exactly with textsc but with upper case? Do you want to convert to smallcaps? Or to normal caps? Something else? To make it a bit more concrete: can you provide a small document that illustrates what you want, with a screenshot of the current output and a description or mock-up screenshot of how you want the output to look? – Marijn May 22 '19 at 21:11
  • Or do you just mean something like \textsc{\MakeLowercase{YOURTEXT}}? – Marijn May 22 '19 at 21:14
  • 2
    Most caps/smcaps fonts have both styles. Not tested: try \MakeUppercase{Xxxx...} to use the "real" uppercase. – barbara beeton May 22 '19 at 21:15
  • Some OpenType fonts support this as a font feature, Capitals to Small Caps, which is available in fontspec. – Davislor May 22 '19 at 21:21
  • I mean to write something like \textsc{TEXT} and obtain in small caps. My font has real smcp and two lookups: smcp (lowercase to small caps), which works with \textsc: and c2sc (capitals to smallcaps) – user41063 May 22 '19 at 21:29
  • I use \def\smcp#1{{\addfontfeature{Letters=UppercaseSmallCaps}#1}}. – Thérèse May 22 '19 at 23:38
  • Fine, thanx! But is there a differenze in writing \def\smcp#1{{\addfontfeature{Letters=UppercaseSmallCaps}#1}} or \newrobustcmd\smcp[1]{{\addfontfeature{Letters=UppercaseSmallCaps}#1}} ? – user41063 May 23 '19 at 11:01

1 Answers1

3

You can write your own declarations and commands for c2sc and for putting everything in small caps:

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{EB Garamond}
%%% make uppercase letters small caps:
% declaration
\DeclareRobustCommand\csc{\addfontfeature{Letters=UppercaseSmallCaps}}
% command
\DeclareTextFontCommand{\textcsc}{\csc}

%%% make all letters small caps:
% declaration
\DeclareRobustCommand\asc{\addfontfeature{Letters=UppercaseSmallCaps,Letters=SmallCaps}}
% command
\DeclareTextFontCommand{\textasc}{\asc}
\begin{document}
{\csc This declaration gives UPPERCASE SMALL CAPS.}

\textcsc{This command gives UPPERCASE SMALL CAPS.}

{\asc Now lower- and UPPERCASE letters are all small caps.}

This is \textasc{a TEST.} This is \textasc{only a TEST.}
\end{document}

output

In most cases, there’s no advantage to doing this. But with EB Garamond and some commercial fonts, text in \textsc{...} copies as lowercase, while text set with c2sc copies as uppercase.

Thérèse
  • 12,679
  • thank you. In any case \def is a Tex primitive, \newrobustcmd not and makes some contols before its execution. Here they are more or less the same – user41063 May 25 '19 at 15:40