diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/protex |
Initial commit
Diffstat (limited to 'web/protex')
-rw-r--r-- | web/protex/AlProTex.sty | 1596 | ||||
-rw-r--r-- | web/protex/ChangeLog | 17 | ||||
-rw-r--r-- | web/protex/ProTex.sty | 348 | ||||
-rw-r--r-- | web/protex/README | 613 |
4 files changed, 2574 insertions, 0 deletions
diff --git a/web/protex/AlProTex.sty b/web/protex/AlProTex.sty new file mode 100644 index 0000000000..63803c67b3 --- /dev/null +++ b/web/protex/AlProTex.sty @@ -0,0 +1,1596 @@ +% $Id: AlProTex.sty 185 2016-07-04 18:14:23Z karl $ +% Copyright 2016 TeX Users Group +% Copyright 1992-2008 Eitan M. Gurari +% +% This program can 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 (at your option) any later version. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work +% is the TeX4ht Project <http://tug.org/tex4ht>. +% +% If you modify this program, changing the +% version identification would be appreciated. +\immediate\write-1{version 2016-07-04} + +\expandafter\edef\csname :RestoreCatcodes\endcsname{% + \catcode`\noexpand\noexpand\noexpand \^=\the\catcode`\^% + \catcode`\noexpand\noexpand\noexpand \_=\the\catcode`\_% +} +\catcode`\^=7 \catcode`\_=8 +\expandafter\edef\csname :RestoreCatcodes\endcsname{% + \csname :RestoreCatcodes\endcsname + \csname du:cc\endcsname + \catcode`\noexpand "=\the\catcode`\"% + \catcode`\noexpand |=\the\catcode`\|% + \catcode`\noexpand :=\the\catcode`:% + \catcode`\noexpand @=\the\catcode`@% + \catcode`\noexpand -=\the\catcode`-% + \catcode`\noexpand +=\the\catcode`+% + \catcode`\noexpand /=\the\catcode`/% + \catcode`\noexpand .=\the\catcode`.% + \catcode`\noexpand \^^M=\the\catcode`\^^M% + \catcode`\noexpand \^^I=\the\catcode`\^^I% + \catcode`\noexpand \%=\the\catcode`\%% + \let\expandafter\noexpand + \csname:RestoreCatcodes\endcsname=\noexpand\undefined} +\catcode`\@=11 \catcode`\:=11 \catcode`\"=12 \catcode`\|=12 +\def\TagLine[#1]{} \def\ResetLineCount{} +\def\RefLine[#1]{} \def\ShowLineCount{} +\def\HideLineCount{} \def\PauseLineCount{} +\def\ContLineCount{} \def\:InitAlProTex#1,#2//{ + \def\:InitAlProTex{#1}% + \let\:ModifyOutputCodeO=\ModifyOutputCode + \def\ModifyOutputCode{\def\Extension{#1}\:ModifyOutputCodeO} + \ifx \html:addr\:UnDeF \def\AlProTex{#2}\else + \ifx \html:addr\empty \def\AlProTex{#2}\else + \def\AlProTex{html,#2}\fi \fi} + +\expandafter\:InitAlProTex\AlProTex,// + + +\def\:temp{\csname newif\endcsname} +\expandafter\ifx \csname :Optionfalse\endcsname\relax + \expandafter\:temp \csname if:Option\endcsname +\fi +\def\:CheckOption#1{ \def\:temp{#1} + \:Optionfalse + \expandafter\:GetOptions\AlProTex,,// } + +\def\:GetOptions#1,#2//{ \def\:next{#1} + \ifx \:next\empty + \else \ifx \:temp\:next \:Optiontrue \let\:next=\relax + \else \def\:next{\:GetOptions#2//} + \fi \fi \:next } +\def\:CntrlChar{`\\} +\catcode`\|=0 |catcode`|\=12 +|def|:notex{\} +|catcode`|\=0 |catcode`||=12 +\def\:temp{ \catcode`\@=12 + \def\:temp##1{\catcode`\@=11 + \:CheckOption{##1}} \:temp} +\:temp{@} +\if:Option \def\:CntrlChar{`\@} +\catcode`\@=12 +\def\:notex{@} +\catcode`\@=11 +\let\:ModifyAppendCodeII=\ModifyAppendCode +\let\:ModifyShowCodeII=\ModifyShowCode +\let\:ModifyOutputCodeII=\ModifyOutputCode +\def\ModifyAppendCode{\catcode`\@=0 \catcode`\\=12 + \:ModifyAppendCodeII} +\def\ModifyOutputCode{\def\@{@}\:ModifyOutputCodeII} +\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\@{\char64 }} +\else \ifx \:ModifyAppendCodeII\:undefined + \:CheckOption{|} \if:Option + \def\:CntrlChar{`\|} +\def\:notex{|} +\let\:ModifyAppendCodeII=\ModifyAppendCode +\let\:ModifyShowCodeII=\ModifyShowCode +\let\:ModifyOutputCodeII=\ModifyOutputCode +\def\ModifyAppendCode{\catcode`\|=0 \catcode`\\=12 + \:ModifyAppendCodeII} +\def\ModifyOutputCode{\def\|{|}\:ModifyOutputCodeII} +\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\|{\char124 }} +\else \ifx \:ModifyAppendCodeII\:undefined + \:CheckOption{`} \if:Option + \def\:CntrlChar{`\`} +\def\:notex{`} +\let\:ModifyAppendCodeII=\ModifyAppendCode +\let\:ModifyShowCodeII=\ModifyShowCode +\let\:ModifyOutputCodeII=\ModifyOutputCode +\def\ModifyAppendCode{\catcode`\`=0 \catcode`\\=12 + \:ModifyAppendCodeII} +\def\ModifyOutputCode{\def\`{`}\:ModifyOutputCodeII} +\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\`{\char96 }} +\else \ifx \:ModifyAppendCodeII\:undefined + \:CheckOption{?} \if:Option + \def\:CntrlChar{`\?} +\def\:notex{?} +\let\:ModifyAppendCodeII=\ModifyAppendCode +\let\:ModifyShowCodeII=\ModifyShowCode +\let\:ModifyOutputCodeII=\ModifyOutputCode +\def\ModifyAppendCode{\catcode`\?=0 \catcode`\\=12 + \:ModifyAppendCodeII} +\def\ModifyOutputCode{\def\?{?}\:ModifyOutputCodeII} +\def\ModifyShowCode#1{\:ModifyShowCodeII{#1}\def\?{\char63 }} +\fi \fi \fi \fi \fi \fi \fi\:CheckOption{xref} \if:Option + \csname newread\endcsname\sdx:file +\immediate\openin\sdx:file=\jobname.sdx +\csname newwrite\endcsname\cdx:file +\immediate\openout\cdx:file=\jobname.cpg +\let\xref:OutputCode=\OutputCode +\def\OutputCode#1{% + {\Comment{ startcodefragment}{//}% + \let\ProTexMssg=\:gobble + \let\xref:ModifyOutputCode=\ModifyOutputCode + \def\wrt:index##115{\immediate\write\cdx:file }% + \def\ModifyOutputCode##1{\xref:ModifyOutputCode{##1}\bgroup + \def\relax####115####215{\egroup + \expandafter\wrt:index\:WriteCode + }}% + \xref:OutputCode#1}% + \xref:OutputCode#1} + + \expandafter\ifx \csname tmp:cnt\endcsname\relax + \csname newcount\endcsname\tmp:cnt +\fi +\def\change:cats#1#2#3{% + \tmp:cnt#1 + \def\no::catcodes{% + \catcode\tmp:cnt#3 + \ifnum\tmp:cnt<#2 + \advance\tmp:cnt 1 \expandafter\no::catcodes + \fi }% + \no::catcodes } + +\def\scan:token{\futurelet\:next\check:ch} +\def\check:ch{\ifx \:next\par \expandafter\end + \else \expandafter\scan:ch\fi} +\def\scan:ch#1{\relax + \ifx #1\egroup \index:tok \expandafter\egroup\else + \ifcat #1a% + \ifx \index:tok\empty + \change:cats{48}{57}{11}% 0--9 + \fi + \edef\index:tok{\index:tok#1}% + \ifx \index:tok\start:comment + \let\index:tok=\empty \let~=\scan:comment + \change:cats{48}{57}{12}% 0--9 + \fi + \else + \change:cats{48}{57}{12}% 0--9 + \if \index:tok\empty \else + \write:index{1 + \sp:id\index:id \space1 \l:idel\index:tok\r:idel }% + \write:index{2 + \l:idel\index:tok\r:idel \space \sp:id\index:id }% + \fi + \let\index:tok=\empty + \fi \expandafter~\fi} +\def\sp:id#1{% + \ifnum #1<10000 \space\fi + \ifnum #1<1000 \space\fi + \ifnum #1<100 \space\fi + \ifnum #1<10 \space\fi + #1} + +\catcode`\@=0 \catcode`\\=12 @relax + @:CheckOption{html} @if:Option +@def@scan:comment#1\<#2\>{% + @def@index:tok{#2}% + @afterassignment@exit:comment@tmp:cnt=} + @else +@def@scan:comment#1\<#2\>.{% + @def@index:tok{#2}% + @afterassignment@exit:comment@tmp:cnt=} + @fi +@catcode`@\=0 \catcode`\@=11 + +\def\start:comment{startcodefragment} +\def\exit:comment#1//{\def\:temp{#1}% + \ifx \:temp\open:comment + \index:push + \edef\index:level{I\index:level}% + \ifx \prev:comment\index:tok \else + \code:index{}% + \fi + \expandafter\edef\csname L \index:level\endcsname{% + \expandafter\ifx \csname L \index:level\endcsname\relax \else + \csname L \index:level\endcsname, + \fi \the\tmp:cnt + }% + \let\prev:dir=u% + \let\prev:comment=\index:tok% + \else + \code:index{I}% + \edef\index:level{\expandafter\:gobble\index:level}% + \let\prev:dir=d% + \index:pop\index:pop\index:push + \fi + \let\index:tok=\empty \edef\index:id{\the\tmp:cnt}% + \let~=\scan:token ~} +\def\open:comment{...} +\def\index:id{0} +\def\index:level{} +\let\prev:dir=f +\def\:gobble#1{} + + + +\def\index:push{\edef\pd:mem{\the\tmp:cnt,\pd:mem}} +\def\index:pop{\expandafter\do:pop\pd:mem//} +\def\do:pop#1,#2//{% + \if !#1!\tmp:cnt=-1 \else \tmp:cnt=#1\def\pd:mem{#2}\fi} +\def\pd:mem{,} + + +\def\code:index#1{% + \if d\prev:dir + \bgroup + \edef\index:tok{\l:idel\prev:comment\r:idel\space /\the\tmp:cnt/% + \expandafter\ifx \csname L #1\index:level\endcsname\relax \else + , \csname L #1\index:level\endcsname + \fi}% + \write:index{3 \index:tok }% + \expandafter\ifx \csname L #1\index:level\endcsname\relax \else + \edef\:tmp{\noexpand\derive:index \space + \csname L #1\index:level\endcsname,,}\:tmp + \fi + \egroup + \expandafter\let\csname L #1\index:level\endcsname=\:UnDe + \fi +} + +\def\derive:index#1,{% + \if !#1!\else + \write:index{1\sp:id{#1} 2 + \index:tok}\expandafter\derive:index\fi} + +\def\write:index{\immediate\write\cdx:file } +\def\l:idel{<} +\def\r:idel{>} + +\def\CodeIndex{% + \immediate\closeout\cdx:file \def\read:sdx{% + \ifeof\sdx:file \else + \immediate\read\sdx:file to\sdx:in \sdx:in + \expandafter\read:sdx + \fi +}\noindent\vrule\vbox{\tt +\hsize=0.8\hsize +\rightskip=3em plus 4em +\leftskip=3em +\parindent=0pt + +\ifnum \index:typ<4 + \sdx:in \fi + \read:sdx +}% +\immediate\closein\sdx:file + % + \immediate\openout\cdx:file=\jobname.cdx + \bgroup + \change:cats{0}{255}{12}% + \change:cats{97}{122}{11}% a--z + \change:cats{65}{90}{11}% A--Z + \change:cats{95}{95}{11}% _ + \let\index:tok=\empty \let~=\scan:token + \expandafter~\input \jobname.cpg \egroup + \immediate\write16{-- Have \jobname.cdx processed + into \jobname.sdx --}% +}% + + \let\xref:ModifyShowCode=\ModifyShowCode +\def\ModifyShowCode#1{% + \xref:ModifyShowCode{#1}% + \let\xref:ModifyShowLastCode=\ModifyShowLastCode + \def\ModifyShowLastCode{\xref:ModifyShowLastCode{#1}% + \def\:BackTitle{\noindent\vrule\vtop{% +\tt +\hsize=0.8\hsize +\rightskip=3em plus 4em +\leftskip=3em +\parindent=0pt + --\the\:CodeNumber--: \small:index +}}}} +\def\small:index{% + \ifnum \:CodeNumber<\index:num \else + \sdx:in + \ifeof\sdx:file + \def\index:num{1000000}\gdef\index:typ{4}% + \else + \immediate\read\sdx:file to\sdx:in + \expandafter\get:typ \sdx:in //% + \fi + \expandafter\small:index + \fi} +\def\get:typ#1 {% + \gdef\index:typ{#1}% + \ifnum #1>1 \def\index:num{1000000}\expandafter\id:gobble + \else \expandafter\get:nm\fi} +\def\id:gobble#1//{} +\def\get:nm#1 #2//{\def\index:num{#1}} +\def\index:num{0} +\let\sdx:in=\empty + +\fi +\:CheckOption{basic} \if:Option + \def\AlProTex{[[]],<<<>>>,list,title,ClearCode} + \def\:temp{\catcode`\`=12} +\catcode`\;=0 \catcode`\\=12 +;expandafter;catcode ;:CntrlChar=13 +;ifnum 92=;:CntrlChar + ;edef;:notex{;noexpand;::notex;noexpand\;:notex} +;fi +;ifnum 124=;:CntrlChar + ;edef;:notex{;noexpand;::notex;noexpand|;:notex} +;fi +;ifnum 64=;:CntrlChar + ;edef;:notex{;noexpand;::notex;noexpand@;:notex} +;fi +;ifnum 96=;:CntrlChar + ;edef;:notex{;noexpand;::notex;noexpand`;:notex} +;fi +;:temp ;catcode`;\=0 ;catcode`;;=12 + \def\::notex#1#2{\let\:notex=\:undefined + \let\::notex=\:undefined + % + \ifx \documentstyle\:undefined \errmessage{LaTeX is missing}\fi + \documentstyle{book} \let\cleardoublepage=\clearpage + \textwidth=469.75499pt \textheight=643.20255pt + \topmargin=-0.5in \oddsidemargin=0pt \evensidemargin=0pt + \begin{document} + \hbadness=10000 \vbadness=10000 \hfuzz=99in \vfuzz=\hfuzz + \tableofcontents \begingroup + % + \def\:amp{#2} + \def#1{\begingroup + \catcode`\ =12 \catcode`\^^M=12 \catcode`\^^I=12 + \expandafter\catcode\:CntrlChar=12 \:doAmp } + % + \def\:doAmp##1{\endgroup + \if ##1< \def\:next####1#1>{\<####1\>}% +\else \def\:next{##1}% +\ifx \:next\:amp +\else\if ##1c \def\:next{\:sect\chapter}% +\else\if ##1s \def\:next{ \vfil\:sect\section}% +\else\if ##1u \def\:next{ \vfil\:sect\subsection}% +\else\if ##1v \def\:next{\expandafter\def\csname\string + @xverbatim\endcsname########1#2{% + ########1\end{verbatim}\egroup}% + \bgroup\expandafter\catcode\:CntrlChar=12 + \begin{verbatim}}% +\else\if ##1o \def\:next####1#1<####2#1>{\OutputCode####1\<####2\>}% +\else\if ##1n \def\:next{\ClearCode}% +\else\if ##1e \def\:next{\endgroup\end{document}}% +\else \edef\:next{\noexpand\errmessage{\:amp##1?}}% +\fi\fi \fi\fi \fi\fi \fi\fi \fi +\:next } + % + \:NoSpecials{12}{0}{255} + \catcode`\ =10 \catcode`\^^M=5 \catcode`\^^I=10 + \escapechar=\:CntrlChar + \expandafter\catcode\:CntrlChar=13 } + \def\:specialactive{\catcode`\_=13 + \catcode`\~=13 \catcode`\\=13 \catcode`\#=13 + \catcode`\$=13 \catcode`\%=13 \catcode`\^=13 + \catcode`\&=13 \catcode`\{=13 \catcode`\}=13 } + +\def\:sect{\begingroup \:specialactive \::sect} + +\catcode`\/=0 \catcode`\[=1 \catcode`\]=2 +\catcode`\@=6 \catcode`\*=14 \:specialactive + +/def/::sect@1@2/par[/endgroup/begingroup + /def~[/bgroup/tt/char126/egroup]* + /def\[/bgroup/tt/char92/egroup]* + /def#[/bgroup/tt/char35/egroup]* + /def$[/bgroup/tt/char36/egroup]* + /def%[/bgroup/tt/char37/egroup]* + /def^[/bgroup/tt/char94/egroup]* + /def_[/bgroup/tt/char95/egroup]* + /def&[/bgroup/tt/char38/egroup]* + /def{[/bgroup/tt/char123/egroup]* + /def}[/bgroup/tt/char125/egroup]* + /escapechar=92 @1[@2]/endgroup] + +/catcode`/\=0 \catcode`\#=6 \catcode`\$=3 \catcode`\%=14 +\catcode`\^=7 \catcode`\&=4 \catcode`\{=1 \catcode`\}=2 +\catcode`\_=8 \catcode`\/=12 \catcode`\[=12 \catcode`\]=12 +\catcode`\@=11 \catcode`\*=12 + +\else + \let\:CntrlChar=\:undefined + \def\:notex{\let\:notex=\:undefined} +\fi +\:CheckOption{<<<>>>} \if:Option +\def\:OpenCode#1#2{\def\:OpenCode{#1}\def\:CloseCode{#2}} +\edef\:CloseCode{\noexpand\:OpenCode + \ifx \CodeDel\:UnDefined{<<<}{>>>}\else \CodeDel\fi } \:CloseCode +\let\:ModifyAppendCodeI=\ModifyAppendCode + \catcode`\^^M=13 +\edef\ModifyAppendCode{% +\catcode`\noexpand\{=12 \catcode`\noexpand\}=12 % +\let\noexpand\::ScanAppend=\noexpand\:ScanAppend % + \def\noexpand\:ScanAppend\:OpenCode##1^^M##2\:CloseCode{% + \noexpand\::ScanAppend{##2}}% +\noexpand\:ModifyAppendCodeI}% + \catcode`\^^M=5 +\fi \:CheckOption{[]} +\if:Option \else \:CheckOption{[[]]}\fi +\def\:temp{} +\if:Option + \def\:temp{\csname newdimen\endcsname\:BoxDepth} +\def\WindowTitle#1{{\leavevmode + \leftskip=0em \rightskip=0em + \parindent=0em \:BoxDepth=0.4pt + \setbox0=\hbox{#1}% + \advance\:BoxDepth by \dp0 + \advance\:BoxDepth by 0.4mm \raise -\:BoxDepth + \hbox{\vrule + \vbox{\hrule \vskip 0.4mm + \hbox{\hskip 0.4mm\relax #1\hskip 0.4mm}% + \vskip 0.4mm \hrule}% + \vrule}}} +\let\:ModifyShowCodeIII=\ModifyShowCode +\def\ModifyShowCode#1{\:ModifyShowCodeIII{#1}% + \def\PortTitle##1{\WindowTitle{\WindowTitle{##1}}}% + \def\:BackTitle{\hbox{---}}} +\fi \:temp \:CheckOption{[[]]} +\def\:temp{} +\if:Option + \let\:ShowCodeI=\:ShowCode +\def\:ShowCode#1{\par\:FrameCode{\:ShowCodeI{#1}}} +\def\:FrameCode#1{\vtop{% + \advance\hsize by -\leftskip + \noindent\vrule + \vtop{\leftskip=0pt \advance\hsize by -0.8pt + \hrule#1\hrule}\vrule}\vskip3pt minus1pt\relax} +\let\:ModifyShowCodeV=\ModifyShowCode +\def\ModifyShowCode#1{\:ModifyShowCodeV{#1}% + \let\PortTitle=\:PortTitleI + \def\:BottomTitle{}} +\def\:PortTitleI#1{{\parindent=0pt + \leftskip=0pt plus 0.5\hsize + \rightskip=\leftskip #1\par \vskip-1ex + \noindent\dotfill\null}} +\let\:ModifyShowLastCodeI=\ModifyShowLastCode +\def\ModifyShowLastCode#1{\:ModifyShowLastCodeI{#1}% + \advance\leftskip by -2em } +\fi \:temp \:CheckOption{list} \if:Option +\def\:show{% + \ifx \:title\empty \def\:show{\ShowCode-}% + \else \def\:show{\ShowCode}% + \fi \:show} +\fi + +\catcode`\-=13 \catcode`\+=13 \if:Option +\def\AfterCode#1{{% + \def-##1##2{\def\:title{##1}}% + \let+=\:ignoreII + #1\relax + \:show #1}} +\def\:ignoreII#1#2{} +\fi +\catcode`\-=12 \catcode`\+=12 + + \:CheckOption{enumerate} \def\:temp{} \if:Option + \def\:temp{\csname newcount\endcsname\:LineCount} + \let\:ModifyShowLastCode=\ModifyShowLastCode + \def\ModifyShowLastCode{\everypar={\:CountLines + {\it \:ShowLineCount \quad}}% + \let\:BottomTitleX=\:BottomTitle + \def\:BottomTitle{\everypar={}\:BottomTitleX}% + \:ModifyShowLastCode} + \def\ResetLineCount{ \global\:LineCount=0 } + \def\ShowLineCount{\def\:ShowLineCount{\ifnum\:LineCount<100 0\fi + \ifnum\:LineCount<10 0\fi + \the\:LineCount}} + \def\HideLineCount{\def\:ShowLineCount{}} + \def\ContLineCount{\def\:CountLines{\global\advance\:LineCount by 1 }} + \def\PauseLineCount{\def\:CountLines{}} + \ShowLineCount \ContLineCount + \def\TagLine[#1]{% + \edef\:temp{\noexpand\Tag\noexpand{C #1\noexpand}\noexpand{% + \the\:LineCount\noexpand}}\:temp} + \def\RefLine[#1]{\Ref{C #1}} + \let\:ModifyOutputCodeZ=\ModifyOutputCode + \def\ModifyOutputCode{\def\RefLine[##1]{}% + \def\TagLine[##1]{}\:ModifyOutputCodeZ} +\fi +\:temp \:CheckOption{ClearCode} +\if:Option + \gdef\:EraseCode{} + \def\ModifyCode#1{% + \let\clearcode:id=\clearcode::id + \def\:temp{\gdef\:EraseCode}% + \expandafter\expandafter\expandafter + \:temp\expandafter{\:EraseCode~#1}} + \def\ClearCode{{% + \def~##1{\global\let##1=\:undefined}% + \:EraseCode \:CodeNumber=\clearcode::id +\advance\:CodeNumber by 1 +\xdef\clearcode::id{\the\:CodeNumber } +}% + \gdef\:EraseCode{}} + \let\:ModifyShowCodeVI=\ModifyShowCode +\let\:AfterCodeI=\AfterCode +\let\:RefLineI=\RefLine +\let\:TagLineI=\TagLine +\def\ModifyShowCode#1{\:ModifyShowCodeVI{#1}% + \def\RefLine[##1]{{\def\clearcode:id{0}\:RefLineI[##1]}}% + \def\TagLine[##1]{{\def\clearcode:id{0}\:TagLineI[##1]}}% + \let\clearcode:id=\clearcode::id} +\def\AfterCode#1{\:AfterCodeI{#1}\def\clearcode:id{0}} +\ifx\clearcode:id\:UnDef + \gdef\clearcode:id{0} \gdef\clearcode::id{0} +\fi + +\fi\:CheckOption{LibCode} +\if:Option +\def\LibCode{\bgroup \catcode`\ =9 \catcode`\^^M=9 \catcode`\^^I=9 + \catcode`\,=13 \:LibCode} +\def\:LibCode[#1]{\catcode`\,=12 \:LibC[#1]} + \catcode`\,=13 \catcode`\^^M=13 +\def\:LibC[#1]#2(){\egroup % + \def,{ \noexpand\input\space}% + \edef\:LibFiles{\noexpand\:checkoption , #1 }% + \def\:next{\let\:xparms=\:parms % + \begingroup % + \let\LibCall=\:LibCall % + \def\AddLibCall####1{}% + \def\AddNestedLibCall####1{}% + \def\ifLibEnd{\csname ifx\endcsname\:parms\empty}% + \csname :LibFiles\endcsname \Comment{}{}% + \FreeCode\<\:TempFileName\> + \<\:TempFileName\><<< + \<lib code\> >>> % + \edef\:temp{\noexpand\OutputCodE + \noexpand\<\:TempFileName\noexpand\>}% + \:temp \input \:TempFileName % + \endgroup % + \::LibC }% + \def\:parms{#2}% + \let\:xparms=\empty \::LibC % + \let\:parms=\:UnDef \let\:xparms=\:UnDef}% +\def\LibTempFileName#1{\def\:TempFileName{#1}} +\LibTempFileName{lib.lib} + \catcode`\,=12 \catcode`\^^M=9 +\def\::LibC{% + \ifx \:parms\empty \let\:next=\relax + \else\ifx \:parms\:xparms \let\:next=\relax + \:warn{No code for \string\LibCode\space\:parms} + \fi\fi \:next} + +\def\LibShow#1{{\tt\par--- Include library component #1}} + +\def\:LibShow#1{% + \AddLibCall{#1}% + \LibShow{#1}} + +\def\:LibCall(#1,#2,#3){% + \xdef\:parms{% + (#1,#2,#3)% + \:parms}% + \def\temp{\global\let}% + \expandafter\temp\csname#2 \endcsname=\:LibShow + \gdef\:LibShow##1{% + \AddNestedLibCall{(#1,#2,#3)}% + \def\temp{\global\let\:LibShow=}% + \expandafter\temp\csname#2 \endcsname + }% +} + +\def\:checkoption{% + \def\:ShowCode##1{}% + \def\ProTexMssg##1{}% + % + \def\ifoption##1{% + \let\:rparms=\:parms + \def\parms{}% + \def\:lparms{}% + \def\:cond{##1}% + \def\:type{}% + \let\:next=\:ifoption \:next + \xdef\:parms{\:lparms\parms\:rparms}% + \csname ifx\endcsname \:type\:cond + \xdef\:parms{\:lparms\:rparms}% + \edef\:next{\noexpand\:LibShow{\parms}}% + \:next + }% + % + \def\:ifoption{% + \expandafter\:getoption\:rparms()% + \ifx \:type\:cond \let\:next=\relax \fi + \:next }% + % + \def\:getoption##1(){% + \def\:temp{##1}% + \ifx \:temp\empty \let\:next=\relax + \else \::getoption##1()\fi }% + % + \def\::getoption(##1,##2,##3)##4(){% + \edef\:lparms{\:lparms\parms}% + \def\parms{(##1,##2,##3)}% + \def\:rparms{##4}% + \def\:type{##2}}% +} +\fi\def\TextIndex#1{} \def\SecIndex#1{} +\def\ShowIndex{\:warn{\string\ShowIndex?}} + +\:CheckOption{ShowIndex} + +\def\:temp{} +\catcode`\-=13 \catcode`\+=13 + +\if:Option +\def\:temp{\csname newcount\endcsname \:IdxCount} +\def\:GetTrc{% + \immediate\read15 to \:x + \ifx \:PAR\:x \let\:GetTrc=\relax + \else \expandafter\:AddEntry\:x \fi + \:GetTrc} \def\:PAR{\par} + +\def\:AddEntry#1{\def\:cs{#1}\futurelet\:p\:RemoveField} +\def\:RemoveField{\ifx .\:p \def\:next##1 {\:AppendEntry} + \else \let\:next=\:AppendEntry \fi \:next} + +\def\:AppendEntry#1#2#3{\def\:y{#1}% + \ifx \:y\:NS \AppendCode\:idx{\endgroup + \:Section{#2}{#3}\begingroup}% + \expandafter\let\csname :idx\the\:IdxCount\endcsname=\:idx + \def\:temp{\Code\:idx{}}% + \expandafter\expandafter\expandafter\:temp\expandafter + {\csname :idx\the\:IdxCount\endcsname}% + \advance\:IdxCount by 1 + \else\ifx \:y\:V + \expandafter\ifx \csname :\:Title #2;;:\endcsname\relax + \expandafter\Code\csname :\:Title #2;;:\endcsname{}{\?{#2}}% + \fi + \expandafter\AppendCode\csname :\:Title #2;;:\endcsname{ #3}% + \:AddIdx{\csname :\:Title #2;;:\endcsname}% + \else + \edef\:cs{\expandafter\string\:cs.:} +\edef\:cs{\expandafter\noexpand\csname\:cs\endcsname} + \ifx \:y\:DT \expandafter\Code\:cs{}{\tr{#2}}% + \else\ifx \:y\:ST \expandafter\AppendCode\:cs{ \underbar{#3}}% + \:AddIdx{\:cs}% + \else\ifx \:y\:SC \expandafter\AppendCode\:cs{ #3}% + \:AddIdx{\:cs}% + \fi\fi\fi\fi\fi}\def\:AddIdx{% + \def\:y{\AppendCode\:idx}% + \expandafter\expandafter\expandafter\:y\expandafter} + +\def\SecIndex#1{{\let\:refout=\:trcfile \def\:TagCs{.}% + \Tag{section}{{#1};;}}} + +\def\TextIndex#1{{\let\:refout=\:trcfile \def\:TagCs{.}% + \Tag{user}{#1;;}}} + +\let\i:ModifyShowCode=\ModifyShowCode +\let\i:ModifyOutputCode=\ModifyOutputCode +\def\ModifyOutputCode{% + \ifx \:OpenCode\:UnDef \def\TextIndex##1{}% + \else \let\TextIndex=\Text:Index \fi + \i:ModifyOutputCode} +\def\ModifyShowCode{% + \ifx \:OpenCode\:UnDef \else \let\TextIndex=\::TextIndex \fi + \i:ModifyShowCode } +\let\:TextIndex=\TextIndex +\catcode`\[=1 \catcode`\{=12 \catcode`\]=2 \catcode`\}=12 +\def\::TextIndex{#1}[\:TextIndex[#1]] +\def\Text:Index{#1}[] +\catcode`\[=12 \catcode`\{=1 \catcode`\]=12 \catcode`\}=2 + +\def\:V{user} +\def\:DT{DefineTitle} \def\:ST{ShowTitle} \def\:SC{ShowCode} +\def\:NS{section} + +\def\:Title#1;;#2;;{#1} +\def\:TitleA#1;;#2;;{$\triangleleft\triangleleft$ #1 + $\triangleright\triangleright$} + +\def\:Index{\vfil\eject \Comment{}{}% + \immediate\closeout\:trcfile + \def\ModifyShowCode##1{}% + \def\ModifyAppendCode##1{}% + \def\ModifyFrontTitle##1{}% + \def\ModifyShowLastCode##1{##1}% + \def\AfterCode##1{}% + \def\:WriteTrc##1{}% + \let\:TraceDef=\:ignoreII + \def\:warn##1{}% + \def\:gobble##1{}% + \let\CodeId=\:ignoreII + \def\ModifyOutputCode##1{\def\:FileName{\jobname.xidx}}% + \Code\:idx{}{\BeforeIndex\begingroup}% + \:PauseIndex \immediate\openin15=\:jobname + \:GetTrc \AppendCode\:idx{\endgroup}% + {\def\?##1{\par\noindent{\tt\:Title ##1;;}\hfill}% + \def\tr##1{\par\noindent{\tt\:TitleA ##1;;}\hfill}% + \def\:Section##1##2{{\bf\smallskip\noindent{\:Title ##1;;}\hfill + ##2\smallskip}}% + \def\ModifyShowLastCode##1{% + \leftskip=0pt \rightskip=0pt + \def\:LastCode{\:idx}% + \:SetShowIndex}% + \let\:FrameCode=\empty + \expandafter \ShowCode\:minus\:idx }} + + +\def\:ignoreII#1#2{} + +\def\:SetShowIndex{\def-##1##2{\expandafter\def\csname + \expandafter\:gobble##2\endcsname{}}% + \def+##1##2{##1}} + +\def\BeforeIndex{} +\def\:PauseIndex{} +\def\PauseIndex{\def\PauseIndex{\immediate\read16 to \PressReturn}} +\def\ShowIndex{{% + \let\:SvCode=\Code + \def\Code##1{\ModifyCode{##1}\:SvCode##1}% + \ifx \::AddEntry\:undefined + \else \let\:AddEntry=\::AddEntry \fi + \:Index \global\let\:idx=\:undefined }% + \xdef\:jobname{\jobname.trc\the\pageno}% + \immediate\openout\:trcfile=\:jobname \relax } + +\xdef\:jobname{\jobname.trc} + \fi \catcode`\-=12 \catcode`\+=12 \:temp +\:CheckOption{title+} \if:Option + \def\:temp{\def\AlProTex} + \def\temp:{title,} + \expandafter\expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\:temp\expandafter\expandafter + \expandafter{\expandafter \temp:\AlProTex} +\fi +\:CheckOption{title} \if:Option + \def\:Name#1{<#1\string\>\endcsname} +\def\:DoName#1{\expandafter#1\csname\:Name} + +\def\getTitle:env{\catcode`\_=11 }% +\def\<{\bgroup \getTitle:env \cont:title}% +\def\cont:title#1\>{\egroup\edef\CodeInputLineNo{\the\inputlineno}% + \:DoName\ifx{#1}\relax + \edef\:temp{\noexpand\Code\:DoName + \noexpand{#1}\noexpand{#1\noexpand}}% + \:DoName\let{#1}=\:undefined + \else \def\:temp{\:DoName\AppendCode{#1}}\fi\:temp} + + \catcode`\.=10 \catcode`\ =13 +\let\:ModifyShowCodeIV=\ModifyShowCode% +\def\ModifyShowCode{% +..\def\:gobble##1{}% +..\def\<##1\>{{\def {\space}% +...\:DoName\ifx{##1}\relax% +.....\let\AppendCode=\:gobble% +.....\:DoName\Code{##1}{##1}{}\fi% +..\csname\:Name{##1}}}\:ModifyShowCodeIV}% +\def\:OutputCodeI#1\<#2\>{% +...\let\:SaveSp= \def {}% +...\def\:temp{#2}% +...\ifx\:temp\empty.\def\:temp{ProTexOutput}% +...\else.\let\:temp=\empty.\fi% +...\expandafter\ifx.\csname.\:temp#2\endcsname\relax% +...\else.\immediate\write16{---.AlProTex. warning.---.% +......\string\OutputCode#1% +......\string\<#2\string\>\space.temporarily\space.% +......redefines.\:backslash#2}\fi% +...\edef\:FileName{\:temp#2}% +...\let =\:SaveSp% +...\expandafter\def\csname\:FileName\endcsname{\csname\:Name{#2}}% +...\def\:tempa{\:OutputCodeIV#1}% +...\expandafter\:tempa\csname\:FileName\endcsname% +..\endgroup}% +\catcode`\ =10\catcode`\.=12 + +\let\:OutputCodeIV=\OutputCode +\def\OutputCode{% + \begingroup + \def\<##1\>{\csname\:Name{##1}}% + \let\:WriteTrcI=\:WriteTrc \def\:gobble##1{}% + \def\:WriteTrc{\edef\:TagCs{\string\<\expandafter\expandafter + \expandafter\:gobble \:TagCs\string\>}% + \:WriteTrcI} + \catcode` =13 \:OutputCodeI} + +\def\OutputCodE\<#1.#2\>{{ + \:DoName\def{#1}{\<#1.#2\>} + \OutputCode[#2]\<#1\>}} + +\def\FreeCode\<#1\>{{% + \def\temp##1{\global\let##1=\:UnDefined}% + \:DoName\temp{#1}}} + +\def\ShowCode#1{% + \def\:test{#1}% + \ifx \:test\:minus \def\:next{\:iname\:ShowCode}\else + \def\:next{\:iname\:ShowCode#1}\fi + \:next} + +\def\:iname#1#2{\def\:next{#2}\def\:temp{\<}% + \ifx \:next\:temp + \def\:next##1\>{\expandafter#1\csname\:Name{##1}}\else + \def\:next{#1#2}\fi \:next} + +\def\::AddEntry#1{% + \ifx #1\< \let\:Next=\:AddEntryA + \else \def\:Next{\def\:cs{#1}\:AddEntryB}\fi + \:Next } + +\def\:AddEntryA#1\>{% + \edef\:cs{\expandafter\noexpand + \csname#1:.\endcsname}\:AddEntryB} + +\def\:AddEntryB{% + \futurelet\:p\:RemoveField}% + \def\:RemoveField{\ifx .\:p \def\:next##1 {\:AppendEntry}% + \else \let\:next=\:AppendEntry \fi \:next} + +\let\id:WriteTrc=\:WriteTrc +\def\:WriteTrc#1{% + \def\:temp{#1}\def\:tempa{ShowTitle}\ifx\:temp\:tempa + \expandafter\def\expandafter\:TagCs\expandafter + {\:TagCs.\the\:CodeNumber}% + \fi + \id:WriteTrc{#1}} + + \:CheckOption{macro} \if:Option +\let\:saveMusp=\> + +\def\>{\ifmmode \expandafter\:saveMusp \else \expandafter\:CodeMacro \fi } + +\def\:CodeMacro(#1)#2\<{% + \begingroup + \:getcodeprms(\string\1,\string\2,\string\3,\string\4,% + \string\5,\string\6,\string\7,\string\8,\string\9)% + \xdef\:temp{()#2}% + \endgroup + \def\:next{#1}% + \ifx\:next\empty + \expandafter\ifx\csname\:temp\space :<\endcsname\relax + \ifx\:EraseCode\:UnDef\else + \expandafter\:adderase \csname\:temp\space :<\endcsname + \fi + \else + \:warn{Redefine \string\>\:temp\string\<}% + \fi + \def\:next{\expandafter\:getpseducode + \csname\:temp\space :<\endcsname{#2}}% + \else + \begingroup + \:getcodeprms(#1,,,,,,,,,)% + \:protectcommands \ModifyIndirectCode{(#1)#2}% + \xdef\:next{\csname\:temp\space :<\endcsname}% + \endgroup + \fi + \:next} + +\def\:adderase#1{% + \def\:next{\gdef\:EraseCode}% + \expandafter\expandafter\expandafter\:next\expandafter{\:EraseCode~#1}% +} + +\def\:getpseducode#1#2{\begingroup + \:defaultcats + \ModifyAppendCode{}% + \:getpseducodeI#1{#2}} + +\def\:getpseducodeI#1#2#3{\endgroup + \def#1{\<#2\>{#3}}% +}% + +\def\:getpseducodeII{% + \ifx \:OpenCode\:UndDef + \else + \edef\:getpseducodeI{% + \def\noexpand + \:getpseducodeI####1####2####3\:OpenCode####4\:CloseCode{% + \endgroup + \def\noexpand\:temp{####3}% + \noexpand\ifx\noexpand\:temp\noexpand\empty + \def####1{\noexpand\<####2\noexpand + \>\:OpenCode####4\:CloseCode}% + \noexpand\else + \errmessage{\string\>()...\string + \<...?...\:OpenCode...\:CloseCode} + \let####1=\noexpand\:UnDef + \noexpand\fi + }% + }% + \:getpseducodeI + \fi + \let\:getpseducodeII=\:UndDef +} + \catcode`\ =13 \catcode`\^^M=13 \catcode`\^^I=13 + \catcode`\#=14 \catcode`\%=12 +\def\:protectcommands{# +\let\<=\relax# +\let\>=\relax# +\let\%=\csname# +\expandafter\let\%NL%\endcsname=\relax# +\let\%=\relax# +\let\ =\relax# +\let^^M=\relax# +\let^^I=\relax# +\ifx\TagLine\:UnDef\else\let\TagLine=\relax\fi# +\ifx\RefLine\:UnDef\else\let\RefLine=\relax\fi# +} + \catcode`\#=6 \catcode`\%=14 + \catcode`\ =10 \catcode`\^^M=9 \catcode`\^^I=10 + +\def\ModifyIndirectCode#1{} +\def\:getcodeprms(#1,#2,#3,#4,#5,#6,#7,#8,#9){% + \def\1{#1}% + \def\2{#2}% + \def\3{#3}% + \def\4{#4}% + \def\5{#5}% + \def\6{#6}% + \def\7{#7}% + \def\8{#8}% + \def\9##1,##2){\def\9{##1}}% + \9#9,)} \fi + \:CheckOption{title}\if:Option \def\TitleAlias#1#2{% + \expandafter\let\csname C\string#1\endcsname=\<% + \expandafter\let\csname O\string#1\endcsname=\OutputCode + \def\<##1\>{\def\:temp{##1}\def\:tempa{#2}% + \ifx \:temp\:tempa + \def\:temp{\csname C\string#1\endcsname#1\>}\else + \def\:temp{\csname C\string#1\endcsname##1\>}\fi \:temp} + \def\OutputCode##1\<##2\>{\def\:temp{##2}\def\:tempa{#2}% + \ifx \:temp\:tempa + \def\:temp{\csname O\string#1\endcsname##1\<#1\>}% + \else \def\:temp{\csname O\string#1\endcsname##1\<##2\>}\fi + \:temp}} + \fi +\fi + +%% Set source line numbers in the output +%% \srclineBOL{symbol} - to change a beginning-of-line symbol +%% \CodeInputLine - to change all the string. +%% +\:CheckOption{CodeLineNo} +\if:Option + %% Set beginning-of-line symbol to # + %% if extension is c (case sensitive) + \if\:InitAlProTex c\relax + \srclineBOL{\#} + \fi + \SetOutputWithLineNo +\fi + +\:CheckOption{eline} +\catcode`\%=12 +\if:Option + \let\:ModifyOutputCodeJ=\ModifyOutputCode + \def\ModifyOutputCode{\def\:Ln{ %^^J}\:ModifyOutputCodeJ} +\fi \catcode`\%=14 +\:CheckOption{ShowFile} +\if:Option +\catcode`\^^I=13\catcode`\ =13\catcode`\^^M=13% +\def\:ObeyIn{\CodeFont\parindent=0pt% + \parskip=0pt\everypar{}% + \:NoSpecials{12}{0}{255}\catcode`\ =13% + \catcode`\^^M=13\catcode`\^^I=13% + \def^^M{\leavevmode\par}\def^^I{ }% + \def {\leavevmode\:Sp}}% +\catcode`\^^M=5\catcode`\ =10\catcode`\^^I=10 +\expandafter\ifx \csname :Sp\endcsname\relax + \expandafter\def\csname :Sp\endcsname{ } +\fi +\def\ShowFile#1{{\:ObeyIn \openin15=#1 + \ifeof15 \:warn{\string\ShowFile{#1}?}\else + \input #1 \fi \closein15 }} +\else \def\ShowFile#1{\:warn{\string\ShowFile?}} +\fi\let\Note=\empty \let\EndNote=\empty + +\:CheckOption{NoShow} \if:Option + \let\:svShowCode=\:ShowCode + \def\ShowOn{\let\Note=\empty + \let\:ShowCode=\:svShowCode} + \def\ShowOff{\let\Note=\:NoShow + \def\:ShowCode##1{}} + \def\:NoShow{\begingroup + \:NoSpecials{11}{0}{255}\:EndNoShow} + \catcode`\/=0 \catcode`\\=11 + /def/:EndNoShow#1\EndNote{/endgroup} + /catcode`/\=0 /catcode`//=12 +\fi\:CheckOption{ShowTop} +\catcode`\-=13 \catcode`\+=13 +\if:Option +\def\:ShowTop#1{{\par + \def\ModifyFrontTitle##1{\def\:AppendSign{}}% + \def\ModifyShowLastCode##1{\let\:save=-% + \def\:LastCode{#1}% + \def-####1####2{\let-=\:save}% + \def+####1####2{{\ShowSep\let+=\:ignoreII ####1}}}% + \ShowCode#1}} + +\def\ShowSep{} +\def\ShowTop{\:iname\:ShowTop} +\def\:ignoreII#1#2{} +\def\:iname#1#2{\def\:next{#2}\def\:temp{\<}% + \ifx \:next\:temp + \def\:next##1\>{\expandafter#1\csname\:Name{##1}}\else + \def\:next{#1#2}\fi \:next} +\fi +\catcode`\-=12 \catcode`\+=12 +\def\LinkPort{\:HRefCode{)\clearcode:id P:}} +\def\LinkWindow{\:HRefCode{)\clearcode:id Z:}} +\def\:HRefCode#1\<#2\>{} +\:CheckOption{info} \if:Option + \let\inf:ModifyOutputCode=\ModifyOutputCode + \def\ModifyOutputCode#1{% + \inf:ModifyOutputCode{#1}% + \expandafter\ifx \csname \Extension :cdinfo\endcsname \relax \else + \edef\:FileName{\:FileName}% + \expandafter\expandafter\csname \Extension :cdinfo\endcsname + \:FileName!*?: % + \fi } + \def\CodeInfo{\futurelet\:temp\cd:inf} + \edef\cd:inf{\noexpand\ifx [\noexpand\:temp + \let\noexpand\:temp=\noexpand\cdi:nf + \noexpand\else \def\noexpand\:temp{\noexpand\cdi:nf + [\:InitAlProTex]}\noexpand\fi + \noexpand\:temp} + \def\cdi:nf[#1]{\expandafter\def\csname + #1:cdinfo\endcsname##1.##2!*?: } +\fi + +\ifx \HCode\:UnDef \ifx \Htmltrue\:UnDef + \def\:temp{\csname newif\endcsname} + \expandafter\:temp \csname ifHtml\endcsname \Htmlfalse +\fi + +\def\EndLink{\ifx \empty:lnk\empty \HCode{\Hbrakets</\tag:A>}\fi} +\def\:HRef{\ifx [\:temp \expandafter\::HRef + \else \expandafter\:::HRef \fi } +\def\HT:tag{\ifx -\let:val \expandafter\H:Tag + \else \expandafter\HTa:g\fi } +\def\HTa:g{\H:Tag-} +\def\Link{\let\:attr\empty \futurelet\let:val\HRefT:ag} +\def\HRefT:ag{\ifx -\let:val \expandafter\H:RefTag + \else \expandafter\HRefTa:g\fi } +\def\HRefTa:g{\H:RefTag-} +\def\H:RefTag#1{\futurelet\:temp\:HRefTag} +\def\:HRefTag{\ifx [\:temp \expandafter\::HRefTag + \else \expandafter\:::HRefTag \fi } + +\def\HCode#1{} +\def\H:Tag#1#2{} +\def\::HRef[#1]#2{} +\def\:::HRef#1{} +\def\::HRefTag[#1]#2#3{} +\def\:::HRefTag#1#2{} +\def\:TagHTag#1{} + + + \fi +\:CheckOption{html} + \if:Option \else \:CheckOption{xhtml}\fi +\if:Option + \def\WindowTitle#1{\leavevmode\hbox{% + \disable: + \expandafter\ifx\csname \clearcode:id W-#1\endcsname\relax + \let \:temp=\empty +\else + \edef\:temp{ \HREF:"\expandafter\get:href + \csname \clearcode:id W-#1\endcsname -"}% +\fi +\html:addr +\HCode{<\tag:A\:newlnch \NAME:"\expandafter\get:htag\last:haddr -"\:temp + >}\ttl:del{<.}\HCode{</\tag:A>}% +\expandafter\expandafter\expandafter\global\expandafter\let + \csname \clearcode:id W-#1\endcsname=\last:haddr +% + \expandafter\ifx\csname \clearcode:id :cw:#1\endcsname\relax + \expandafter\expandafter\expandafter\global + \expandafter\def\csname \clearcode:id :cw:#1\endcsname{0}% + \Tag{)\clearcode:id Z:#1}{\last:haddr}% +\fi +\frag:href{)\clearcode:id P:#1}{}#1\HCode{</\tag:A>}% +% + \:nextlink{\clearcode:id :cw:#1}{.>}% +% + }} +\def\disable:{\let\rm=\empty \let\tt=\empty + \let\sl=\empty \let\bf=\empty \let\it=\empty } +\def\frag:href#1#2{% + \HCode{<\tag:A\:newlnch \HREF:"% + \expandafter\ifx \csname cw:#1\endcsname \relax + \expandafter\get:href\last:haddr -% + \else + \expandafter\expandafter\expandafter\get:href\csname + cw:#1\endcsname -% + \fi +"#2>}} +\def\html:PortTitle#1{\hbox{% + \disable: + \bgroup \def\:Sp{\space}% + \html:addr + \ifx\:AppendSign\empty + \HCode{<\tag:A\:newlnch \NAME:"\get:htag\last:haddr-">}% + \expandafter\expandafter\expandafter\global\expandafter\edef + \csname \clearcode:id 9:#1\endcsname{0}% + \else + \HCode{<\tag:A\:newlnch \HREF:"\expandafter\get:href + \csname \space\clearcode:id P:#1\endcsname-" + \NAME:"\get:htag\last:haddr-">}% + \fi + \ttl:del{<..}\HCode{</\tag:A>}% + \expandafter\expandafter\expandafter\global\expandafter\let + \csname \space\clearcode:id P:#1\endcsname=\last:haddr +\egroup +% + \bgroup \def\:Sp{\space}% + \ifx\:AppendSign\empty + \Tag{)\clearcode:id P:#1}{\last:haddr}% + \fi + \frag:href{)\clearcode:id Z:#1}{\ifx \:LastCodeLabel\empty \else + \expandafter\html:codeid\:LastCodeLabel</\tag:A>\fi +% +}% +\egroup +#1\HCode{</\tag:A>}% +% + \:nextlink{\clearcode:id 9:#1}{..}% +% + }} +\def\:HRefCode#1\<#2\>{{% + \let\clearcode:id=\clearcode::id + \expandafter\ifx\csname + cw:#1#2\endcsname\relax + \HCode{<\tag:A>}\else + \HCode{<\tag:A\:newlnch \HREF:"}\expandafter\get:href + \csname cw:#1#2\endcsname + -\HCode{">}% + \fi}} +\def\:nextlink#1#2{% + \bgroup \def\:Sp{\space}% + \def\:lbl{)\the\tmp:cnt :#1}% + \tmp:cnt=\csname #1\endcsname\space + \html:addr + \Tag{\:lbl}{\last:haddr}% + \advance\tmp:cnt by 1\space + \expandafter\xdef\csname #1\endcsname{\the\tmp:cnt}% + \expandafter\ifx\csname cw:\:lbl\endcsname\relax + \HCode{<\tag:A\:newlnch + \NAME:"\expandafter\get:htag\last:haddr-">}% + \else + \HCode{<\tag:A\:newlnch + \NAME:"\expandafter\get:htag\last:haddr-"\space + \HREF:"\expandafter\expandafter\expandafter + \get:href\:LikeRef{\:lbl}-">}% + \fi + \ttl:del{#2>}\HCode{</\tag:A>}% + \egroup +} +\def\:LikeRef#1{\csname cw:#1\endcsname} +\let\html:ShowCode=\ShowCode +\def\ShowCode{\par \html:ShowCode} +\let\html:ModifyShowCode=\ModifyShowCode +\def\ModifyShowCode#1{% + \def\%##1\%{\c:protex##1\d:protex}% + \html:ModifyShowCode{#1}% + \let\PortTitle=\html:PortTitle + \let\:FrontTitle=\frnt:ttl + \def\:BackTitle{\b:protex\par}% + \let\:CodeSkip=\empty + \def\:TopTitle##1{{\:FrontTitle{##1}}}% + \def\:BottomTitle{\:BackTitle}% + \let\html:ModifyShowLastCode=\ModifyShowLastCode +\ifx\:ModifyShowLastCode\:UnDeF \def\:CntLines##1{}\else + \def\:CntLines{\:CountLines}\fi +\def\ModifyShowLastCode##1{% + \ifx \:test\:minus + \def\:CodeSkip{{\par\parindent=0pt\leftskip=0pt + \everypar{}\b:protex\par}% + \global\:removeindenttrue}% + \leavevmode\a:protex\par + \else \global\:removeindenttrue \fi + \html:ModifyShowLastCode{##1}% + \everypar{\e:protex \:CntLines {\it \:ShowLineCount \quad}}% +}% +\f:protex +% + } +\def\frnt:ttl#1{{\htmlprotex:par + {\expandafter\ifx \csname ListCounter\endcsname\relax + \else \:removeindentfalse \fi \leavevmode}% + \PortTitle{#1}\:AppendSign}\a:protex + }% +\def\a:protex{% +% \ifvmode \csname IgnorePar\endcsname +% \else \hfil\break\fi +% \csname EndP\endcsname + \HCode{\ifx \:test\:minus \else <br />\fi + \html:src<span class="ShowCode" + style="font-family:monospace;white-space:nowrap;" + >\html:invisible}% + \nobreak % \hskip\leftskip \hskip\parindent +} +\def\b:protex{\HCode{\html:BackTitle\html:src</span>}} +\def\e:protex{\HCode{<br />\html:invisible}} +\def\c:protex{\HCode{<i>}} +\def\d:protex{\HCode{</i>}} +\def\f:protex{\def\:Sp{\HCode{\string&\#x00A0;}}} +\long\def\c:ShowCode:#1#2#3#4#5#6{\def\a:protex{#1}% + \def\b:protex{#2}\def\e:protex{#3}\def\c:protex{#4}% + \def\d:protex{#5}\def\f:protex{\def\:Sp{#6}}} +\def\L:Del{<..} +\def\l:Del{<.} +\def\R:Del{..>} +\def\ttl:del#1{\def\:tempa{#1}% + \ifx \:tempa\L:Del \L:del + \else \ifx \:tempa\l:Del \l:del + \else \ifx \:tempa\R:Del \R:del + \else \r:del \fi\fi\fi} +\def\HShowCode#1#2#3#4#5{% + \def\:temp{#1#2}\ifx \:temp\empty \else + \def\L:del{#1}\def\R:del{#2}\fi + \def\:temp{#3#4}\ifx \:temp\empty \else + \def\l:del{#3}\def\r:del{#4}\fi + \def\:temp{#5}\ifx \:temp\empty \else + \def\html:BackTitle{#5}\fi +} +\bgroup +\catcode`\_=12 +\gdef\:temp{\HShowCode{<..}{..>}{<.}{.>}{-_-_-}} \aftergroup\:temp +\egroup +\let\html:ProTexMssg=\ProTexMssg +\def\ProTexMssg{% + {\let\:gobble=\empty\def\:TagCs{\:FileName}\:WriteTrc{FileName}}% + \html:ProTexMssg } +\catcode`\^^I=13\catcode`\ =13\catcode`\^^M=13% +\def\:ObeyIn{\CodeFont\parindent=0pt% + \parskip=0pt\everypar{}% + \:NoSpecials{12}{0}{255}\catcode`\ =13% + \catcode`\^^M=13\catcode`\^^I=13% + \def^^M{\leavevmode\e:protex\par}\def^^I{ }% + \def {\leavevmode\:Sp}}% +\catcode`\^^M=5\catcode`\ =10\catcode`\^^I=10 +\expandafter\ifx \csname :Sp\endcsname\relax + \expandafter\def\csname :Sp\endcsname{ } +\fi +\def\ShowFile#1{{\:ObeyIn \openin15=#1 + \ifeof15 \:warn{\string\ShowFile{#1}?}\else + \a:ShowFile\input #1 \b:ShowFile \fi \closein15 }} +\def\a:ShowFile{\ifvmode \csname IgnorePar\endcsname\fi + \csname EndP\endcsname + \HCode{<div class="ShowFile" + style="font-family:monospace;white-space:nowrap;" + >\html:src\html:invisible}\hfill\break + \f:protex } +\def\b:ShowFile{\HCode{</div>\html:src}} +\long\def\c:ShowFile:#1#2{\def\a:ShowFile{#1}\def\b:ShowFile{#2}} +\def\html:codeid#1Q#2"#3</\tag:A>{ \NAME: + "Q#2"} +\ifx \aXrefFile\:UnDef \let\aXrefFile=\empty \fi + +\def\CodeId#1#2{\expandafter\ifx + \csname cw:)F\aXrefFile \file:id + \empty F-\endcsname\relax + \else\:LikeRef{)F\aXrefFile \file:id\empty F-}\fi + \:sharp Q\make:addr{#2}"#1% + \ifx \CodeInputLineNo\:UnDef \the\inputlineno \else \CodeInputLineNo\fi} +\let\showttl:WriteTrc=\:WriteTrc +\def\:WriteTrc#1{% + \def\:temp{#1}\def\:tempa{ShowCode}\ifx\:temp\:tempa + \def\:TagCs{\expandafter\trc:shw\:LastCodeLabel\trc:shw}% + \else \ifx \id:WriteTrc\:Undef + \def\:tempa{ShowTitle}\ifx\:temp\:tempa + \expandafter\def\expandafter\:TagCs\expandafter + {\:TagCs.\the\:CodeNumber}% + \fi \fi \fi + \showttl:WriteTrc{#1}} +\def\trc:shw#1"#2\trc:shw{#2 "#1"} +\ifx \footline\:UnDef \else + \footline={\hfil} \headline={\hfil} +\fi +\def\HREF:{ href=} +\def\tag:A{a} +\def\NAME:{ name=} +\def\make:addr#1{% + \ifnum\clearcode:id>0 \romannumeral\clearcode:id Q\else PrTx\fi + #1} +\ifx\clearcode:id\:UnDef + \def\clearcode::id{0} \def\clearcode:id{0} +\fi +\ifx \html:par\:UnDef \def\html:par{\HCode{<p>}} \fi +\def\html:invisible{<!--x-->\string&\#x00A0;} +\expandafter\ifx\csname htmlprotex:par\endcsname\relax + \ifx\:removeindenttrue\:UnDef + \def\:removeindenttrue{\let\:Undef=\:Undef} + \fi + \def\htmlprotex:par{{\everypar{}\csname + HtmlPar\endcsname}\HCode{\html:src}} +\fi +\ifx\html:addr\:UnDeF + \immediate\write16{--- needs --- tex4ht \jobname\space ---}% +\ifx\tmp:cnt\:UnDeF \csname newcount\endcsname\tmp:cnt \fi +\def\g:advance#1{\bgroup \def\:temp{#1}% + \tmp:cnt=#1\afterassignment\:gplus \advance\tmp:cnt} +\def\:gplus{\expandafter\xdef\:temp{\the\tmp:cnt}\egroup} +\def\html:lbl{1} +\def\html:addr{\xdef\last:haddr{\file:id-\html:lbl}% + \g:advance\html:lbl by 1\relax } +\ifx \file:id\:UnDef + \gdef\file:id{1} + \global\let\maxfile:id=\file:id +\fi +\hbadness=10000 \vbadness=10000 +\:CheckOption{fussy} \if:Option \else + \hfuzz=99in \vfuzz=\hfuzz +\fi +\hyphenpenalty=1000 \exhyphenpenalty=1000 +\def\html:rightskip{\rightskip = 0pt plus 0.5\hsize minus0.5\hsize } +\html:rightskip +\ifx \ht:special\:UnDef + \let\ht:special=\special +\fi +\def\HCode#1{\ifx \EndPicture\:UnDef + \relax\ifvmode\leavevmode\fi\ht:special{t4ht=#1}\fi} +\let\:HCode=\HCode +\let\Hbrakets\empty +\def\NewLineChar{\bgroup \catcode`\^=7 \:NewLineChar} +\def\:NewLineChar#1{\egroup \def\:newlnch{ #1}} +\NewLineChar{^^J} +\def\::HRef[#1]{\get:attr{#1}\::hRef\:::HRef} +\def\::HRefTag[#1]{\get:attr{#1}\::hRefTag\:::HRefTag} +\def\get:attr#1{\edef\:attr{\noexpand\get:atr #1 !*?: }\:attr} +\def\get:atr#1 #2!*?: #3#4{\def\:attr{\space#2}% + \def\:te:mpa{#1}\ifx \:te:mpa\empty \let\:te:mpa#4\else + \def\:te:mpa{#3[#1]}\fi \:te:mpa} +\def\H:Tag#1#2{\:TagHTag{#2}\HCode{\Hbrakets<\tag:A\:newlnch + \NAME:"#2"\empty:lnk>}} +\def\::hRef[#1]#2{% + \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1#2\relax \NOHREF:{}\else + \HREF:"#1\if\relax#1\relax \else\:sharp #2\fi"\fi + \:attr \empty:lnk>}} +\def\:::HRef#1{% + \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1\relax \NOHREF:{}\else + \HREF:"\get:hfile{#1}\:sharp #1"\fi \:attr \empty:lnk>}} +\def\::hRefTag[#1]#2#3{% + \if\relax#3\relax\else\:TagHTag{#3}\fi + \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1#2\relax \NOHREF:{#3}\else + \HREF:"#1\if\relax#2\relax \else\:sharp #2\fi"\fi + \if\relax#3\relax\else\space \NAME:"#3"\fi + \:attr \empty:lnk>}} +\def\:::HRefTag#1#2{% + \if\relax#2\relax\else\:TagHTag{#2}\fi + \HCode{\Hbrakets<\tag:A\:newlnch \if\relax#1\relax \NOHREF:{#2}% + \else\HREF:"\get:hfile{#1}\:sharp #1"\fi + \if\relax#2\relax\else\space \NAME:"#2"\fi + \:attr \empty:lnk>}} +\let\empty:lnk=\empty +\def\NOHREF#1{\space} +\def\:TagHTag#1{\ifx -\let:val\else \Tag{)Q\aXrefFile #1}{\file:id}\fi} +\def\get:href{\expandafter\get::href} +\def\get::href#1-#2-{\ifnum #1=\file:id\space \else + \:LikeRef{)F\aXrefFile #1\empty F-}\fi + \:sharp \make:addr{#2}} +\def\get:htag{\expandafter\get::htag} +\def\get::htag#1-#2-{\make:addr{#2}} +\ifx \aXrefFile\:UnDef \let\aXrefFile=\empty \fi + +\def\get:hfile#1{% + \expandafter\ifx\csname + cw:)Q\aXrefFile #1\endcsname\relax + \get@hfile{#1}% + \else + \expandafter\expandafter\expandafter\get::hfile + \csname cw:)Q\aXrefFile #1\endcsname,//% + \fi } +\def\get::hfile#1,#2//{% + \ifnum \file:id=0#1 \else + \expandafter\ifx + \csname cw:)F\aXrefFile #1% + \empty F-\endcsname\relax \else + \:LikeRef{)F\aXrefFile #1\empty F-}% +\fi % + \fi } +\ifx\get@hfile\:Undef \let\get@hfile=\:gobble \fi + \let\html:src=\empty +\catcode`\#=12 \def\:sharp{#} \catcode`\#=6 + + \Htmltrue +\fi + + +\fi\:CheckOption{_^} \if:Option +\def\du:cc{\catcode`\_=13 \catcode`\^=13 \let\du:cc=\:UnDef} +\let\:sub=_ \let\:sup=^ +\catcode`\_=13 \catcode`\^=13 +\def_{\ifmmode \:sub \else \string_\fi} +\def^{\ifmmode \:sup \else \string^\fi} +\:CheckOption{html} + \if:Option \else \:CheckOption{xhtml}\fi +\if:Option + \append:def\SUBOn{\def_{\ifmmode \:sub \else \string_\fi}} + \append:def\SUPOn{\def^{\ifmmode \:sup \else \string^\fi}} +\fi + + \fi\:CheckOption{pdf} +\if:Option + \ifx \hyper:link\:UnDef \let\:temp=\hyper:target +\else \let\:temp=\:UnDef \fi + \ifx \:temp\:UnDef +\def\hyper:link{\hyperlink} +\def\hyper:target{\hypertarget} +\def\:temp{\ifx\pdfstartlink\:UnDef + \let\pdfstartlink\pdfannotlink + \fi + \ifx \pdfstartlink\:UnDef + \long\def\hyper:target##1##2{\special + {html:<a name="##1">}\special{html:</a>}}% + \long\def\hyper:link##1##2{\special + {html:<a href="##1">}##2\special{html:</a>}}% + \else + \long\def\hyper:target##1##2{\pdfdest name {##1} xyz}% + \long\def\hyper:link##1##2{% + \leavevmode \pdfstartlink goto name {##1}##2\pdfendlink } % + \fi +} +\ifx \hyperlink\:UnDef \:temp +\else \ifx \hypertarget\:UnDef \:temp \fi \fi + \fi +\let\hyper::WindowTitle=\WindowTitle +\def\WindowTitle#1{\bgroup + \def\WindowTitle##1{##1}% + \xdef\:temp{\noexpand\H:WindowTitle{#1}}\egroup \:temp} + +\def\H:WindowTitle#1{\leavevmode\hbox{% + \expandafter\ifx\csname \clearcode:id W-#1\endcsname\relax + \ttl:del{<.}% + \else + \hyper:link{\expandafter\get:href + \csname \clearcode:id W-#1\endcsname -}{\ttl:del{<.}}% + \fi + \html:addr + \hyper:target{\expandafter\get:htag\last:haddr -}{}% + \expandafter\expandafter\expandafter\global\expandafter\let + \csname \clearcode:id W-#1\endcsname=\last:haddr + \expandafter\ifx\csname \clearcode:id :cw:#1\endcsname\relax + \expandafter\expandafter\expandafter\global + \expandafter\def\csname \clearcode:id :cw:#1\endcsname{0}% + \Tag{)\clearcode:id Z:#1}{\last:haddr}% + \fi + \def\:temp##1{\leavevmode \hbox{$\triangleleft + \triangleleft$}~##1~\hbox{$\triangleright \triangleright$}}% + \ifx \:temp \hyper::WindowTitle \def\hyper::WindowTitle##1{~##1~}\fi + \hyper::WindowTitle{\frag:href{)\clearcode:id P:#1}{#1}}% + \:nextlink{\clearcode:id :cw:#1}{.>}% + }} +\let\hyper::ModifyShowCode=\ModifyShowCode +\def\ModifyShowCode#1{% + \hyper::ModifyShowCode{#1}% + \let\H:PortTitle=\PortTitle + \let\PortTitle=\hyper::PortTitle + } +\let\hyper::PortTitle=\PortTitle +\def\hyper::PortTitle#1{\hbox{% + \def\:Sp{ }% + \bgroup + \html:addr + \hyper:target{\get:htag\last:haddr-}{}% + \ifx\:AppendSign\empty + \expandafter\expandafter\expandafter\global\expandafter\edef + \csname \clearcode:id 9:#1\endcsname{0}% + \ttl:del{<..}% + \else + \hyper:link{\expandafter\get:href + \csname \space\clearcode:id P:#1\endcsname-}{\ttl:del{<..}}% + \fi + \expandafter\expandafter\expandafter\global\expandafter\let + \csname \space\clearcode:id P:#1\endcsname=\last:haddr + \egroup + \bgroup + \ifx\:AppendSign\empty + \Tag{)\clearcode:id P:#1}{\last:haddr}% + \fi + \def\:temp##1{\leavevmode \hbox{$\triangleright + \triangleright$}~##1~\hbox{$\triangleleft \triangleleft$}}% + \ifx \:temp\H:PortTitle \def\H:PortTitle##1{~##1~}\fi + \H:PortTitle{\frag:href{)\clearcode:id Z:#1}{#1}}% + \egroup + \:nextlink{\clearcode:id 9:#1}{..>}% +}} +\def\frag:href#1#2{% + \hyper:link{% + \expandafter\ifx \csname cw:#1\endcsname \relax + \expandafter\get:href\last:haddr -% + \else + \expandafter\expandafter\expandafter + \get:href\csname cw:#1\endcsname -% + \fi}{#2}} +\def\:nextlink#1#2{% + \bgroup \def\:Sp{\space}% + \def\:lbl{)\the\tmp:cnt :#1}% + \tmp:cnt=\csname #1\endcsname\space + \Tag{\:lbl}{\last:haddr}% + \advance\tmp:cnt by 1\space + \expandafter\xdef\csname #1\endcsname{\the\tmp:cnt}% + \expandafter\ifx\csname cw:\:lbl\endcsname\relax + \ttl:del{#2}% + \else + \hyper:link{\expandafter\expandafter\expandafter + \get:href\:LikeRef{\:lbl}-}{\ttl:del{#2}}% + \fi + \egroup +} +\let\:sharp=\empty \def\clearcode::id{0} \def\clearcode:id{0} +\def\file:id{1} +\def\get:href{\expandafter\get::href} +\def\get::href#1-#2-{\ifnum #1=\file:id\space \else + \:LikeRef{)F\aXrefFile#1\empty F-}\fi + \:sharp \make:addr{#2}} +\def\get:htag{\expandafter\get::htag} +\def\get::htag#1-#2-{\make:addr{#2}} +\def\get:hfile#1{% + \expandafter\ifx\csname + cw:)Q\aXrefFile#1\endcsname\relax + \get@hfile{#1}% + \else + \expandafter\expandafter\expandafter\get::hfile + \csname cw:)Q\aXrefFile#1\endcsname,//% + \fi } +\ifx \aXrefFile\:UnDef \let\aXrefFile=\empty \fi +\def\get::hfile#1,#2//{% + \ifnum \file:id=0#1 \else + \expandafter\ifx + \csname cw:)F\aXrefFile#1% + \empty F-\endcsname\relax \else + \:LikeRef{)F\aXrefFile#1\empty F-}% +\fi % + \fi } +\ifx\get@hfile\:Undef \let\get@hfile=\:gobble \fi +\def\L:Del{<..} +\def\l:Del{<.} +\def\R:Del{..>} +\def\ttl:del#1{\def\:tempa{#1}% + \ifx \:tempa\L:Del \L:del + \else \ifx \:tempa\l:Del \l:del + \else \ifx \:tempa\R:Del \R:del + \else \r:del \fi\fi\fi} +\def\HShowCode#1#2#3#4#5{% + \def\:temp{#1#2}\ifx \:temp\empty \else + \def\L:del{#1}\def\R:del{#2}\fi + \def\:temp{#3#4}\ifx \:temp\empty \else + \def\l:del{#3}\def\r:del{#4}\fi + \def\:temp{#5}\ifx \:temp\empty \else + \def\html:BackTitle{#5}\fi +} +\HShowCode{$\triangleleft\triangleleft$} + {$\triangleright\triangleright$} + {$\triangleright\triangleright$} + {$\triangleleft\triangleleft$} {} +\ifx\tmp:cnt\:UnDeF \csname newcount\endcsname\tmp:cnt \fi +\def\g:advance#1{\bgroup \def\:temp{#1}% + \tmp:cnt=#1\afterassignment\:gplus \advance\tmp:cnt} +\def\:gplus{\expandafter\xdef\:temp{\the\tmp:cnt}\egroup} +\def\html:lbl{1} +\def\html:addr{\xdef\last:haddr{\file:id-\html:lbl}% + \g:advance\html:lbl by 1\relax } +\def\make:addr#1{% + \ifnum\clearcode:id>0 \romannumeral\clearcode:id Q\else PrTx\fi + #1} + +\def\:LikeRef#1{\csname cw:#1\endcsname} + +\fi \def\AlProTex{\:warn{AlProTex already loaded}} +\let\:InitAlProTex=\:undefined +\let\:CheckOption=\:undefined +\let\:GetOptions=\:undefined + +\def\:temp{ \let\:temp=\:undefined + \csname :notex\endcsname \csname :getpseducodeII\endcsname + \endinput} +\:RestoreCatcodes +\csname :temp\endcsname diff --git a/web/protex/ChangeLog b/web/protex/ChangeLog new file mode 100644 index 0000000000..d153e165e1 --- /dev/null +++ b/web/protex/ChangeLog @@ -0,0 +1,17 @@ +2016-07-04 Karl Berry <karl@freefriends.org> + + * README: tweak text, upload 2016-07-04 release to CTAN + (ctan.org/pkg/protex). + +2016-06-06 Karl Berry <karl@freefriends.org> + + * ProTex.sty, + * AlProTex.sty: update copyright notices. + +2016-06-05 Deimantas Galcius <deimi@vtex.lt> + + * ProTex.sty (ExpandDefSrcLineNo): new macro, with friends. + * AlProTex.sty (CodeLineNo): new option. + https://puszcza.gnu.org.ua/bugs/?136 + +This file is public domain. Started 2016, Karl Berry. diff --git a/web/protex/ProTex.sty b/web/protex/ProTex.sty new file mode 100644 index 0000000000..3908b100b6 --- /dev/null +++ b/web/protex/ProTex.sty @@ -0,0 +1,348 @@ +% $Id: ProTex.sty 185 2016-07-04 18:14:23Z karl $ +% Copyright 2016 TeX Users Group +% Copyright 1990-1999 Eitan M. Gurari +% +% This program can 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 (at your option) any later version. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work +% is the TeX4ht Project <http://tug.org/tex4ht>. +% +% If you modify this program, changing the +% version identification would be appreciated. +\immediate\write-1{version 2016-07-04} + +\expandafter\edef\csname :RestoreCatcodes\endcsname{% + \catcode`\noexpand :=\the\catcode`:% + \catcode`\noexpand @=\the\catcode`@% + \catcode`\noexpand -=\the\catcode`-% + \catcode`\noexpand +=\the\catcode`+% + \catcode`\noexpand ^=\the\catcode`^% + \let\expandafter\noexpand\csname:RestoreCatcodes\endcsname= + \noexpand\undefined} +\catcode`\:=11 \catcode`\@=11 \catcode`\^=7 +\def\:latexpg{\ifx\pageno\:undefined + \let\pageno=\c@page \fi} +\:latexpg +\def\:minus{-} \catcode`\-=13 \catcode`\+=13 +\def\Code#1#2{% + {\:TraceDef#1{#2}}% + \ifx #1\:undefined \else \def#1{}% + \:warn{\string\Code\space redefines \string#1}\fi +\ifx #1\:undefined \ModifyCode{#1}\fi + \gdef#1{-{#2}{\string#1}}\AppendCode#1}\def\ModifyCode#1{} + +\def\:warn#1{\immediate \write16{l.\the\inputlineno + \space\:minus\string- Warning \:minus\string- #1}} +\def\:CheckCommand#1#2{% + \def-##1##2{\let\:undefined=\relax}% + \def+##1##2{}% + #2\relax + \ifx \:undefined\relax \else + \errmessage{\string#1\string#2 without + \string\Code\string#2}\fi} +\def\AppendCode#1{% + \begingroup + \:CheckCommand\AppendCode#1% + \:defaultcats + \def\:ScanAppend##1{\endgroup + \:ifempty{##1}\else + \global\advance\:CodeNumber by 1 + {\def\:TagCs{\string#1.\the\:CodeNumber}% + \:WriteTrc{DefineCode}}% + \:ExpandDef#1{+{##1}}{\noexpand + {\CodeId{\string#1}{\the\:CodeNumber}\noexpand}}% + \AfterCode{#1}% +\fi}% + \ModifyAppendCode{#1}\relax + \:ScanAppend}\def\ModifyAppendCode#1{} \def\AfterCode#1{} + +\def\:ifempty#1{\def\:parm{#1}% + \ifx \:parm\empty}\def\CodeId#1#2{#1.#2} \newcount\:CodeNumber +\newtoks\:tokens +\def\:ExpandDef#1#2#3{% + \:tokens=\expandafter{#1#2}% + \xdef#1{\the\:tokens #3}} + +\def\:defaultcats{% + \:NoSpecials{12}{0}{255}% + \:NoSpecials{11}{65}{90}% + \:NoSpecials{11}{97}{122}% + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 + \catcode`\ =13 \catcode`\^^M=13 \catcode`\^^I=13 } + +\newtoks\:tokensi +\newtoks\:tokensii +\def\:ExpandDefSrcLineNo#1#2#3{% + \:tokens=\expandafter{#1}% + \:tokensii={#2}% + \edef\@a@{\noexpand\:tokensi={\CodeInputLine}}\@a@ + \xdef#1{\the\:tokens\the\:tokensi\the\:tokensii #3}} +\def\:srclinebol{\%} +\def\srclineBOL#1{\gdef\:srclinebol{#1}} +\def\CodeInputLine{% + ^^J\:srclinebol line \CodeInputLineNo\space "./\jobname.tex"^^J}% +\def\SetOutputWithLineNo{\let\:ExpandDef\:ExpandDefSrcLineNo} +\let\CodeLineNo\SetOutputWithLineNo + +\def\:NoSpecials#1#2#3{\edef\:temp{\the\:CodeNumber}% + \global\:CodeNumber=#3 + \def\:next{\catcode\:CodeNumber=#1 + \ifnum \:CodeNumber=#2 \let\:next=\relax \fi + \global\advance\:CodeNumber by \:minus1 \:next}\:next + \global\:CodeNumber=\:temp } +\def-#1#2{{\CodeFont \WindowTitle{#1}}} +\def+#1#2{} +\def\WindowTitle#1{\leavevmode \hbox{$\triangleleft + \triangleleft$}~#1~\hbox{$\triangleright + \triangleright$}} +\let\CodeFont=\tt +\def\ShowCode#1{% + \def\:test{#1}% + \ifx \:test\:minus \expandafter\:ShowCode \else + \:ShowCode#1\fi}\def\:ShowCode#1{% + \begingroup \:ShowCommands + \:SpTbLn +\def\\{\char 92 }% +\def\{{\char 123 }% +\def\}{\char 125 }% +\ifvmode + \def\:Sp{\leavevmode\phantom{x}}% + \def\:Tb{\:Sp\:Sp}% + \def\:Ln{\leavevmode\par}% +\else + \def\:Sp{ }% + \def\:Tb{ \ignorespaces}% + \def\:Ln{\:Tb}% +\fi + \ifvmode \everypar={}% + \:CodeSkip + \parskip=0em \parindent=\:minus3em + \advance \leftskip by 6em + % + \def\:TopTitle##1{{\:TitleShift + \noindent \hfil \:FrontTitle{##1}\par + \nobreak \smallskip}}% + \def\:BottomTitle{{\par \nobreak \:TitleShift + \noindent \hfil \:BackTitle\par}}% +\else + \def\:TopTitle##1{\:FrontTitle{##1} }% + \def\:BottomTitle{ \:BackTitle}% + \def\:CodeSkip{}% +\fi +\def\:FrontTitle##1{\PortTitle{##1}\:AppendSign}% +\def\:BackTitle{\hbox{$\diamond\diamond\diamond$}}% +% +\def\PortTitle##1{\leavevmode \hbox{$\triangleright + \triangleright$}~##1~\hbox{$\triangleleft + \triangleleft$}}% +\def-##1##2{}% +\def+##1##2{\let+=\:next}% +\def\:next##1##2{\def\:AppendSign{\char43 }}% +\def\:AppendSign{}% +#1\relax + \def-##1##2{}% +\def+##1##2{\def\:LastCodeLabel{##2}}% +\def\:LastCodeLabel{}% +#1\relax +\ifx\:LastCodeLabel\empty\else + {\def\:TagCs{\:LastCodeLabel}\:WriteTrc{ShowCode}}% +\fi + \CodeFont + \:CheckCommand{\ShowCode}{#1}% + \ModifyShowCode{#1}\relax + \ifx \:test\:minus \else + \def-##1##2{\:TopTitle{##1}}% + \def+##1##2{}% + \ModifyFrontTitle{#1}\relax + #1\relax +\fi + \def-##1##2{}% +\def+##1##2{\def\:LastCode{##1}}% +\def\:LastCode{}% +\ModifyLastCode{#1}\relax +#1\relax\def-##1##2{{\def\:TagCs{##2}\:WriteTrc{ShowTitle}}% + \WindowTitle{##1}}% +\def+##1##2{}% +\ModifyShowLastCode{#1}\relax +\:LastCode + \ifx \:test\:minus \else + \:BottomTitle +\fi +\:CodeSkip + \endgroup} + +\def\ModifyShowCode#1{} +\def\:CodeSkip{\ifdim \CodeSkipAmount>0pt + \vskip\:minus\lastskip \fi + \vskip\CodeSkipAmount} +\def\CodeSkipAmount{\medskipamount} +\def\ShiftTitle#1{% + \def\:TitleShift{\advance \leftskip by #1}} +\ShiftTitle{\:minus6em} +\def\ModifyFrontTitle#1{}\def\ModifyLastCode#1{} +\def\ModifyShowLastCode#1{}\begingroup + \catcode`\.=10 \catcode`\^^I=13 \catcode`\^^M=13% + \catcode`\ =13% +...\gdef\:SpTbLn{% +......\def {\:Sp}\def^^M{\:Ln}\def^^I{\:Tb}}% +\endgroup\begingroup + \catcode`\{=12 \catcode`\}=12 + \catcode`\[=1 \catcode`\]=2 + \gdef\:lbrc[{] \gdef\:rbrc[}] + \catcode`\,=0 \catcode`\\=12 + ,gdef,:backslash[\] +,endgroup +\catcode`\%=12 \catcode`\@=14 +\def\:ShowCommands{@ \tempor + \ifvmode + \linepenalty=100 + \def\NL%{$\rightarrow\rightarrow$\hfill\break}@ + \def\%##1\%{{\CommentFont + \def\:Tb{ \ignorespaces}@ + \def\:Sp{ }@ + \def\:Ln{\hfill\break}@ + ##1}}@ + \else + \def\NL%{}@ + \def\%##1\%{{\CommentFont ##1}}@ + \fi} +\def\CommentFont{\it} +\def\:OutCommands{\def\NL%{}\def\%##1\%{}} +\catcode`\%=14 \catcode`\@=11 \def\:OutputCode#1{% + \begingroup \:OutCommands + \:CheckCommand{\OutputCode}{#1}% + \:latexpg + {\def\:TagCs{\string#1}\:WriteTrc{OutputCode}}% + \def\Tag##1##2{}\def\Ref##1{}% + \:SpTbLn +\def\:Sp{ }% +\def\:Tb{\:Sp\:Sp}% +\newlinechar`\^^J \def\:Ln{^^J}% +\def\\{\:backslash}% +\def\{{\:lbrc}% +\def\}{\:rbrc}% + \def\Extension{prg}% + \def\:WriteCode{\immediate\write15{#1}}% + % rules for expanding the code macros + \def-##1##2{}% + \def+##1##2{\:comment{##2\ifx \CodeId\:gobbleii\else...\fi}##1% + \:comment{\ifx \CodeId\:gobbleii\else...\fi##2}}% + % name for the auxiliary code file + \def\:gobble##1{}% + \def\:FileName{\expandafter + \:gobble\string#1.\Extension}% + % writing the file + \ModifyOutputCode{#1}\relax + \immediate\openout15=\:FileName \:WriteCode + \immediate\closeout15 + % notifying the user + \ProTexMssg{\string-\string-\string- + Writing file \string-\string-\string- + \:FileName\space\string-\string-\string-}% + \endgroup } +\def\:gobbleii#1#2{} +\def\ProTexMssg{\immediate\write16} + +\def\:ParOutputCode#1]#2{{% + \let\:ModifyOutputCode=\ModifyOutputCode + \def\ModifyOutputCode##1{\:ModifyOutputCode{##1}% + \def\Extension{#1}}% + \:OutputCode #2}} + +\def\OutputCode#1{% + \ifx#1[\let\:next=\:ParOutputCode + \else \def\:next{\:OutputCode#1}\fi \:next} + +\def\ModifyOutputCode#1{}\def\:comment#1{} +\def\Comment{\begingroup + \:defaultcats + \::comment} + +\def\::comment#1#2{\endgroup + \def\:flag{}% + \:ifempty{#1}\else \def\:flag{.}\fi + \:ifempty{#2}\else \def\:flag{.}\fi + \ifx \:flag\empty \def\:comment##1{}% +\else \def\:comment##1{#1##1#2}\fi} +\def\Ref#1{% + \:ifempty{#1}\:warn{Empty field in \noexpand\Ref}% + \else + \expandafter\ifx \csname cw:#1\endcsname \relax + \:NoTag{#1}% + \else \expandafter\csname cw:#1\endcsname \fi + \fi} +\def\Tag#1#2{% + \:ifempty{#1}\:warn{First field + empty in \noexpand\Tag}% + \else + \begingroup + \:latexpg + \edef\:head{\:TagCs\space{#1}{#2}}% + \def\:write{\write\:refout}% + \expandafter \expandafter + \expandafter\:write + \expandafter{\:head{\the\pageno}}% + \endgroup + \fi} + +\let\:trc=\Tag +\def\:TagCs{\string\:CrossWord} \catcode`\-=12 \catcode`\+=12 +\ifx \:refout\:UnDef + \openin15 \jobname.xref + \ifeof15 \immediate\write16{No file \jobname.xref} + \def\:NoTag#1{\hbox{$???$}} + \else + \begingroup + \def\:CrossWord#1#2#3{% + \def\:parm{#2}% + \ifx \:parm\empty \:AddTag{#1}{#3}\else + \:AddTag{#1}{#2}\fi} + +\def\:AddTag#1#2{% + \expandafter \ifx \csname cw:#1\endcsname \relax + \def \:entries{#2}% + \else \edef\:entries{\csname cw:#1\endcsname , #2}% + \fi + \expandafter \xdef \csname cw:#1\endcsname{\:entries}} + \input \jobname.xref + \endgroup + \def\:NoTag#1{\hbox{$???$}% + \:warn{\string\Ref\string{\string#1\string}?}} + \fi + \closein15 +\fi + \catcode`\-=13 \catcode`\+=13 +\ifx \:refout\:UnDef + \csname newwrite\endcsname\:refout + \openout\:refout=\jobname.xref +\fi +\newwrite\:trcfile +\immediate\openout\:trcfile=\jobname.trc + +\def\:WriteTrc#1{{\let\:refout=\:trcfile + \:trc{\string#1}{\the\inputlineno}}} +\def\:TraceDef#1#2{\:tokens={#2}% + \immediate\write\:trcfile{% + \string#1\space{DefineTitle}{{\the + \:tokens};;\the\inputlineno}{}}} +\def\:AlProTex{\ifx \:next[ + \def\AlProTex[##1]##2{\egroup \def\AlProTex{##2}\input ##1 } + \else + \def\AlProTex##1{\egroup \def\AlProTex{##1}\input AlProTex.sty } + \fi \let\:AlProTex=\:undefined \AlProTex} +\def\AlProTex{\bgroup \catcode`\@=12 \catcode`\^=7 \catcode`\_=8 + \futurelet\:next\:AlProTex} +\ifx \inputlineno\undefined + \csname newcount\endcsname\inputlineno + \let\:oldNoSpecials=\:NoSpecials + \def\:NoSpecials#1#2#3{\ifnum #3>127 + \:oldNoSpecials{#1}{#2}{127}\else + \:oldNoSpecials{#1}{#2}{#3}\fi } +\fi +\:RestoreCatcodes \endinput diff --git a/web/protex/README b/web/protex/README new file mode 100644 index 0000000000..bcbfaa67a0 --- /dev/null +++ b/web/protex/README @@ -0,0 +1,613 @@ + \ifx\documentstyle\UnDef\else\documentstyle{report}\begin{document}\fi + \input ProTex.sty \def\CodeDel{{<<<-}{->>>}} + \AlProTex{tex,<<<>>>,|,title,ClearCode} \<\><<<- + +ProTex is Eitan Gurari's literate programming environment for TeX. +His monumental tex4ht package (http://ctan.org/pkg/tex4ht) uses it. + +FILES +===== +ProTex.sty -- Basic environment for literate programming +AlProTex.sty -- Adjustments to ProTeX +README -- Introduction and examples for main features + of (Al)ProTeX (this file) + +MANUAL +====== +Eitan Gurari, TeX and LaTeX: Drawing and Literate Programming. + McGraw-Hill, 1994. ISBN 0-07-025208-4 / 0-07-911616-7 +The dratex package described there is at http://ctan.org/pkg/dratex. +Various ProTex examples are in that package's file Examples.tex. + +Table of Contents +================= +A. A Basic Literate Programming Environment +B. Other Basic Literate Programming Environments +C. Environments for Multi-Module Programs +D. Code and Documentation Produced from Same Specification +E. Examples B, C, D +F. License + + The code for the examples can be extracted from this file + by renaming this file to LitProg.tex and compiling the + file with TeX or LaTeX (the Makefiles for Example C, however, + must be extracted mannually). The compilation puts the code + in files progA.tex, progB.tex, progC.tex, main.tex, + aux.tex, macros.tex, progC.sty, and progD.tex. + +A. A Basic Literate Programming Environment +=========================================== + + \input ProTex.sty + \AlProTex{EXT,<<<>>>,title,list,[],`} + +This environment adds to (La)TeX the following commands for handling code. + +a. Definitions of code fragments \<code title\><<< + code fragment>>> + +b. References to code segments `<code title`> + +c. Output files of code \OutputCode[EXTENSION]\<code title\> + `[EXTENSION]' is optional + when EXTENSION = EXT + +d. References to the character ` + within code fragments `` + +Warning: Do not use 2 or more consecutive blank characters + in `<code title`> + +------- Example A: Single-Module C Program ---------------------------------- +------- Put in file progA.tex and compile with LaTeX ------%->>>\<progA\><<<- + +\documentstyle{book} + +\input ProTex.sty +\AlProTex{c,<<<>>>,title,list,[],`} + +\begin{document} + +\<body\><<< +printf("\n ``hello everybody``"); +>>> + +\<prog A\><<< +`<include`> +main() +{ + `<body`> +} +>>> + +\<include\><<< +#include <stdio.h> +>>> + +\<body\><<< +printf("\n"); +>>> + +\OutputCode\<prog A\> \end{document} + +------------ End Example A -----------------%->>>\OutputCode\<progA\>\<\><<<- + + +B. Other Basic Literate Programming Environments +================================================ + +a. Framing of code fragments can be requested with the option [[]] + in \AlProTex, e.g., + + \AlProTex{EXT,<<<>>>,title,list,[],`,[[]]} + +b. Framing of code titles can be avoided by removing the option [] + from \AlProTex, e.g, + + \AlProTex{EXT,<<<>>>,title,list,`} + +c. The characters @, |, and ? can also act as escape characters within + code fragments (e.g., replace all appearances of ` with @ in Example A). + +d. Line breaks within listing of code can be obtained with the command `NL% + +e. Comments within listing of code can be obtained with commands of + the form `%...`% + +f. The choice of code-delimiters <<< and >>> can be changed by placing + a command of the form \def\CodeDel{{open delimiter}{close delimiter}} + before \AlProTex. + +g. The following command requests that future \OutputCode commands identify + the titles of the different code fragments. (Other information, like + page numbers in documents and line numbers in source files, can also + be incorporated.) + + \Comment{open-comment delimiter}{close-comment delimiter} + +PLEASE EXAMINE AND RUN EXAMPLE B + + +C. Environments for Multi-Module Programs +========================================= + +Multi-module programs can be divided into independent (La)TeX files +that can be compiled either separately or together. For instance, +in Example C + +1. Three modules (main, aux, and macros) are defined independently + (in main.tex, aux.tex, macros.tex) and are connected through a + joint root file (progC.tex). The different files import a + common style file (progC.sty). + + progC.tex Root file + main.tex LaTeX file for first module + aux.tex LaTeX file for second Module + macros.tex LaTeX file for third module + progC.sty Style file (imported by each of the above files) + make files Unix management programs + +2. The files can be compiled separately (latex main.tex, latex aux.main, + latex macros.tex) or jointly (latex progC.tex). + +3. To allow quick generation, compilation, and linkage of C-code files + (see, e.g., the make files), joint compilations do not revise code + files. + +4. Separate compilations use chapter/section/subsection/subsubsection/page + numbers that are collected in joint compilations. + +5. In joint compilations, each module ends with an index to its code titles. + +6. To allow nonrelated identical titles in different modules, and to + save on memory, previous definitions of code fragments are deleted at + the start of each module. + +PLEASE RUN AND EXAMINE EXAMPLE C + +D. Code and Documentation Produced from Same Specification +========================================================== + +Example D demonstrates how math formulas and their code can be generated +from joint specifications. + +PLEASE EXAMINE AND RUN EXAMPLE D + + + +E. Examples B, C, D +=================== + +------- Example B: Variant of Example A ------------------------------------- +------- Put in file progB.tex and compile with LaTeX ------%->>>\<progB\><<<- + +\documentstyle{book} + + \input ProTex.sty +\def\CodeDel{{}{////}} +\Comment{ +/*}{*/ +} + \AlProTex{c,<<<>>>,title,list,[],`} + +\begin{document} + +\<body\> +printf("\n ``hello everybody`` within a long`NL% line of text"); +//// + +\<prog B\> +`<include`> +main() +{ + `<body`> `%a comment`% +} +//// + +\<include\> +#include <stdio.h> +//// + +\<body\> +printf("\n"); +//// + +\OutputCode\<prog B\> \end{document} +------------ End Example B -----------------%->>>\OutputCode\<progB\>\<\><<<- + + + +------------ Example C: Multi-Module C Program ------------------------------ +............ File progC.tex ...............................%->>>\<progC\><<<- + +\def\Root{} +\input progC.sty + +\INPUT{main} % import first module + +\INPUT{aux} % import second module + +\INPUT{macros} % import third module + +\end{document} +............ End file progC.tex .............%->>>\OutputCode\<progC\>\<\><<<- + +............ File main.tex ..................................%->>>\<main\><<<- +\input progC.sty + +\<include files\><<< +#include "aux.h" +#include "macros.h" +#include <stdio.h> +>>> + +\chapter{Outline} + +All the code in this module is included in file main.c. + +\section{The Main Program} + +This program does not handle the case in which the input consists just +of one 0. + +\<main.c\><<< +int main() +{ + `<main's vars`> + `<read input values, count them, and record their sum`> + `<compute and output the average of the input values`> + exit(0); +} +>>> + +\chapter{The Actual Actions} + +\section{Process the Input Values} + +The input must end with 0. + +\<read input values, count them, and record their sum\><<< +initialize_sum_count(); +WHILE TRUE DO + printf("\n Value (0 to stop)? "); + scanf("%d", &value); + IF value == 0 THEN break; FI + add_value(value); +END +>>> + +\<main's vars\><<< +int value; +>>> + +\section{Find the Result and Print It Out} + +\<compute and output the average of the input values\><<< +result = get_average(); +printf("\n Average = %f\n", result); +>>> + +\<main's vars\><<< +double result; +>>> + +\BYE{ \OutputCodE\<main.c\> } +............ End file main.tex ..............%->>>\OutputCode\<main\>\<\><<<- + +............ File aux.tex ...................................%->>>\<aux\><<<- +\input progC.sty + +\chapter{Reusable Functions} + +\section{Shared Variable} + +The following code is included in reusable.c. + +\<vars\><<< +int count; +double sum; +>>> + +\section{Setting Initial Conditions} + +The following code is included in reusable.h. + +\<export functions\><<< +void initialize_sum_count(); +>>> + +The following code is included in reusable.c. + +\<functions\><<< +void initialize_sum_count() +{ + count = 0; + sum = 0.0; +} +>>> + +\section{Processing New Values} + +\<export functions\><<< +void add_value(); +>>> + + +\<functions\><<< +void add_value(value) +{ + count++; + sum += value; +} +>>> + + +\section{Computing the Average} + +\<export functions\><<< +double get_average(); +>>> + +\<functions\><<< +double get_average() +{ + return sum / count; +} +>>> + +Old files reusable.h and reusable.c are replaced when this +file (i.e., reusable.tex) is compiled, but not when progC.tex is compiled. + +\BYE{ \OutputCodE\<aux.h\> + \OutputCodE\<aux.c\> } +............ End file aux.tex ................%->>>\OutputCode\<aux\>\<\><<<- + +............ File macros.tex .............................%->>>\<macros\><<<- +\input progC.sty + +\chapter{C Macros} + +Algol-oriented flavor. + +\<macros.h\><<< +#define TRUE 1 +#define IF if ( +#define THEN ) { +#define ELSE }else{ +#define ELSEIF }else if( +#define FI } +#define WHILE while( +#define FOR for( +#define WITH ; +#define STEP ; +#define DO ){ +#define BEGIN { +#define END } +#define CASE switch( +#define OF ){ +>>> + +\BYE{ \OutputCodE\<macros.h\> } +............ End file macros.tex ..........%->>>\OutputCode\<macros\>\<\><<<- + +............ File progC.sty .....................%->>>\ClearCode\<progC\><<<- +\ifx\Code\undefined + + \hbadness=10000 \vbadness=10000 \hfuzz=99in \vfuzz=99in + \ifx \documentstyle\UnDef + %load private style + \else + \documentstyle{book} + \let\cleardoublepage=\clearpage + \begin{document} + \fi + \input ProTex.sty + + \ifx \Root\UnDef + \AlProTex{c,<<<>>>,[],list,title,`,_^,ClearCode} + \else + \AlProTex{c,<<<>>>,[],list,title,`,_^,ClearCode,ShowIndex} + \let\SvShowIndex=\ShowIndex + \def\ShowIndex{\let\ShowIndex=\SvShowIndex} + \fi + \def\CodeId#1#2{#1.#2-pg:\the\pageno-ln:\the\inputlineno} + + \let\FileName=\jobname + \def\INPUT#1{ + \def\FileName{#1} + \immediate\openout15=#1.pg + \immediate\write15{% + \string \pageno=\the\pageno\string \relax + \string \csname\space c@page\string \endcsname = + \expandafter\the\csname c@page\endcsname\string \relax + \string \csname\space c@chapter\string \endcsname = + \expandafter\the\csname c@chapter\endcsname\string \relax + \string \csname\space c@section\string \endcsname = + \expandafter\the\csname c@section\endcsname\string \relax + \string \csname\space c@subsection\string \endcsname = + \expandafter\the\csname c@subsection\endcsname\noexpand\relax + \string \csname\space c@subsubsection\string \endcsname = + \expandafter\the\csname c@subsubsection\endcsname\noexpand\relax + } + \immediate\closeout15 + \input #1 + } + + \ifx \documentstyle\UnDef \errmessage{--- This is a LaTeX file ---}\fi + \title{Averaging Numbers} + \date{2 October 1994} + \maketitle + \tableofcontents + + \openin15=\jobname.pg + \ifeof15 \else \input \jobname.pg \fi + \closein15 + \def\OutputCodE\<#1.#2\>{% + \csname :DoName\endcsname\def{#1}{\<#1.#2\>}% + \OutputCode[#2]\<#1\>} + \let\xxxOutputCode=\OutputCodE + \def\xxOutputCode\<#1.#2\>{% + \openin15=#1.#2 + \ifeof15 \xxxOutputCode\<#1.#2\>\fi + \closein15 } +\fi + +\ifx \BYE\undefined \def\BYE#1{#1\end{document}} +\else \def\BYE#1{{\let\OutputCodE=\xxOutputCode #1}% + \ShowIndex\ClearCode}\fi + + \ifx\Root\NotDef +\vfill\break\noindent\hfil\underbar{\bf INPUT FILE: \FileName .tex} + +\<\FileName.h\><<< +`<export define`> +`<export types`> +`<export vars`> +`<export functions`> +>>> + +\<\FileName.c\><<< +`<include files`> +`<define`> +`<types`> +`<header functions`> +`<vars`> +`<functions`> +>>> + + \else \let\Root=\NotDef \fi + +\Comment{ +/*}{*/ +} + +............ End file progC.sty ........%->>>\OutputCode[sty]\<progC\>\<\><<<- + +............ Make file 1 ..................................................... +# make -fS make.1 +# call LaTeX and C for revised files + +all : progC + progC + +main.c: main.tex + rm -f main.llog + latex main > main.llog + +aux.c: aux.tex + rm -f aux.llog + latex aux > aux.llog + +aux.h: aux.tex + rm -f aux.llog + latex aux > aux.llog + +macros.h: macros.tex + rm -f macros.llog + latex macros > macros.llog + +aux.o: aux.c aux.h macros.h + cc -c aux.c + +main.o: main.c aux.h macros.h + cc -c main.c + +progC : main.o aux.o + cc -o progC main.o aux.o + +............ End make file 1 ................................................ +............ Make file 2 .................................................... +# make -fS make.2 +# call LaTeX in background for revised files + +all : main.c aux.c macros.h + +main.c: main.tex + rm -f main.llog + latex main > main.llog & + +aux.c: aux.tex + rm -f aux.llog + latex aux > aux.llog & + +macros.h: macros.tex + rm -f macros.llog + latex macros > macros.llog & + +............ End make file 2 ................................................. +------------ End Example C ------------------------------------------------- + + + +------------ Example D: Joint Specification --------------%->>>\<progD\><<<- +\documentstyle{report} +\input ProTex.sty +\AlProTex{code,<<<>>>,[],title,list} +%...................................................................... +\def\Formula#1#2{\ifx#1\UnDefined\else\immediate\write16 + {--- warning --- Redefine equation for \string#1 ---}\fi + \gdef#1{% + \expandafter\ifx \csname :Tb\endcsname\relax + \ifmmode \InMath #2 + \else \vskip\smallskipamount\noindent\hfil + $ \let\InText=\relax \InMath #2 $% + \vskip\smallskipamount + \fi + \else #2\fi}% +} +\let\PrevModifyShowCode=\ModifyShowCode +\def\ModifyShowCode{\InCode \PrevModifyShowCode } +\let\PrevModifyOutputCode=\ModifyOutputCode +\def\ModifyOutputCode{\InCode \PrevModifyOutputCode } +\def\InCode{% + \def\divide##1##2{((##1) / (##2))}% + \def\sqrt##1{SQRT(##1)}% + \def\cdot{ * }% + \def\sin##1{(sin(##1))}% + \def\power##1##2{(##1)**(##2)}% + \def\NewLn{\csname :Ln\endcsname}% + } +\def\InMath{% + \def\divide##1##2{\ifx\LaTeX\undefined{##1\over##2}\else + {\frac{##1}{##2}}\fi}% + \def\power##1##2{##1^{##2}}% + \def\NewLn{\ifinner + \ifx\InText\realx \else \hfil\break\null\hfil \fi + \else $$$$\InMath \fi}% + } +%...................................................................... +\begin{document} + +Metalanguage: {\tt\string\divide}, {\tt\string\sqrt}, {\tt\string\cdot}, +{\tt\string\sin}, {\tt\string\power}, {\tt\string\NewLn}. + +\Formula\f{\divide{x}{\sqrt{1+\power{x}{2}}}\cdot + \NewLn \sin{\divide{y}{x}}} + +Formula \f{} and its code + +\<formula\><<< +w = \f +>>> + +Same formula in math modes $\f$ and $$\f$$. + +\OutputCode\<formula\> \end{document} + +------------ End Example D -----------%->>>\OutputCode\<progD\>\end{document} + +F. License +========== +% Copyright 2016 TeX Users Group +% Copyright 1990-1999 Eitan M. Gurari +% +% This program can 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 (at your option) any later version. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work +% is the TeX4ht Project <http://tug.org/tex4ht>. |