-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwmfakesc.sty
More file actions
53 lines (44 loc) · 836 Bytes
/
wmfakesc.sty
File metadata and controls
53 lines (44 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{wmfakesc}[2017/02/05]
\RequirePackage{xparse}
\RequirePackage{expl3}
\RequirePackage{fontspec}
\makeatother
\ExplSyntaxOff
% Inspired by
% http://tex.stackexchange.com/a/225078/105667
\let\oldtextsc\textsc
\def\textschelper#1 #2\relax{%
\textschelphelp#1\relax\relax%
\if\relax#2\relax\else\ \textschelper#2\relax\fi%
}
\def\textschelphelp#1#2\relax{%
\ifnum\uccode`#1=0\relax%
#1%
\else{%
\ifnum\uccode`#1=`#1\relax%
#1%
\else%
\oldtextsc{\uppercase{#1}}%
\fi%
}\fi%
\ifx\relax#2%
\relax%
\else%
\textschelphelp#2\relax%
\fi%
}
\ExplSyntaxOn
\DeclareDocumentCommand{\textsc}{m} {
\fontspec_if_feature:nTF {smcp} {
\oldtextsc{#1}
}{
\fontspec_if_small_caps:TF {
\textschelper#1~\relax\relax
}{
\oldtextsc{#1}
}
}
}
\ExplSyntaxOff
\endinput