Debian Codegraph @

texmf-dist/doc/latex/textcsc/textcsc-documentation.tex

raw
1 \documentclass[12pt]{article}
2 \usepackage{textcsc}
3 \usepackage{xcolor}
4 \usepackage{fontspec}\definecolor{darkspringgreen}{rgb}{0.09, 0.45, 0.27}
5 \usepackage{titlesec}
6 \titleformat{\subsection}
7 {\bfseries}{\thesection.\thesubsection}{1em}{\normalfont\bfseries}
8 \usepackage[hidelinks]{hyperref}
9 \usepackage{hologo}
10 \usepackage[british]{babel}
11 \usepackage[useregional]{datetime2}
12 \DTMlangsetup[en-GB]{ord=omit}
13 \definecolor{LightGray}{gray}{0.9}
14 %\usepackage{mathpazo}
15 \IfFontExistsTF{Palatine Parliamentary}{%
16 \setromanfont[SmallCapsFeatures={LetterSpace=10},
17 RawFeature={+calt,+hlig,+liga,+dlig,+onum,+pnum},
18 BoldFont={Palatine Parliamentary Bold},
19 ItalicFont={Palatine Parliamentary Italic}
20 ]{Palatine Parliamentary Regular}
21 }{\setromanfont[RawFeature={+onum,+pnum}]{TeX Gyre PagellaX}}
22 \setmonofont[Scale=.9,BoldFont=Source Code Pro Bold]{Source Code Pro}
23
24 \usepackage{minted}
25 \date{\today\\\smallskip\ttfamily Version \textcscversionnumber}
26 \author{Elijah Z Granet\thanks{e-mail: \href{mailto:[email protected]}{\ttfamily [email protected]}}}
27
28 \title{\texttt{textcsc}:\\A package for caps-to-small-caps text}
29 \begin{document}
30 \maketitle
31 \tableofcontents
32 \clearpage
33 \section{Overview}
34 It is a longstanding typographic practice to typeset lengthy abbreviations as small-capitals to avoid unsightly groups of capital letters. Using the standard \LaTeX\ commands for small capitals (\verb!\textsc! and \verb!\scshape!) this requires the input letters to be typed in lowercase. For example, to produce \textcsc{FBI}, one types \verb!\textsc{fbi}!. This use of lowercase creates problems. Users of screenreaders or other accessibility software, as well as people who copy-paste the text from your \textcsc{PDF} to quote you, will only encounter the lowercase. If the document has been converted to another format, like an e-book or webpage, the small caps formatting may not convert with it. Even if the format carries when convert by Pandoc or other programme to \textcsc{HTML}, web users who block remote fonts or disable scripts may see, as a fallback, unsightly or confusing lower-case letters jammed together.
35
36 Thus, for users of \hologo{LuaLaTeX} or \hologo{XeLaTeX}, this package provides two very simple commands that produce caps-to-small-caps text, taking advantage of existing OpenType features. These two commands neatly help solve the problem of ensuring that all capitals can be used to avoid confusion with other formats or usages, without compromising the traditional typographic practice.
37
38 \section{Usage}
39 In your preamble put:
40 \begin{minted}[
41 framesep=2mm,
42 baselinestretch=1.2,
43 bgcolor=LightGray,
44 fontsize=\footnotesize,
45 breaklines,
46 firstnumber=last
47 ]
48 {latex}
49 \usepackage{textcsc}
50 \end{minted}
51
52 To use a switch analagous to \verb!\scshape! simply use \verb!\cscshape!.
53 \begin{minted}[
54 framesep=2mm,
55 baselinestretch=1.2,
56 bgcolor=LightGray,
57 fontsize=\footnotesize,
58 breaklines,
59 firstnumber=last
60 ]
61 {latex}
62 The \cscshape CIA\normalfont\ and the \cscshape FBI
63 \end{minted}
64
65 Produces:
66 \begin{quote}
67 The \cscshape CIA\normalfont\ and the \cscshape FBI
68 \end{quote}
69
70 To use a macro analagous to \verb!\textsc! simply use \verb!\textcsc!:
71 \begin{minted}[
72 framesep=2mm,
73 baselinestretch=1.2,
74 bgcolor=LightGray,
75 fontsize=\footnotesize,
76 breaklines,
77 firstnumber=last
78 ]
79 {latex}
80 The \textcsc{CIA} and the \textcsc{FBI}
81 \end{minted}
82
83 Produces:
84 \begin{quote}
85 The \textcsc{CIA} and the \textcsc{FBI}
86 \end{quote}
87
88
89 If you want to convert only capitals to small capitals (for example, because your style guide, like that of \textit{The Economist} prescribes mixed small-caps and lowercase abbreviations), then you can use the macro \verb!\csconly{#1}! or the switch \verb!\csconlyshape! For example, the commands:
90 \begin{minted}[
91 framesep=2mm,
92 baselinestretch=1.2,
93 bgcolor=LightGray,
94 fontsize=\footnotesize,
95 breaklines,
96 firstnumber=last
97 ]
98 {latex}
99 She earned first an \csconly{MSc} and then a \csconlyshape PhD
100 \end{minted}
101
102 Produce:
103
104 \begin{quote}
105
106 She earned first an \csconly{MSc} and then a \csconlyshape PhD
107 \end{quote}
108
109
110 \normalfont
111
112
113
114 \section{Development}
115 Bugs, feature requests, \textit{etc}, should be submitted to the project's official Github page: (\url{github.com/ezgranet/textcsc}).
116 \section{Licence}
117 This project is licensed under the \LaTeX\ Public Project Licence version 1.3\textit{c}. This documentation is copyright of the author but licensed under \textcsc{CC-BY-SA} 3.0.
118 \clearpage
119 \section{Implementation}
120 \begin{minted}[
121 frame=lines,
122 framesep=2mm,
123 baselinestretch=1.2,
124 bgcolor=LightGray,
125 fontsize=\footnotesize,
126 linenos,
127 breaklines,
128 firstnumber=last
129 ]
130 {latex}
131
132 \def\textcscversionnumber{1.2}
133 \ProvidesPackage{textcsc}
134 [2023/05/10\textcscversionnumber\
135 Command for caps-to-small-caps-text]
136 % This work may be distributed and/or modified under the
137 % conditions of the LaTeX Project Public License, either version 1.3c
138 % of this license or (at your option) any later version.
139 % The latest version of this license is in
140 % http://www.latex-project.org/lppl.txt
141 % and version 1.3c or later is part of all distributions of LaTeX
142 % version 2005/12/01 or later.
143 %
144 % This work has the LPPL maintenance status `maintained'.
145 %
146 % The Current Maintainer of this work is Elijah Z Granet
147 %%%%%%%%%%%%%%%%%%%%%%%%%%%
148 %%%%%%%%%%%%%%%%%%%%%%%%%%%
149 %%%%%%%%%%%%%%%%%%%%%%%%%%%
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%
151 % %%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%
153 % Warning that you need
154 % fontspec
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%
156 %%%%%%%%%%%%%%%%%%%%%%%%%%%
157 \RequirePackage{iftex}
158 \ifPDFTeX {
159 \PackageError{textcsc}
160 {You are using pdfTeX but this package only works
161 \MessageBreak with XeTeX or LuaTeX}{}
162 }
163 \fi
164 %%%%%%%%%%%%%%%%%%%%%%%%%%%
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%
166 %%%%%%%%%%%%%%%%%%%%%%%%%%%
167 % Dependencies
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%
170 \RequirePackage{fontspec}
171 %%%%%%%%%%%%%%%%%%%%%%%%%%%
172 %%%%%%%%%%%%%%%%%%%%%%%%%%%
173 % the switch
174 %%%%%%%%%%%%%%%%%%%%%%%%%%%
175 %%%%%%%%%%%%%%%%%%%%%%%%%%%
176 \newcommand{\cscshape}{\scshape\addfontfeature{RawFeature={+c2sc}}}
177 %%%%%%%%%%%%%%%%%%%%%%%%%%%
178 %%%%%%%%%%%%%%%%%%%%%%%%%%%
179 % the macro
180 %%%%%%%%%%%%%%%%%%%%%%%%%%%
181 %%%%%%%%%%%%%%%%%%%%%%%%%%%
182 \newcommand{\textcsc}[1]{{\cscshape%
183 #1%
184 }}
185 \newcommand{\csconlyshape}{\addfontfeature{RawFeature={+c2sc}}}
186 \newcommand{\csconly}[1]{{\csconlyshape%
187 #1%
188 }}
189 %%%%%%%%%%%%%%%%%%%%%%%%%%%
190 %%%%%%%%%%%%%%%%%%%%%%%%%%%
191 % all done
192 %%%%%%%%%%%%%%%%%%%%%%%%%%%
193 %%%%%%%%%%%%%%%%%%%%%%%%%%%
194 \end{minted}
195 \section{Version History}
196 \subsection{\texttt{1.2.0}}
197
198 \ttfamily 24 April 2023: added option for only caps to small caps text.
199
200
201 \subsection{\texttt{1.1.0}}
202
203
204
205 \ttfamily 24 April 2023: Update to fix issue with LetterSpace property not carrying over.
206
207
208
209
210
211 \subsection{\texttt{1.0.0}}
212
213 \ttfamily 22 September 2022: Package creation
214
215
216 \end{document}