Debian Codegraph @

texmf-dist/doc/fonts/cochineal/cochineal-doc.tex

raw
1 % !TEX TS-program = lualatexmk
2 \documentclass[11pt]{article}
3 \usepackage[margin=1in]{geometry}
4 \usepackage[parfill]{parskip}% Begin paragraphs with an empty line rather than an indent
5 \usepackage{graphicx}
6 %\pdfmapfile{=Cochineal.map}
7 %\pdfmapfile{=newtx.map}
8 %\usepackage{amssymb}% don't use with newtxmath
9 %SetFonts
10 % cochineal+newtxmath
11 \usepackage[OT2,LGR,T2A,T1]{fontenc}
12 \usepackage{textcomp}
13 \usepackage[varqu,varl]{zi4}% inconsolata
14 \usepackage[p,osf,cochineal,vvarbb,amsthm]{newtx} % use proportional osf
15 \setmonofont{inconsolata}
16 %\usepackage{amsmath,amsthm}
17 %\usepackage[cochineal,vvarbb]{newtxmath}
18 % option vvarbb gives you stix blackboard bold
19 \usepackage[cal=boondoxo]{mathalfa}% less slanted than STIX cal
20 \usepackage{bm}
21 \usepackage{array,booktabs}
22 %SetFonts
23 \usepackage{fonttable}
24 \title{The Cochineal Font Package}
25 \author{Michael Sharpe}
26 \date{\today} % Activate to display a given date or no date
27
28 \begin{document}
29 \maketitle
30 Cochineal is a fork of Crimson, a remarkable creation of Sebastian Kosch inspired by oldstyle font designers. The name Cochineal is intended to suggest that, while it is crimson, there may be bugs involved. More than 1500 glyphs were added to Crimson, allowing a more than modest chance that some poor spacing or kerning or accent placement might have been introduced. Such problems will occur in the less frequented parts of the fonts, and I would appreciate reports of problems you may discover. You are unlikely to trip over issues if you stay within the bounds of, say, the T$1$ encoding. I did correct problems in a number of glyphs from Crimson that FontForge uncovered and that could have led to poor rendition on some platforms, especially MAC OS. I also changed the emsize to {\tt 1000} (the standard for PostScript-flavored Opentype) from the Crimson value of {\tt 1024} and rescaled accordingly.
31
32 Cochineal provides {\tt Roman}, {\tt Bold}, {\tt Italic} and {\tt BoldItalic}. (Crimson provided semibold weights but with only limited coverage, which I did not wish to extend as this would have required the creation of about 2000 additional glyphs. Bob Tennent's {\tt Crimson} package does support semibold and the other styles, though without my glyph additions.)
33
34 \textsc{Package Features:}\\
35 In addition to the encodings {\tt OT1}, {\tt T1}, {\tt TS1}, {\tt LY1} in general use by Western European (and some Eastern European) scripts, the package also offers {\tt LGR} with full support for monotonic, polytonic and some ancient Greek, and {\tt T2A} and {\tt OT2} Cyrillic support. All allow a choice from four figure styles---{\tt TLF} (tabular lining figures, monospaced and uppercase), {\tt LF} (proportional lining figures, uppercase), {\tt TOsF} (tabular oldstyle figures, monospaced and lowercase) and {\tt OsF} (proportional oldstyle figures, lowercase). The encodings {\tt OT1}, {\tt T1}, {\tt TS1}, {\tt LY1} offer \textsc{Small Caps}, even \textsc{\textit{Italics Small Caps}}, and additional figure styles---superiors, inferiors and denominators. These features are available from either \verb|fontspec| or from [pdf]\LaTeX. In \LaTeX, you access these through the macros \verb|\textsu|, \verb|\textinf| and \verb|\textde|, or through their font-switching equivalents \verb|\sufigures|, \verb|\infigures| and \verb|\defigures|. For example:
36 \begin{itemize}
37 \item
38 \verb|M\textsu{lle} Dupont| and \verb|M{\sufigures lle} Dupont| both produce M\textsu{lle} Dupont.
39 \item \verb|{\infigures 12345}| and \verb|\textinf{12345}| render as \textinf{12345}, dipping noticeably below the baseline, while \verb|{\defigures 12345}| and \verb|\textde{12345}| render as \textde{12345}, aligned with the baseline.
40 \end{itemize}
41 As of version $1.062$ ($2020$), there is a new \verb|\textfrac| macro that works as in the following examples:
42 \begin{itemize}
43 \item
44 (two arguments) \verb|\textfrac{31}{32}| renders as \textfrac{31}{32};
45 \item
46 (three arguments) \verb|\textfrac[2]{63}{64}| renders as \textfrac[2]{63}{64}.
47 \end{itemize}
48 In addition, there is a \verb|\textcircled| macro that makes \verb|\textcircled{W}| render as \textcircled{W}. Numerals can also be circled: \verb|\textcircled{2}| renders as \textcircled{2}.
49
50 If you load the {\tt cochineal} package by means of option {\tt cochineal} to the {\tt newtx} package, version 1.71 or higher, there is a stacked fraction construction available using the macro \verb|\textsfrac| which behaves like \verb|\textfrac| except with the fractional part stacked vertically rather than diagonally. For example, \verb|\textsfrac[2]{5}{16}| produces \textsfrac[2]{5}{16}.
51
52 %\newpage
53 \textsc{Package Options and Macros:}\\
54 The package defines two macros, \verb|\useosf| and \verb|\useproportional|, useable only in the preamble, which determine the default figure style in text. A typical invocation would be something like
55 \begin{verbatim}
56 \usepackage{cochineal} % default figure style is tabular, lining
57 % load sans and typewriter fonts
58 % load a math font---it will use tabular lining figures in math
59 \useosf % switch from lining figures to oldstyle figures
60 \useproportional % switch from tabular to proportional
61 \end{verbatim}
62 There is a simpler way to achieve essentially the same result, but with the advantage that the figure styles are not loaded until after the math package (if any) is loaded, so that math always uses the default tabular lining figures.
63 \begin{verbatim}
64 % If you use babel, load it here, before cochineal
65 \usepackage[p,osf]{cochineal} % default figure style is proportional, oldstyle
66 % load sans and typewriter fonts
67 % load a math font---it will use tabular lining figures in math
68 \end{verbatim}
69
70 As of version 1.71 of {\tt newtx}, it may be more convenient to use its mechanism for loading {\tt cochineal} as text and {\tt newtxmath} as math.
71 \begin{verbatim}
72 % If you use babel, load it here, before newtx
73 % load sans and typewriter fonts
74 \usepackage[p,osf,cochineal]{newtx} % text figure style is proportional, oldstyle, math will use tabular, lining figures
75 % if you use unicode latex with
76 \end{verbatim}
77
78
79 No matter what the default figure style in text, the package provides switches and macros to use any available figure style.
80 \begin{itemize}
81 \item
82 \verb|\textlf{}| and \verb|{\lfstyle }| give proportional lining figures;
83 \verb|\texttlf{}| and \verb|{\tlfstyle }| give tabular lining figures;
84 \verb|\textosf{}| and \verb|{\osfstyle }| give proportional oldstyle figures;
85 \verb|\texttosf{}| and \verb|{\tosfstyle }| give tabular oldstyle figures;
86 \verb|\textfrac{3}{4}| uses superior and denominator figures to make the fraction \textfrac{3}{4}.
87 \end{itemize}
88 The options that can be passed to {\tt cochineal.sty} are the following:
89 \begin{itemize}
90 \item {\tt scale} or {\tt scaled}: a magnification factor---e.g., {\tt scaled=1.02} enlarges all text controlled by the package by {\tt2}\%;
91 \item
92 {\tt p}, or {\tt proportional}: make proportional figures the default rather than tabular;
93 {\tt lf}, or {\tt lining}: make lining figures the default (this is already the default);
94 {\tt osf}, or {\tt oldstyle}: make oldstyle figures the default rather than lining;
95 \item {\tt sups}: use superior figures to make footnote markers, rather than the \LaTeX's default markers;
96 \item {\tt swashQ}: use Cochineal's swash \Qswash\ instead of its tamer default version, \Qnoswash;
97 \item {\tt scosf}: always use oldstyle figures within a small caps block;
98 \item {\tt theoremfont}: for theorem statements in the {\tt plain} style, use a doctored version of italics that has upright figures, braces, brackets, parentheses, exclamation mark, colon and semicolon. It is implemented as the {\tt slanted} shape, and there are two options you can add to the call to the {\tt cochineal} package to modify the way it outputs figures.
99
100 The default (neither of the following options is set) is to use upright figures within theorem text, but in the same alignment (proportional or tabular) and the same style (lining or oldstyle) as in general text.
101
102 Option {\tt thmtabular} causes figures in theorem text to render in tabular alignment, while option {\tt thmlining} causes figure styles to render in lining rather than oldstyle. The two may be used in conjunction, forcing figures in theorem text to render as tabular lining figures.
103 \end{itemize}
104 \section*{Usage with unicode LaTeX}
105 The cochineal package works with all latex engines, and has some extra tricks available only in unicode LaTeX. In addition, {\tt newtx} also works with all latex engines and may be used to make a simplified call to use cochineal for text and {\tt newtxmath} (with cochineal letters) for math. Two crucial options---{\tt type1text} and {\tt nofontspec}---each of which may be used with both {\tt newtx} and {\tt cochineal}, determine how unicode latex will process your {\tt tex} document.
106 \begin{itemize}
107 \item
108 Neither {\tt type1text} (nor the equivalent {\tt type1}) nor {\tt nofontspec} specified: load {\tt fontspec} and use {\tt Cochineal} opentype fonts.
109 \item {\tt type1text} specified but not {\tt nofontspec}: load {\tt fontspec} but process text as {\tt pdflatex} would. (Other subsidiary opentype fonts could be loaded using {\tt fontspec} arguments.)
110 \item {\tt nofontspec} specified: {\tt fontspec} not loaded, text processed as under {\tt pdflatex}.
111 \end{itemize}
112 There are some more decorative glyph shapes as alternatives for Q and J in version 1.077 that are available only using unicode latex via {\tt StylisticSet=3} and {\tt StylisticSet=2} respectively. (The latter is available only in italic shapes.) They may be turned on as global options to {\tt newtx} or {\tt cochineal} by {\tt altQ}, {\tt altJ}.
113
114 \iftutex
115 \begin{verbatim}
116 \def\decorativeQ{{\addfontfeature{RawFeature=+ss03}Q}}
117 \def\decorativeJ{{\addfontfeature{RawFeature=+ss02}J}}
118 \end{verbatim}
119 \def\decorativeQ{{\addfontfeature{RawFeature=+ss03}Q}}
120 \def\decorativeJ{{\addfontfeature{RawFeature=+ss02}J}}
121 Q: \verb|\decorativeQ|: \decorativeQ\\
122 {\itshape J}: \verb|\decorativeJ|: {\itshape \decorativeJ}\\
123 \fi
124 There is also an option {\tt oldSS} you may specify to use the older form of \verb|\SS| rather than the newer German Sharp S glyph.
125
126 \section*{Mathematical accompaniment}
127 The package contains fonts for use as math letters that are derived from Cochineal Roman and Greek glyphs and the {\tt newtxmath} family. Note that $v$ and $\nu$ (Greek {\tt nu}) are quite distinct. Here's a sample.
128
129 \begin{verbatim}
130 % preamble should include, in this order:
131 \usepackage[T1]{fontenc}
132 % load babel here
133 \usepackage[p,osf]{cochineal}
134 \usepackage[varqu,varl,var0]{inconsolata}
135 \usepackage[scale=.95,type1]{cabin}
136 \usepackage[cochineal,vvarbb]{newtxmath}
137 \usepackage[cal=boondoxo]{mathalfa}
138 \end{verbatim}
139 \def\Pr{\ensuremath{\mathbb{P}}}
140 \def\d{\mathrm{d}}
141 %\thispagestyle{empty}
142 The typeset math below follows the ISO recommendations that only variables
143 be set in italic. Note the use of upright shapes for $\d$, $\mathrm{e}$
144 and $\uppi$. (The first two are entered as \verb|\mathrm{d}| and
145 \verb|\mathrm{e}|, and in fonts derived from {\tt mtpro2} or {\tt newtxmath},
146 the latter is entered as \verb|\uppi|.)
147
148 \textbf{Simplest form of the \textit{Central Limit Theorem}:} \textit{Let
149 $X_1$, $X_2,\cdots$ be a sequence of iid random variables with mean~$0$
150 and variance $1$ on a probability space $(\Omega,\mathcal{F},\Pr)$. Then}
151 \[\Pr\left(\frac{X_1+\cdots+X_n}{\sqrt{n}}\le v\right)\to\mathfrak{N}(v)\coloneq
152 \int_{-\infty}^v \frac{\mathrm{e}^{-t^2/2}}{\sqrt{2\uppi}}\,
153 \mathrm{d}t\quad\mbox{as $n\to\infty$, for every $v\in\mathbb{R}$,}\]
154 \textit{or, equivalently, letting} $S_n\coloneq\sum_1^n X_k$,
155 \[\mathbb{E} f\left(S_n/\sqrt{n}\right)\to \int_{-\infty}^\infty f(t)
156 \frac{\mathrm{e}^{-t^2/2}}{\sqrt{2\uppi}}\,\mathrm{d}t
157 \quad\mbox{as $n\to\infty$, for every $f\in\mathrm{b}
158 \mathcal{C}(\mathbb{R})$.}\]
159 \newpage
160
161 \section*{Cochineal's TS1 (textcomp)}
162 Coverage of TS1 has been enriched as of version $1.062$ so that it now qualifies as sub-encoding $0$, with essentially all TS1 features available.
163
164 \fonttable{Cochineal-Roman-ts1}
165 \newpage
166 \section*{Typesetting Greek with LaTeX}
167 Cochineal offers a rather complete LGR-encoded glyph collection, lacking just a few ancient symbols.
168 \fonttable{Cochineal-Roman-tlf-lgr}
169
170 The LGR encoding defines a transcoding from Roman characters to Greek characters according to the following scheme:
171
172 \newpage
173 \[\begin{array}{m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}}
174 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 \\
175 \end{array}\]
176 \fontencoding{LGR}\selectfont
177 \[\begin{array}{m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}m{7pt}}
178 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 \\
179 a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & sv & t & u & v & w & x & y & z \\
180 \end{array}\]
181 \fontencoding{T1}\selectfont
182
183 The file {\tt lgrenc.def}, which is loaded whenever {\tt LGR} is first loaded, specifies the above and more transcodings from Latin to Greek. See the {\tt usage.pdf} file in the {\tt babel-greek} documentation.
184
185 The {\tt tfm} files associated with the Cochineal {\tt LGR } encoding were constructed with ligatures defined so that most Greek characters could be constructed using Latin input.
186
187 Note that you do not have to load the {\tt babel} package in order for the transcoding and ligatures to function properly.
188 %\newpage
189 \section*{Using Cochineal LGR Greek in other LaTeX packages}
190 There is nothing particular about Cochineal here that would not apply to any other text font package with a working LGR setup, as described above. There was for a number of years a small package {\tt substitutefont} that allowed the substitution of, say, LGR Cochineal Greek as the LGR Greek font in another text font package that lacked a suitable one of its own. This functioned less well as LaTeX evolved and its functionality was absorbed in 2020 sby the LaTeX command \verb|\DeclareFontFamilySubstitution|, which shares some of the problems of the now obsolete \verb|\substitutefont|. I've added this short section to describe some work-arounds those who wish to have access to this functionality.
191
192 Here are the problems I encountered:
193 \begin{itemize}
194 \item
195 If you try to add LGR Cochineal Greek to another package that has no support for LGR Greek, the attempt would fail. The work-around is to add in your preamble lines like
196 \begin{verbatim}
197 \usepackage[LGR,T1]{fontenc}
198 \DeclareFontFamily{LGR}{\rmdefault}{}
199 \end{verbatim}
200 after loading the text font package.
201 \item
202 Many text font packages do not settle on the final definition of \verb|\rmdefault| until just before processing \verb|\begin{document}|. You may take care of all possibilities by adding to your preamble (near the end), imagining we are adding Cochineal LGR Greek to newtx:
203 \begin{verbatim}
204 \DeclareFontFamilySubstitution{LGR}{ntxtlf}{Cochineal-TLF}
205 \DeclareFontFamilySubstitution{LGR}{ntxlf}{Cochineal-LF}
206 \DeclareFontFamilySubstitution{LGR}{ntxtosf}{Cochineal-TOsF}
207 \DeclareFontFamilySubstitution{LGR}{ntxosf}{Cochineal-OsF}
208 \end{verbatim}
209 To reconcile the difference in size between {\tt newtx} and {\tt Cochineal}, with respective x-heights of 450 and 432, the former is 1.042 times taller than the latter, and so we have to set the scale for Cochineal, \verb|\Cochineal@scale| to 1.042 times that of newtx, \verb|\ntx@scale|. So, the next line in the preamble should be something like
210 \begin{verbatim}
211 \makeatletter
212 \@tmpdima=\ntx@scale\p@ \@tmpdima=1.042\@tmpdima
213 \def\Cochineal@scale{\strip@pt\@tmpdima}
214 \makeatother
215 \end{verbatim}
216 \end{itemize}
217
218 \section*{Typesetting Russian}
219 With T$2$A encoding, the process is the same as with other T$2$A-encoded fonts, though the gaps in coverage may affect users of a number of non-Russian Cyrillic scripts. The only figure style provided is tabular lining (TLF.)
220 %\newpage
221 \fonttable{Cochineal-Roman-tlf-t2a}
222
223 The OT$2$ encoding (supposedly obsolete, but still useful) is intended for limited use in producing Russian characters with a Western keyboard, making by means of \TeX\ a transliteration of ASCII for most characters in the range 33--122, and providing ligatures to generate the rest, just as in the Greek case. See the documentation of {\tt nimbus15} for further details.
224 %\newpage
225 \fonttable{Cochineal-Roman-tlf-ot2}
226 %\end{document}
227 %\newpage
228 \section*{Additional glyphs for use in German orthography}
229 Prior to version {\tt1.050}, {\tt cochineal} offered basic support for German orthography, having all required accented glyphs and the lower case \ss, as well as a small caps \textsc{\ss}. Under LaTeX, the T$1$ encoding contained \verb|S_S|, but only as a synthesized character in the {\tt tfm}. Unicode users could not make use of \verb|S_S| as it was not present in the~{\tt otf}. So, with unicode tex processing:
230 \begin{verbatim}
231 {\addfontfeature{StylisticSet=1}\ss\ \textsc{\ss}}
232 \end{verbatim}
233 typesets, as in LaTeX processing, to
234
235 \ss\ \textsc{\ss}
236
237 Note also that in unicode processing, in order to obtain the expected case change behavior, it may be necessary to add in your preamble:
238 \begin{verbatim}
239 \uccode`ß="1E9E
240 \end{verbatim}
241
242
243 As of version {\tt1.050} of {\tt cochineal}, there are now glyphs in each style for {\tt U+1E9E} and for its small caps version, as well as \verb|S_S| as a real character, accessible under unicode TeX. The glyphs may be used as the uppercase and small caps versions of {\tt germandbls}. Currently, the new glyphs are not available in any of the LaTeX encodings and must be used via unicode TeX.
244
245 The following tables show how to access the new glyphs in unicode TeX. Note that you will need to set {\tt StylisticSet=1} if you wish not to use the new sharp-s glyphs.
246
247 \includegraphics{newgermanglyphs-crop}
248 \end{document}