summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/ascii/ascii.dtx
blob: af689b307fba25171c74bbe753b18440c7e6846b (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%\iffalse
%
% (c) copyright 2006 A Syropoulos & RWD Nickalls
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% Please report errors or suggestions for improvement to
%    
%    Apostolos Syropoulos	and/or Dick Nickalls
%    asyropoulos@yahoo.com	dicknickalls@compuserve.com
%
%\fi
% \CheckSum{286}
% \iffalse This is a Metacomment
%
%<ascii, >\ProvidesFile{ascii.sty}
%
%<ascii, >  [2006/05/30 v2.0 Package `ascii.sty']
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\usepackage{ascii,fullpage}
\GetFileInfo{ascii.drv}
\begin{document}
   \DocInput{ascii.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%\StopEventually{}
%\MakeShortVerb{\|}
%\title{The `ascii' package}
%\author{A. Syropoulos and R.W.D. Nickalls}
% \date{2006/05/30}
%\maketitle
% \begin{abstract}
% The \textsf{ascii} package provides glyph and font access commands so
% that \LaTeX\ users can use the ASCII font in their documents. The ASCII font
% is encoded according to the {\em IBM PC Code Page 437 C0 Graphics}. This
% package replaces any early \LaTeX2.09 package and "font" by R. Ramasubramanian and
% R.W.D. Nickalls.   
% symbols.  
%\end{abstract}
%
% \section{Introduction}
% In a number of documents it is quite useful to be able to use the graphical
% representation of the first 32 ASCII characters as these have been defined
% in the {\em IBM PC Code Page 437 C0 Graphics}. For this reason, in 1993 R. Ramasubramanian and 
% R.W.D. Nickalls implemented the \textsf{ascii} package and provided a font so to allow
% \LaTeX\ users to typeset the graphical representation of these characters. The present package
% is a rewrite of the original package that relies on a new Type~1 font designed from scratch.
% Naturally, the new package uses the NFSS to provide access to the accompanying font.  
% 
% Table~\ref{tab:1} shows the
% the graphical representation of the various ASCII control characters. Notice
% that these graphical representations are now part of the Unicode standard
% as individual characters, which, however, do not represent the actual control
% characters. In other words, the visual representations of the the control characters are now 
% Unicode characters. In addition, the new font included a visual representation of the
% ``NO BREAK SPACE'' character, since it is practically a font ``implementing'' the 
% ISO8859-7 character set.
% 
% To access the control characters one can use the commands of the following
% table:
% \begin{center}
%  \begin{tabular}{cccc}\hline
%    Command  & ASCII & Command      & ASCII \\ \hline 
% \verb|\SOH| & 0x1   & \verb|\DCa|  & 0x11 \\
% \verb|\STX| & 0x2   & \verb|\DCb|  & 0x12 \\
% \verb|\ETX| & 0x3   & \verb|\DCc|  & 0x13 \\
% \verb|\EOT| & 0x4   & \verb|\DCd|  & 0x14 \\
% \verb|\ENQ| & 0x5   & \verb|\NAK|  & 0x15 \\
% \verb|\ACK| & 0x6   & \verb|\SYN|  & 0x16 \\
% \verb|\BEL| & 0x7   & \verb|\ETB|  & 0x17 \\
% \verb|\BS|  & 0x8   & \verb|\CAN|  & 0x18 \\
% \verb|\HT|  & 0x9   & \verb|\EM|   & 0x19 \\
% \verb|\LF|  & 0xA   & \verb|\SUB|  & 0x1A \\
% \verb|\VT|  & 0xB   & \verb|\ESC|  & 0x1B \\
% \verb|\FF|  & 0xC   & \verb|\FS|   & 0x1C \\
% \verb|\CR|  & 0xD   & \verb|\GS|   & 0x1D \\
% \verb|\SO|  & 0xE   & \verb|\RS|   & 0x1E \\
% \verb|\SI|  & 0xF   & \verb|\US|   & 0x1F \\
% \verb|\DEL| & 0x10  & \verb|\DEL|  & 0x7F \\ 
% \verb|\NUL| & 0x0   & \verb|\NBSP| & 0x20 \\ 
%\hline
%  \end{tabular}
% \end{center}
% Unfortunately, the standard glyph access commands for the various special
% \LaTeX\ symbols do not give the expected results and, so, we had to define
% a number of commands to provide access to these special glyphs. These
% commands are shown below:
%\begin{center}
%\begin{tabular}{lc}\hline
%Command                 & Character \\ \hline
%\verb|\asciihash|       & \asciihash\\
%\verb|\asciipercent|    & \asciipercent\\
%\verb|\asciicircum|     & \asciicircum\\
%\verb|\asciitilde|      & \asciitilde\\
%\verb|\asciilbrace|     & \asciilbrace\\
%\verb|\asciidollar|     & \asciidollar\\
%\verb|\asciiampersand|  & \asciiampersand\\
%\verb|\asciiunderscore| & \asciiunderscore\\
%\verb|\asciibackslash|  & \asciibackslash\\
%\verb|\asciirbrace|     & \asciirbrace\\ 
%\verb|\asciispace|      & \asciispace\\
%\verb|\asciivert|       & \asciivert\\
%\verb|\splitvert|       & \splitvert\\
%\verb|\isosplitvert|    & \isosplitvert\\
%\verb|\asciiquotedbl|   & \asciiquotedbl\\
%\verb|\asciiquotegrave| & \asciiquotegrave\\
%\verb|\asciiquoteacute| & \asciiquoteacute\\\hline
%\end{tabular}
%\end{center}
% The reader should be aware that all these glyph access commands have been implemented 
% using the \textsf{xspace} package and, thus, one does need to take any special 
% precaution when using them. In addition, if someone wishes to typeset Greek text using
% this package, he/she needs to use a Greek keyboard as there are no special glyph access
% commands for the ``Greek'' characters of ISO8859-7.
%
% The command \verb|\textascii| is a font switching command and its argument is
% typeset using the ASCII font.
%\begin{table}
%\begin{center}
%\begin{tabular}{crlc}\hline\hline
%  Code & IBM &  Unicode Name          & Glyph\\ \hline\hline          
%  2400 &  00 &  NUL                   & \textascii{\char"00}\\               
%  263A &  01 &  White smiling face    & \textascii{\char"01}\\   
%  263B &  02 &  Black smiling face    & \textascii{\char"02}\\   
%  2665 &  03 &  Black heart suit      & \textascii{\char"03}\\      
%  2666 &  04 &  Black diamond suit    & \textascii{\char"04}\\   
%  2663 &  05 &  Black club suit       & \textascii{\char"05}\\      
%  2660 &  06 &  Black space suit      & \textascii{\char"06}\\     
%  2022 &  07 &  Bullet                & \textascii{\char"07}\\               
%  25D8 &  08 &  Inverse bullet        & \textascii{\char"08}\\       
%  25EF &  09 &  Large circle          & \textascii{\char"09}\\         
%  25D9 &  0A &  Inverse white circle  & \textascii{\char"0A}\\ 
%  2642 &  0B &  Male sign             & \textascii{\char"0B}\\            
%  2640 &  0C &  Female sign           & \textascii{\char"0C}\\          
%  266A &  0D &  Eighth note           & \textascii{\char"0D}\\          
%  266C &  0E &  Beamed 16th notes     & \textascii{\char"0E}\\    
%  263C &  0F &  White sun with rays   & \textascii{\char"0F}\\   
%  25BA &  10 &  Black right-pointing pointer & \textascii{\char"10}\\
%  25C4 &  11 &  Black left-pointing pointer  & \textascii{\char"11}\\
%  2195 &  12 &  Up down arrow          & \textascii{\char"12}\\
%  203C &  13 &  Double exclamation mark & \textascii{\char"13}\\
%  00B6 &  14 &  Pilcrow sign          & \textascii{\char"14}\\
%  00A7 &  15 &  Section sign          & \textascii{\char"15}\\
%  25AC &  16 &  Black rectangle       & \textascii{\char"16}\\
%  21A8 &  17 &  Up down arrow with base & \textascii{\char"17}\\
%  2191 &  18 &  Upwards arrow         & \textascii{\char"18}\\
%  2193 &  19 &  Downwards arrow       & \textascii{\char"19}\\
%  2192 &  1A &  Rightwards arrow      & \textascii{\char"1A}\\
%  2190 &  1B &  Leftwards arrow       & \textascii{\char"1B}\\
%  2319 &  1C &  Turned not sign       & \textascii{\char"1C}\\
%  2194 &  1D &  Left right arrow      & \textascii{\char"1D}\\
%  25B2 &  1E &  Black up-pointing triangle & \textascii{\char"1E}\\
%  25BC &  1F &  Black down-pointing triangle & \textascii{\char"1F}\\
%  00A0 &  -- &  NO BREAK SPACE        & \textascii{\char"A0}\\\hline 
%\end{tabular}
%\end{center}
% \caption{The graphical representation of the first 32 ASCII characters 
%          provided by the ASCII font.}\label{tab:1}
%\end{table}
%
% \section{The Source Code}
% The first thing we need to do is to define a new font family and the relevant
% font substitutions. 
%    \begin{macrocode}
%<*ascii>
\DeclareFontFamily{U}{ascii}{\hyphenchar \font\m@ne}
\DeclareFontShape{U}{ascii}{m}{n}{
   <-> ASCII}{}
\DeclareFontShape{U}{ascii}{m}{sl}{
   <-> ssub * ascii/m/n}{}
\DeclareFontShape{U}{ascii}{m}{it}{
   <-> ssub * ascii/m/n}{}
\DeclareFontShape{U}{ascii}{m}{sc}{
   <-> ssub * ascii/m/n}{}
\DeclareFontShape{U}{ascii}{bx}{n}{
   <-> ssub * ascii/m/n}{}
\DeclareFontShape{U}{ascii}{bx}{sl}{
   <-> ssub * ascii/m/n}{}
\DeclareFontShape{U}{ascii}{bx}{it}{
   <-> ssub * ascii/m/n}{}
\DeclareFontShape{U}{ascii}{bx}{sc}{
   <-> ssub * ascii/m/n}{}
%    \end{macrocode}
% Now we need to define a font access command:
%    \begin{macrocode}
\def\asciifamily{\fontencoding{U}\fontfamily{ascii}\selectfont}
\long\def\textascii#1{{\asciifamily #1}}
%    \end{macrocode}
% The next step is to define glyph access commands for the first 32 glyphs
% of the font and the various special \TeX\ characters. 
%    \begin{macrocode}
\RequirePackage{xspace}
\def\NUL{{\asciifamily\char"00}\xspace}
\def\SOH{{\asciifamily\char"01}\xspace}
\def\STX{{\asciifamily\char"02}\xspace}
\def\ETX{{\asciifamily\char"03}\xspace}
\def\EOT{{\asciifamily\char"04}\xspace}
\def\ENQ{{\asciifamily\char"05}\xspace}
\def\ACK{{\asciifamily\char"06}\xspace}
\def\BEL{{\asciifamily\char"07}\xspace}
\def\BS{{\asciifamily\char"08}\xspace}
\def\HT{{\asciifamily\char"09}\xspace}
\def\LF{{\asciifamily\char"0A}\xspace}
\def\VT{{\asciifamily\char"0B}\xspace}
\def\FF{{\asciifamily\char"0C}\xspace}
\def\CR{{\asciifamily\char"0D}\xspace}
\def\SO{{\asciifamily\char"0E}\xspace}
\def\SI{{\asciifamily\char"0F}\xspace}
\def\DLE{{\asciifamily\char"10}\xspace}
\def\DCa{{\asciifamily\char"11}\xspace}
\def\DCb{{\asciifamily\char"12}\xspace}
\def\DCc{{\asciifamily\char"13}\xspace}
\def\DCd{{\asciifamily\char"14}\xspace}
\def\NAK{{\asciifamily\char"15}\xspace}
\def\SYN{{\asciifamily\char"16}\xspace}
\def\ETB{{\asciifamily\char"17}\xspace}
\def\CAN{{\asciifamily\char"18}\xspace}
\def\EM{{\asciifamily\char"19}\xspace}
\def\SUB{{\asciifamily\char"1A}\xspace}
\def\ESC{{\asciifamily\char"1B}\xspace}
\def\FS{{\asciifamily\char"1C}\xspace}
\def\GS{{\asciifamily\char"1D}\xspace}
\def\RS{{\asciifamily\char"1E}\xspace}
\def\US{{\asciifamily\char"1F}\xspace}
\def\DEL{{\asciifamily\char'177}\xspace}
\def\NBSP{{\asciifamily\char"A0}\xspace}
\def\asciihash{{\asciifamily\char`\#}\xspace}
\def\asciipercent{{\asciifamily\char`\%}\xspace}
\def\asciicircum{{\asciifamily\char`\^}\xspace}
\def\asciitilde{{\asciifamily\char`\~}\xspace}
\def\asciilbrace{{\asciifamily\char`\{}\xspace}
\def\asciidollar{{\asciifamily\char`\$}\xspace}
\def\asciiampersand{{\asciifamily\char`\&}\xspace}
\def\asciiunderscore{{\asciifamily\char`\_}\xspace}
\def\asciibackslash{{\asciifamily\char`\\}\xspace}
\def\asciirbrace{{\asciifamily\char`\}}\xspace}
\def\asciispace{{\asciifamily\char"20}\xspace}
%    \end{macrocode}
% The following three commands provide access to glyphs that were not included in the
% original font.
%    \begin{macrocode}
\def\asciiquotedbl{{\asciifamily\char"22}\xspace}
\def\asciiquotegrave{{\asciifamily\char"60}\xspace}
\def\asciiquoteacute{{\asciifamily\char"27}\xspace}
%    \end{macrocode}
% In the original \textsf{ascii} package the |\splivert| command was supposed to provide 
% access to the \splitvert character. However, it actually provided access to the
% \asciivert character. To remedy this drawback, we introduced the correct glyph in
% the new font and provided a new command to access this glyph. Needless to say, the
% old command is now an alias to the new command. 
%    \begin{macrocode}
\def\isosplitvert{{\asciifamily\char"A6}\xspace}
\def\asciivert{{\asciifamily\char"7C}\xspace}
\let\splitvert\isosplitvert
%</ascii>
%    \end{macrocode}
%
% \Finale