Fake small caps with UTF-8 on pdfTeX
Highly inefficient and no real substitute for true small caps (my suggestion is to avoid faking small caps at all costs). All common accents are covered, others can be added.
\documentclass{scrartcl}
% GENERAL STUFF - ENCODING, LANGUAGE
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
% GENERAL STUFF - FONT
\usepackage{arev}
% GENERAL STUFF - GRAPHICS
\usepackage{graphicx}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\fsc}{m}
{
\toshiki_fsc:n { #1 }
}
\tl_new:N \l_toshiki_input_tl
\cs_set_eq:Nc \toshiki_tl_set_protecteded_x:Nn { protected@edef }
\cs_new_protected:Nn \toshiki_fsc:n
{
\toshiki_tl_set_protecteded_x:Nn \l_toshiki_input_tl { #1 }
\regex_replace_all:nnN { ([a-z]+) } { \c{toshiki_fake_sc:n}\cB\{\1\cE\} } \l_toshiki_input_tl
\regex_replace_all:nnN { (\c{[r"'`^]})\c{toshiki_fake_sc:n}\cB. }
{ \c{toshiki_fake_sc:n}\cB\{\1 } \l_toshiki_input_tl
\regex_replace_all:nnN { (\c{ae|oe|ss}) } { \c{toshiki_fake_sc:n}\cB\{\1\cE\} } \l_toshiki_input_tl
\tl_use:N \l_toshiki_input_tl
}
\cs_new_protected:Nn \toshiki_fake_sc:n
{
\scalebox{.87}[.79]{ \MakeUppercase{#1} }
}
\ExplSyntaxOff
\begin{document}
The \fsc{Schr{ö}dinger} equation is \dots
\fsc{Hôpital} \fsc{Ångström} \fsc{ångström} \fsc{ŒœÆæß}
\fsc{Some Wörds To Be In Småll Cáps}
\end{document}
An approximation. If unicode characters appear not in minuscules, it doesn't work correctly. May be there's a solution with \str_case:nnF
but you should do it manually, or just use LuaTeX (or XeTeX).
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{arev}
\usepackage{xparse} % loads expl3
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{textcase} % to get \MakeTextUppercase
\ExplSyntaxOn
\NewDocumentCommand \fsc { m } { \toshiki_fsc:n { #1 } }
\cs_new_protected:Npn \toshiki_fsc:n #1
{
\tl_map_inline:nn { #1 }
{
\str_if_eq:eeTF { ##1 } { \text_uppercase:n { ##1 } }
{ ##1 }
{ \scalebox{.87}[.79]{ \toshiki_fsc_aux:n { ##1 } } }
}
}
\cs_new_protected:Npn \toshiki_fsc_aux:n #1 { \MakeTextUppercase { #1 } }
\ExplSyntaxOff
\begin{document}
The \fsc{Schr{ö}dinger} equation is\dots\ \fsc{Schr{Ö}dinger} doesn't work, though\dots
\end{document}
but if you redefine \toshiki_fsc_aux:n
with
\cs_new_protected:Npn \toshiki_fsc_aux:n #1
{
\str_case:nnTF { #1 }
{
{Ö}{}
{Á}{}
% etc.
}
{ #1 }
{ \scalebox{.87}[.79]{ \MakeTextUppercase { #1 } } }
}
\cs_new_protected:Npn \toshiki_fsc_aux:n #1
{
\tl_if_in:nnTF { ÖÁ } { #1 }
{ #1 }
{ \scalebox{.87}[.79]{ \MakeTextUppercase { #1 } } }
}
then it does work, but you have to add the characters manually.
By the way, this is a messy solution, with patches here and there…
If you need this "fake small caps" only for names and only for single words (note that spaces don't work in your solution) then you can prepare a simple macro \fcs
which keeps the first letter unchanged and the rest is uppercased and scaled.
\def\fsc#1{\fscA#1\relax}
\def\fscA#1#2\relax{#1\scalebox{.87}[.79]{\uppercase{#2}}}
test: \fsc{Schrödinger} equation.
If the first letter is accented then you must to enclose it into braces because LaTeX treats badly with UTF-8 codes (if you are using csplain then this problem doesn't occur).