Debian Codegraph @

texmf-dist/source/latex/lccaps/lccaps.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2018 by Ruben Giannotti
4 % <ruben dot giannotti at gmx dot net>
5 % -------------------------------------------------------
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either
9 % version 1.3c of this license or (at your option) any
10 % later version. The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3 or later is part of all distributions
13 % of LaTeX version 2005/12/01 or later.
14 %
15 % This work has the LPPL maintenance status `maintained'.
16 %
17 % The Current Maintainer of this work is Ruben Giannotti.
18 %
19 % This work consists of the files
20 % lccaps.dtx
21 % lccaps.ins
22 % and the derived file lccaps.sty.
23 %
24 % \fi
25 %
26 % \iffalse
27 %<*driver>
28 \ProvidesFile{lccaps.dtx}
29 %</driver>
30 %<package>\NeedsTeXFormat{LaTeX2e}
31 %<package>\ProvidesPackage{lccaps}
32 %<*package>
33 [2018/01/21 v1.0 Lowercased (spaced) small capitals (RG)]
34 %</package>
35 %
36 %<*driver>
37 \documentclass{ltxdoc}
38 \usepackage{amssymb,parskip}
39 \usepackage{lccaps}
40 \providecommand*\pkg{\textsf}
41 \providecommand*\option{\textit}
42 \providecommand*\url{\texttt}
43 \providecommand*\email{\texttt}
44 \providecommand*\important{$\blacktriangleright$\space Important note:\space}
45 \EnableCrossrefs
46 \CodelineIndex
47 \begin{document}
48 \DocInput{lccaps.dtx}
49 \end{document}
50 %</driver>
51 % \fi
52 %
53 % \CheckSum{60}
54 %
55 % \CharacterTable
56 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
57 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
58 % Digits \0\1\2\3\4\5\6\7\8\9
59 % Exclamation \! Double quote \" Hash (number) \#
60 % Dollar \$ Percent \% Ampersand \&
61 % Acute accent \' Left paren \( Right paren \)
62 % Asterisk \* Plus \+ Comma \,
63 % Minus \- Point \. Solidus \/
64 % Colon \: Semicolon \; Less than \<
65 % Equals \= Greater than \> Question mark \?
66 % Commercial at \@ Left bracket \[ Backslash \\
67 % Right bracket \] Circumflex \^ Underscore \_
68 % Grave accent \` Left brace \{ Vertical bar \|
69 % Right brace \} Tilde \~}
70 %
71 %
72 % \changes{v1.0}{2018/01/21}{Initial version}
73 %
74 % \GetFileInfo{lccaps.dtx}
75 %
76 % \DoNotIndex{\newcommand,\newenvironment,\!,\@empty,\@gobble,\@gobbletwo}
77 % \DoNotIndex{\@ifpackageloaded,\@ifpackagewith,\@ifundefined,\@namedef}
78 % \DoNotIndex{\@nil,\@onlypreamble,\@tempa,\@tempb,\@tempswafalse,\def}
79 % \DoNotIndex{\@tempswatrue,\^,\-,\active,\begingroup,\catcode,\@car,\@cdr}
80 % \DoNotIndex{\edef,\else,\endgroup,\endinput,\expandafter,\fi,\if}
81 % \DoNotIndex{\if@tempswa,\ifcase,\ifnum,\ifx,\lccode,\let,\lowercase}
82 % \DoNotIndex{\MessageBreak,\next,\number,\numexpr,\or,\PackageError}
83 % \DoNotIndex{\PackageWarning,\PackageWarningNoLine,\strip@prefix,\@@end}
84 % \DoNotIndex{\relax,\space,\string,\DeclareOption,\ProcessOptions}
85 % \DoNotIndex{\meaning,\ifdefined,\csname,\chardef,\endcsname,\protect}
86 % \DoNotIndex{\input,\RequirePackage,\global,\ifcsname,\makeatother}
87 % \DoNotIndex{\@makeother,\the,\toks@}
88 %
89 % \title{The \pkg{lccaps} package\thanks{This document
90 % corresponds to \pkg{lccaps}~\fileversion, dated \filedate.}}
91 % \author{Ruben Giannotti\thanks{\email{ruben dot giannotti at gmx dot net}}}
92 %
93 % \maketitle
94 %
95 % This tiny package serves the mere purpose of
96 % providing a uniform method to use
97 % lowercased small capitals (and spaced lowercased small capitals).
98 % It relies on the \pkg{iftex}, \pkg{textcase} and \pkg{microtype} package
99 % and comes with four new user macros.
100 %
101 % \DescribeMacro{\textlcc}
102 % This is the main feature.
103 % It produces forced lowercased \textlcc{small capitals}.
104 %
105 % \DescribeMacro{\spacedcaps}
106 % This is more of an auxiliary macro.
107 % But, it can be used at the user level of course.
108 % It is meant to be used as a prefix to |\textlcc| or |\textsc|
109 % which results in a slightly wider spacing between small capitals:
110 %
111 % \begin{center}
112 % |\spacedcaps\textlcc{Spaced capitals}| \(\leadsto\)
113 % \spacedcaps\textlcc{Spaced capitals}
114 % \end{center}
115 %
116 % \DescribeMacro{\textslcc}
117 % \DescribeMacro{\textssc}
118 % Those two are just shorthands for the last mentioned.
119 % Technically the very last one exceeds the scope of this package.
120 % It is a simple byproduct that should not be harmful.
121 %
122 % \StopEventually{}
123 %
124 % \begin{macrocode}
125 \RequirePackage{iftex}
126 \RequirePackage{textcase}
127 \RequirePackage{microtype}
128 \protected\def\lcc@warning{\PackageWarning{lccaps}}
129 \DeclareRobustCommand\textlcc[1]{\textsc{\MakeTextLowercase{#1}}}
130 \def\spacedcaps#1{%
131 \let\reserved@a=#1%
132 \ifnum
133 \ifx\reserved@a\textsc1\else
134 \ifx\reserved@a\textlcc1\else
135 0\fi\fi
136 =1
137 \expandafter\reserved@lcc
138 \else
139 \lcc@warning{The token preceeding \noexpand\spacedcaps
140 wasn't meant to typeset small capitals, so nothing happend.}%
141 \expandafter\reserved@a
142 \fi
143 }
144 \def\reserved@lcc#1{%
145 \expandafter\@spacedcaps\expandafter{\reserved@a{#1}}%
146 }
147 \ifXeTeX
148 \def\@spacedcaps#1{\bgroup\addfontfeature{LetterSpace=5.0}#1\egroup}
149 \else
150 \def\@spacedcaps{\textls[50]}
151 \fi
152 \DeclareRobustCommand\textslcc{\spacedcaps\textlcc}
153 \DeclareRobustCommand\textssc{\spacedcaps\textsc}
154 % \end{macrocode}
155 %\Finale
156 \endinput