diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/mftinc/mftinc.sty | 235 |
1 files changed, 235 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/mftinc/mftinc.sty b/Master/texmf-dist/tex/latex/mftinc/mftinc.sty new file mode 100644 index 00000000000..b49a295c0d4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/mftinc/mftinc.sty @@ -0,0 +1,235 @@ +%% +%% This is file `mftinc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% mftinc.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2005 by Scott Pakin <scott+mft@pakin.org> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{mftinc} + [2005/01/31 v1.0a Include pretty-printed Metafont listings in LaTeX] +\RequirePackage{rawfonts} +\newfam\bffam +\newfam\itfam +\DeclareRobustCommand{\mftinput}[1]{\begingroup\input #1\endgroup} +\RequirePackage{keyval} +\define@key{mft}{toprule}{\setlength{\mft@top@rule}{#1}} +\define@key{mft}{bottomrule}{\setlength{\mft@bot@rule}{#1}} +\define@key{mft}{tablewidth}{\setlength{\mft@table@width}{#1}}% +\define@key{mft}{charrange}{% + \def\mft@ranges{}% + \def\mft@expanded@ranges{}% + \mft@parse@ranges#1,,% + {\let\@elt=\mft@expand@range\mft@ranges}% +} +\DeclareRobustCommand{\setmftdefaults}[1]{\setkeys{mft}{#1}} +\newlength{\mft@top@rule} +\setlength{\mft@top@rule}{1pt} +\newlength{\mft@bot@rule} +\setlength{\mft@bot@rule}{1pt} +\newenvironment{explaincode}[1][]{% + \setkeys{mft}{#1}% + \par\vskip 4ex \@plus 2ex + \hrule\@height\mft@top@rule + \nobreak\medskip\nobreak\noindent\ignorespaces +}{% + \nobreak\medskip\nobreak + \hrule\@height\mft@bot@rule + \vskip 2ex \@minus 1ex +} +\newlength{\mft@wc@indent} +\def\mft@eat@quads#1{% + \ifx#1\quad + \global\addtolength{\mft@wc@indent}{1em}% + \expandafter\mft@eat@quads + \else + \def\quad{}% + \settowidth{\@tempdima}{\%~}% + \advance\@tempdima by \mft@wc@indent + \vspace{-2ex}% + \begin{adjustwidth}{\@tempdima}{}% + \begin{linenumbers}% + \internallinenumbers + \renewcommand{\makeLineNumber}{% + \rlap{\hspace*{\mft@wc@indent}\%}}% + \expandafter#1% + \fi +} +\newenvironment{wrapcomment}{% + \global\setlength{\mft@wc@indent}{0pt}% + \def\quad{% + \global\addtolength{\mft@wc@indent}{1em}% + \mft@eat@quads + }% +}{% + \end{linenumbers}% + \end{adjustwidth}% +} +\def\mft@missing#1{% + \PackageWarning{mftinc}{% + Disabling the wrapcomment environment\MessageBreak + (can't find #1.sty)% + } + \renewenvironment{wrapcomment}{% + \PackageError{mftinc}{The wrapcomment environment is disabled}{% + Your LaTeX installation is lacking #1.sty.\space\space + The\MessageBreak mftinc package relies on both the chngpage + package and\MessageBreak the lineno package in order to + implement the wrapcomment \MessageBreak environment.\space\space + Either install those packages, or refrain\MessageBreak from + using wrapcomment in code that is formatted with + mft\MessageBreak and included into LaTeX. + }% + }{}% + \def\mft@missing##1{}% +} +\IfFileExists{chngpage.sty}{\RequirePackage{chngpage}}{\mft@missing{chngpage}} +\IfFileExists{lineno.sty}{\RequirePackage{lineno}}{\mft@missing{lineno}} +\long\def\mfcomment#1\9#2\par{\unskip#2 } +\def\mft@ranges{} +\def\mft@parse@ranges#1,{% + \def\mft@arg@i{#1}% + \ifx\mft@arg@i\empty + \else + \@cons\mft@ranges{#1-!-!-!!}% + \expandafter\mft@parse@ranges + \fi +} +\def\mft@expanded@ranges{} +\def\mft@gobble@range#1!!{} +\def\mft@expand@range#1-#2-{% + \def\mft@arg@i{#1}% + \def\mft@arg@ii{#2}% + \ifx\mft@arg@i\empty + \def\mft@arg@i{-1}% + \fi + \ifx\mft@arg@ii\empty + \def\mft@arg@ii{65535}% + \fi + \if\mft@arg@ii!% + \def\mft@arg@ii{#1}% + \fi + \if\mft@arg@i!% + \else + \@cons\mft@expanded@ranges{\mft@arg@i|\mft@arg@ii|}% + \fi + \mft@gobble@range +} +\def\mft@check@char#1{% + \begingroup + \def\@elt##1|##2|{% + \ifnum"\mft@h#1<##1 + \else + \ifnum"\mft@h#1>##2 + \else + \char"\mft@h#1 + \fi + \fi + }% + \mft@expanded@ranges + \endgroup +} +\def\mft@char#1{% + \begingroup + \def\@elt##1|##2|{% + \ifnum#1<##1 + \else + \ifnum#1>##2 + \else + \char#1 + \fi + \fi + }% + \mft@expanded@ranges + \endgroup +} +\newlength{\mft@table@width} +\setlength{\mft@table@width}{-1pt} +\def\mft@expanded@ranges{\@elt 0|65535|} +\DeclareRobustCommand{\fonttable}[2][]{% +\begingroup +\let\mft@old@ranges=\mft@ranges +\let\mft@old@expanded@ranges=\mft@expanded@ranges +\setkeys{mft}{#1}% +\ifdim\mft@table@width<0pt + \begin{minipage}{\linewidth}% +\else + \begin{minipage}{\mft@table@width}% +\fi + \font\testfont=#2\testfont + \newcount\mft@m + \newcount\mft@n + \newcount\mft@p + \newdimen\dim + \def\oct##1{\hbox{\rm\'{}\kern-.2em\it##1\/\kern.05em}}% + \def\hex##1{\hbox{\rm\H{}\tt##1}}% + \def\setdigs##1"##2{\gdef\mft@h{##2}% + \mft@m=\mft@n \divide\mft@m by 64 \xdef\mft@zero{\the\mft@m}% + \multiply\mft@m by-64 + \advance\mft@m by\mft@n + \divide\mft@m by 8 + \xdef\mft@one{\the\mft@m}}% +\def\testrow{\setbox0=\hbox{\penalty 1\let\\=\mft@check@char + \\0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\A\\B\\C\\D\\E\\F% + \global\mft@p=\lastpenalty}} % \mft@p=1 if none of the characters exist + \def\oddline{\cr + \noalign{\nointerlineskip}% + \multispan{19}\hrulefill& + \setbox0=\hbox{\lower 2.3pt\hbox{\hex{\mft@h x}}}\smash{\box0}\cr + \noalign{\nointerlineskip}}% + \newif\ifskipping + \def\evenline{\loop\skippingfalse + \ifnum\mft@n<256 \mft@m=\mft@n \divide\mft@m 16 \chardef\next=\mft@m + \expandafter\setdigs\meaning\next \testrow + \ifnum\mft@p=1 \skippingtrue \fi\fi + \ifskipping \global\advance\mft@n 16 \repeat + \ifnum\mft@n=256 \let\next=\endchart\else\let\next=\morechart\fi + \next}% + \def\morechart{\cr\noalign{\hrule\penalty5000}% + \chartline \oddline \mft@m=\mft@one \advance\mft@m 1 + \xdef\mft@one{\the\mft@m}% + \chartline \evenline}% + \def\chartline{&\oct{\mft@zero\mft@one x}% + &&\:&&\:&&\:&&\:&&\:&&\:&&\:&&\:&&}% + \def\chartstrut{\lower4.5pt\vbox to14pt{}}% + \def\table{$$\global\mft@n=0 + \halign to\hsize\bgroup + \chartstrut####\tabskip0pt plus10pt& + &\hfil####\hfil&\vrule####\cr + \lower6.5pt\null + &&&\oct0&&\oct1&&\oct2&&\oct3&&\oct4&&\oct5&&\oct6&&\oct7&\evenline}% + \def\endchart{\cr\noalign{\hrule}% + \raise11.5pt\null&&&\hex 8&&\hex 9&&\hex A&&\hex B& + &\hex C&&\hex D&&\hex E&&\hex F&\cr\egroup$$\par}% + \def\:{\setbox0=\hbox{\mft@char\mft@n}% + \ifdim\ht0>7.5pt\reposition + \else\ifdim\dp0>2.5pt\reposition\fi\fi + \box0\global\advance\mft@n 1 }% + \def\reposition{\setbox0=\vbox{\kern2pt\box0}\dim=\dp0 + \advance\dim 2pt \dp0=\dim}% + \def\centerlargechars{ + \def\reposition{\setbox0=\hbox{$\vcenter{\kern2pt\box0\kern2pt}$}}}% + \table +\end{minipage}% +\global\let\mft@ranges=\mft@old@ranges +\global\let\mft@expanded@ranges=\mft@old@expanded@ranges +\endgroup +} +\endinput +%% +%% End of file `mftinc.sty'. |