Debian Codegraph @

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

raw
1 % !TEX TS-program = pdflatexmk
2 \documentclass[11pt]{article}
3
4 \usepackage[margin=1in]{geometry}
5 \usepackage[parfill]{parskip}% Begin paragraphs with an empty line rather than an indent
6 \pdfmapfile{=newtxtt.map}
7 \usepackage{graphicx}
8 %SetFonts
9 \usepackage{XCharter}
10 \usepackage[T1]{fontenc}
11 \usepackage{textcomp}
12 \usepackage[zerostyle=a,scale=1.1]{newtxtt} % TX typewriter
13 \usepackage[xcharter]{newtxmath}
14 \usepackage{upquote}
15 \useosf
16 \font\fonta newtxtta at 11pt
17 \font\fontb newtxttb at 11pt
18 \font\fontc newtxttc at 11pt
19 \font\fontd newtxttd at 11pt
20 \font\fonte newtxtte at 11pt
21 \font\fontf newtxttsce at 11pt
22 %\font\fontg cmtt10 at 11pt
23 \usepackage{fonttable}
24 \renewcommand*{\sfdefault}{qhv}% sans serif is otherwise not used
25 %SetFonts
26 \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.09emX\@}
27 \DeclareRobustCommand{\LaTeX}{L\kern-.28em%
28 \raise.4ex\hbox{\textsc{a}}%
29 \kern-.1em%
30 \TeX}
31 \title{The \texttt{newtxtt} Package\thanks{It is a pleasure to thank Jean-Fran\c{c}ois Burnol who has offered very useful advice and feedback on this package. For an extensive example of its usage as body text, see the documentation of his remarkable {\tt xint} package.}
32 }
33 \author{Michael Sharpe}
34 \date{\today} % Activate to display a given date or no date
35
36 \begin{document}
37 \maketitle
38 There is a relative paucity of free serifed typewriter fonts available for use in \LaTeX---{\tt courier}
39 and (extensions of) {\tt cmtt} are the most common. In my opinion, {\tt cmtt} and its enhancements, especially {\tt zlmtt}, are a much better choice than {\tt courier} in almost every circumstance, as the latter is so light and so wide that it looks poor on screen and causes endless problems with overfull boxes. (The ratio of their glyph widths is $723/525\approx1.38$.) This package provides an interface to another alternative---the typewriter fonts provided with {\tt txfonts}, with some enhancements. They have the same widths as {\tt cmtt}, but are taller, heavier, more geometric and less shapely, with very low contrast, and are more suited to match Roman fonts of height and weight approximating that of Times. This package, loaded with
40 \begin{verbatim}
41 \usepackage{newtxtt} % options can be added
42 \end{verbatim}
43 provides access to its features, no matter what other text fonts you might be using. It should be placed after all your other text font loading packages that might contain instructions to change \verb|\ttdefault|, and before loading math packages so that the math packages can make a suitable definition of \verb|\mathtt|. With no options specified, as above, you'll get full functionality as a monospaced typewriter font family, with typewriter text rendered using essentially {\tt txtt}, but with a five choices for the glyph `zero'. In addition, the package provides italic (slanted) and bold versions, plus small caps in regular (medium) and bold weights, upright shape only. It is offered only in T$1$ (plus full TS$1$) encoding. The macros \verb|\ttdefault|, \verb|\ttfamily|, \verb|\texttt| and the obsolete but convenient macro \verb|\tt| may be used to access this font.
44 The package provides, by means of options or macros, an alternate form of {\tt newtxtt} with names containing a {\ttz 'z'}, differing from it in some important ways:
45 \begin{itemize}
46 \item
47 the interword spacing is no longer the same as the glyph spacing, but is variable though generally smaller---{\tt fontdimen} settings have been changed to resemble those of text fonts;
48 \item
49 where monospaced typewriter fonts typically add an an extra space with full width at the end of a sentence, the modified {\ttz 'z'} version adds a considerably smaller space;
50 \item
51 hyphenation is not suppressed.
52 \end{itemize}
53 These features may be accessed by means of the new macros \verb|\ttzdefault|, \verb|\ttzfamily|, \verb|\textttz| and \verb|\ttz| which are in all ways analogous to their monospace cousins. (Verbatim modes will continue to use the monospaced version.) The purpose of the {\tt ttz} version to allow use of \texttt{newtxtt} for blocks of {\tt TypeWriter}-like text, though not monospaced and respecting right justification. E.g.,
54 \begin{verbatim}
55 {\ttz Block of text, perhaps many lines long, will be rendered right-justified.}
56 \end{verbatim}
57
58 The options you may use in loading this package are:
59 \begin{itemize}
60 \item {\tt scaled=.97} will load the fonts scaled to $.97$ times natural size. This is useful with Roman fonts having an x-height smaller than Times, for which {\tt txtt} was designed.
61 \item
62 {\tt zerostyle} selects the form of {\tt `zero'} from one of five possibilities: {\tt a, b, c, d, e}, ({\tt a} being the default) which result respectively in\\[6pt]
63 {\fonta 0} ---form {\tt a}, narrower than capital {\tt O};\\
64 {\fontb 0} ---form {\tt b}, original version from {\tt txtt};\\
65 {\fontc 0} ---form {\tt c}, slashed, narrower than capital {\tt O};\\
66 {\fontd 0} ---form {\tt d}, dotted, narrower than capital {\tt O};\\
67 {\fonte 0} ---form {\tt e}, narrower than capital {\tt O}, more oblong.\\
68 The option {\tt zerostyle} also affects the oldstyle figures that are available in \textsc{Small Caps} and in \textsc{Text Companion} (TS1). That is, to obtain oldstyle typewriter figures, you have to use something like:
69 \verb|\texttt{\textsc{012}}|, or \\
70 \verb|\textzerooldstyle \textoneoldstyle \texttwooldstyle|.\\
71 The result using {\tt zerostyle=e} would be {\fontf 012}.
72 \item
73 {\tt nomono} changes the {\tt tt} macro definitions replacing them, in effect, by their {\tt ttz} versions. I do not necessarily recommend this, but I find it useful when text alignment is not important, and I do not wish to change all existing \verb|\tt| to \verb|\ttz|. It affects verbatim modes also.
74 \item
75 {\tt straightquotes} affects the rendering of single and double quotes in all {\tt newtxtt} modes:
76 Single left and right quotes entered in \TeX\ source code as \verb|`| and \verb|'| normally render as curly quotes, {\tt `} and {\tt '}. With {\tt straightquotes}, they will render as \verb|`| and \verb|'|, and double quotes will render as {\tt \char`"}.
77 \item The option {\tt ttdefault} sets \verb|\familydefault| to \verb|\ttdefault| so the default Roman text will be rendered using {\tt newtxtt}.
78 \item The option {\tt ttzdefault} works similarly, but sets Roman text to use the non-monospaced {\tt newtxttz}.
79 \item There are slanted versions of the fonts. You may use \verb|\textsl| or \verb|\textit| within typewriter text to activate them. E.g, \verb|\texttt{\textsl{Slanted text}}| produces \texttt{\textsl{Slanted text}}.
80 \end{itemize}
81 \textsc{New Macros:}
82 \begin{itemize}
83 \item
84 \verb|\ttz| switches to non-monospace typewriter mode; \\
85 e.g., \verb|{\ttz text in ttz mode}| renders as \\
86 {\ttz text in ttz mode}.
87 \item Essentially the same effect with \verb|{\ttzfamily text in ttz mode}|.
88 \item \verb|\textttz{}| renders its argument in {\tt ttz} mode.
89 \end{itemize}
90
91 This document uses the following font settings:
92 \begin{verbatim}
93 \usepackage[osf]{XCharter} % osf in text, lining figures in math
94 \usepackage[T1]{fontenc}
95 \usepackage{textcomp}
96 \usepackage[zerostyle=a]{newtxtt} % TX typewriter
97 \usepackage[xcharter]{newtxmath}
98 \end{verbatim}
99
100 If you use {\tt microtype} and have blocks of verbatim of typewriter text, you may find it best to prevent protrusion in that mode with the command (following \verb|\usepackage{microtype}|)\begin{verbatim}
101 \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
102 \end{verbatim}
103
104 Comparison with Latin Modern Typewriter:
105
106 {\usefont{T1}{lmtt}{m}{n}\fontsize{11.22pt}{13}\selectfont LM Typewriter: This is just a line to illustrate typewriter 0123456789.}\\
107 \texttt{TX Typewriter: This is just a line to illustrate typewriter 0123456789.}\\
108 \textttz{TX Typewriter: This is just a line to illustrate typewriter 0123456789. (ttz)}
109
110 \textsc{Notes:} The first two are standard monospaced with the same spacing---the : is considered to be the end of a sentence---while the words in the third are spaced more compactly, it would hyphenate if necessary, and a much shorter extra space at the end of a ``sentence''.
111
112 \textbf{Using the fonts without using the package:} If you wish to use these fonts without making one of the them the \verb|\ttdefault|, you may call them directly from the {\tt fd}:
113 \begin{verbatim}
114 {\fontfamily{newtxtt}\selectfont ...} % or newtxttz
115 \end{verbatim}
116 or, for finer control of the \textsc{nfss} parameters,
117 \begin{verbatim}
118 {\usefont{T1}{newtxtt}{b}{n} ...} % or {newtxttz}{m}{sc}, etc
119 \end{verbatim}
120 For further control, you may add in your preamble lines like the following to select the zero style (five choices, a to e) and the shape of quotes:
121 \begin{verbatim}
122 \makeatletter
123 \edef\newtxtt@fig{c} % one of a--e to determine the zerostyle, defaults to a
124 \newif\iftxtt@upq\txtt@upqtrue % same effect as option straightquotes
125 % remove the \txtt@upqtrue for not straightquotes, the default
126 \makeatother
127 \end{verbatim}
128 \newpage
129 \section*{Font Samples}
130 \textbf{\texttt{newtxtta}}:\\
131 (Default for {\tt newtxtt}, {\tt T1} encoded.)\\
132 \fonttable{newtxtta}
133 \newpage
134 \textbf{\texttt{newtxttscb}}:\\
135 (Small Caps, {\tt T1} encoded with {\tt zerostyle=b}.)\\
136 \fonttable{newtxttscb}
137 \newpage
138 \textbf{\texttt{newtcxtte}}:\\
139 (Text companion {\tt ts1} with oldstyle figures, zero styled in more oblong shape.)\\
140 \fonttable{newtcxtte}
141 \end{document}