summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/pitex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-18 16:04:27 +0000
committerKarl Berry <karl@freefriends.org>2010-06-18 16:04:27 +0000
commit8ede9755397ce9574b3e950bdc2e57af559d1765 (patch)
treede0d1ef78e37c60edee77f9b38816ac20dee0d29 /Master/texmf-dist/tex/plain/pitex
parentf27ac35b0c41cde9fef228af89c141d3d0a272d4 (diff)
new plain package pitex (17jun10)
git-svn-id: svn://tug.org/texlive/trunk@19038 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/plain/pitex')
-rw-r--r--Master/texmf-dist/tex/plain/pitex/fonts.ptx127
-rw-r--r--Master/texmf-dist/tex/plain/pitex/pitex.tex296
-rw-r--r--Master/texmf-dist/tex/plain/pitex/sections.ptx92
3 files changed, 515 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/plain/pitex/fonts.ptx b/Master/texmf-dist/tex/plain/pitex/fonts.ptx
new file mode 100644
index 00000000000..6a3ceb019a8
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/pitex/fonts.ptx
@@ -0,0 +1,127 @@
+% I think my version of the following package might be modified.
+% So no way to be sure it'll work but on my computer
+% (anyway I use non-free fonts, so).
+%
+\input luaotfload.sty
+\pdfadjustspacing=2
+\directlua{%
+% From otfl-font-dum.lua
+ local byte = string.byte
+ fonts.expansions.setups['threepercent'] = {
+
+ stretch = 3, shrink = 3, step = .5, factor = 1,
+
+ [byte('A')] = 0.5, [byte('B')] = 0.7, [byte('C')] = 0.7, [byte('D')] = 0.5, [byte('E')] = 0.7,
+ [byte('F')] = 0.7, [byte('G')] = 0.5, [byte('H')] = 0.7, [byte('K')] = 0.7, [byte('M')] = 0.7,
+ [byte('N')] = 0.7, [byte('O')] = 0.5, [byte('P')] = 0.7, [byte('Q')] = 0.5, [byte('R')] = 0.7,
+ [byte('S')] = 0.7, [byte('U')] = 0.7, [byte('W')] = 0.7, [byte('Z')] = 0.7,
+ [byte('a')] = 0.7, [byte('b')] = 0.7, [byte('c')] = 0.7, [byte('d')] = 0.7, [byte('e')] = 0.7,
+ [byte('g')] = 0.7, [byte('h')] = 0.7, [byte('k')] = 0.7, [byte('m')] = 0.7, [byte('n')] = 0.7,
+ [byte('o')] = 0.7, [byte('p')] = 0.7, [byte('q')] = 0.7, [byte('s')] = 0.7, [byte('u')] = 0.7,
+ [byte('w')] = 0.7, [byte('z')] = 0.7, [byte('2')] = 0.7, [byte('3')] = 0.7, [byte('6')] = 0.7,
+ [byte('8')] = 0.7, [byte('9')] = 0.7,
+ }
+ }
+\def\currentfont{}
+\def\currentstyle{rm}
+\def\currentweight{rg}
+\def\currentcase{lc}
+\def\makecurrentfont{%
+ \csname\currentfont @\currentstyle @\currentweight @\currentcase\endcsname
+ }
+\def\it{%
+ \def\currentstyle{it}%
+ \makecurrentfont
+ }
+\def\bf{%
+ \def\currentweight{bf}%
+ \makecurrentfont
+ }
+\def\sc{%
+ \def\currentcase{sc}%
+ \makecurrentfont
+ }
+\def\rm{%
+ \def\currentstyle{rm}%
+ \makecurrentfont
+ }
+\def\rmstring{rm}
+\def\ital#1{{\it#1}}
+\def\bold#1{{\bf#1}}
+\def\scap#1{{\sc#1}}
+\def\rom#1{{\rm#1}}
+\def\emph{%
+ \ifx\currentstyle\rmstring
+ \expandafter\ital
+ \else
+ \expandafter\rom
+ \fi
+ }
+
+
+\restrictparameter font :
+ command % The command to be used to switch to that font.
+ name % Actually the part common to all files' names for that font.
+ type % otf, etc. The font parameter can't even load tfm's...
+ size % Well, the size.
+ features % Font features (e.g. +onum, etc.).
+ roman % The part of the file's name for the roman.
+ bold % The part of the file's name for the bold roman.
+ italic % The part of the file's name for the italic.
+ bolditalic % The part of the file's name for the bold italic.
+ % What happens is: it loads <name><roman>.<type> at <size>
+ % then the same with <bold>, etc.
+
+\setparameter metafont : % No relation :)
+ size = 10pt
+ features = +onum;+liga;+trep;expansion=threepercent;
+ type = otf % Oh yes, this is default!
+
+\setparameter font: meta = metafont\par
+
+\newdimen\ptx@fontsize
+\def\dofont#1#2#3{%
+ \passcs\font{\passvalue\commandtoname font : command @#1@#2@lc} =
+ "\usevalue font : name \usevalue font : #3 .\usevalue font : type :\usevalue font : features " at \usevalue font : size \relax
+ \passcs\font{\passvalue\commandtoname font : command @#1@#2@sc} =
+ "\usevalue font : name \usevalue font : #3 .\usevalue font : type :+smcp;\usevalue font : features " at \usevalue font : size \relax
+ }
+\defactiveparameter font {%
+ \ifattribute #1 : command
+ {%
+ \passvaluenobraces\edef #1 : command {%
+ \def\noexpand\currentfont{\passvalue\commandtoname #1 : command }%
+ \noexpand\makecurrentfont
+ }%
+ % If #1 = name isn't defined, roman, bold, etc. are supposed to hold the
+ % font's full (file) name.
+ \ifattribute #1 : roman
+ {\dofont{rm}{rg}{roman}%
+ \ifattribute #1 : bold
+ {\dofont{rm}{bf}{bold}}%
+ {}}%
+ {}%
+ \ifattribute #1 : italic
+ {\dofont{it}{rg}{italic}%
+ \ifattribute #1 : bolditalic
+ {\dofont{it}{bf}{bolditalic}}%
+ {}}%
+ {}}%
+ {}%
+ \ifvalue #1 : command = {\mainfont} \mainfont{}% Calls font if it is \mainfont.
+ \deleteattribute #1 : command
+ \deleteattribute #1 : name
+ \deleteattribute #1 : type
+ \deleteattribute #1 : size
+ \deleteattribute #1 : features
+ \deleteattribute #1 : roman
+ \deleteattribute #1 : bold
+ \deleteattribute #1 : italic
+ \deleteattribute #1 : bolditalic
+ }
+%
+\long\def\color#1#2{%
+ \pdfcolorstack0 push {#1 rg #1 RG}%
+ #2%
+ \pdfcolorstack0 pop%
+ } \ No newline at end of file
diff --git a/Master/texmf-dist/tex/plain/pitex/pitex.tex b/Master/texmf-dist/tex/plain/pitex/pitex.tex
new file mode 100644
index 00000000000..7f6e1823865
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/pitex/pitex.tex
@@ -0,0 +1,296 @@
+% This is piTeX, a set of macros I (Paul Isambert) use to
+% typeset documentations for my packages (that's why it is
+% archived on CTAN).
+%
+% Perhaps in the future, when this achieves some kind of
+% format-like completude, there'll be a documentation and
+% it'll be publicly announced.
+%
+% You can of course use those macros, but you are on your
+% own, and the files will probably be modified without announcement.
+% The file is supposed to be \input on plain TeX with LuaTeX, at least v.0.6.
+%
+%
+% The files needed are:
+%
+% texapi.tex (an independent package \input in the following file)
+% yax.tex (an independent package)
+% fonts.ptx (piTeX font "management")
+% luaotfload.sty (an independent package (not by me))
+% sections.ptx (piTeX sectionning commands)
+%
+% Date: June 2010.
+%
+%
+% User interface
+\input yax % which itself \input's texapi
+
+\setcatcodes{\@\_=11}
+\def\ptx@error{\senderror{PiTeX}}
+
+% This to write in latin1.
+\directlua{%
+ function convert(buf)
+ return string.gsub(buf,"(.)", function (ch)
+ return unicode.utf8.char(string.byte(ch))
+ end)
+ end
+ callback.register('process_input_buffer',convert)
+ }
+
+\newdimen\urvsize
+\urvsize\vsize
+
+\def\inputpitexfile#1 {\input #1.ptx }
+
+\inputpitexfile fonts
+\inputpitexfile sections
+% No footnotes in documentations.
+%\input footnotes.tex
+% I redefine the output routine on every job.
+%\input output.tex
+
+\defactiveparameter document{%
+ \pdfinfo{%
+ /Author (\usevalueor #1 : author {Unknown author})
+ /Title (\usevalueor #1 : pdftitle {\usevalueor #1 : title {No title}})
+ \ifattribute #1 : subject {/Subject (\usevalue #1 : subject )}{}
+ \ifattribute #1 : keywords {/Keywords (\usevalue #1 : keywords )}{}
+ }%
+ \pdfcatalog{%
+ /PageMode
+ \ifcasevalue #1 : display
+ \val outlines /UseOutlines
+ \val signets /UseOutlines % French!
+ \val thumbs /UseThumbs
+ \val thumbnails /UseThumbs
+ \val full /FullScreen
+ \val fullscreen /FullScreen
+ \elseval /UseNone
+ \endval
+ }%
+ }
+
+\restrictparameter document : author title pdftitle date subject keywords display version\par
+\restrictattribute document:display outlines signets thumbs thumbnails full fullscreen\par
+
+
+\defactiveparameter page{%
+ \settovalue\pdfpagewidth #1 : pagewidth
+ \settovalue\pdfpageheight #1 : pageheight
+ \settovalue\baselineskip #1 : baselineskip
+ \settovalueor\topskip #1 : topskip {\topskip=\baselineskip}%
+ \settovalue\pdfhorigin #1 : left
+ \ifattribute #1 : right
+ {\hsize = \dimexpr(\pdfpagewidth-\pdfhorigin-\usevalue #1 : right )\relax}
+ {\settovalue\hsize #1 : hsize }%
+ \settovalue\pdfvorigin #1 : top
+ \settovalue\parindent #1 : parindent
+ \settovalue\parskip #1 : parskip
+ \ifattribute #1 : lines {\vsize=\usevalue #1 : lines \baselineskip}{}%
+ }
+\restrictparameter page : pagewidth
+ pageheight
+ hsize
+ baselineskip
+ topskip
+ left
+ right
+ top
+ lines
+ parindent
+ parskip
+ \par
+
+% Defaults... they don't produce anything beautiful.
+% I redefine them on every job.
+\setparameter page:
+ pageheight = 28cm
+ pagewidth = 21cm
+ hsize = 15cm
+ baselineskip = 12pt
+ lines = 42
+ left = 1in
+ top = 1in
+ parskip = 0pt
+
+
+% Should be used with YaX to set parameters.
+\long\pdef\newblock{%
+ \ifnext*{\gobbleoneand\ptx@newblock_group}
+ {\ptx@newblock_nogroup}%
+ }
+\def\ptx@newblock_nogroup#1#2#3{%
+ \def#1{\ifnext/{\gobbleoneand{#3}}{#2}}%
+ }
+\def\ptx@newblock_group#1#2#3{%
+ \def#1{\ifnext/{\gobbleoneand{#3\egroup}}{\bgroup#2}}%
+ }
+\def\antigobblespace{%
+ \ifcatnext a{ }{\iffnext({ }}%
+ }
+
+
+% PDF links
+\def\dest#1#2{%
+ \ifcs{ptx@link_name=#1}
+ {\ptx@error{Link `#1' already exists}#2}
+ {\letcs{ptx@link_name=#1}\relax
+ \bgroup
+ \ifvmode
+ \pdfdest name {#1} xyz #2%
+ \else
+ \setbox0=\hbox{#2}%
+ \raise\ht0\hbox{\pdfdest name {#1} xyz}#2%
+ \fi
+ \egroup
+ }%
+ }
+\def\link#1#2{%
+ \pdfstartlink attr {/Border [0 0 0]} goto name {#1}#2\pdfendlink
+ }
+
+% Verbatim facilities.
+
+\def\tcode#1{{\codefont#1}}
+\long\def\com#1{%
+ \bgroup
+ \codefont
+ \string#1%
+ \egroup
+ \antigobblespace
+ }
+\def\arg#1{{\codefont\it<#1>}\iffnext\spacechar{\kern.2ex }}
+\def\barg#1{{\codefont\char"007B\relax{\it<#1>}\char"007D\relax}}
+
+
+\def\exampleskip{\vskip\baselineskip}
+\def\example{%
+ \exampleskip
+ \bgroup
+ \parindent0pt
+ \setcatcodes{\\\{\}\$\&\#\^\_\ \~\%=12,\^^M=13}%
+ \codefont
+ \readexample
+ }%
+\bgroup
+\setcatcodes{\\=12,\|=0,\^^M=13}%
+|gdef|readexample#1^^M#2\example/{#2|egroup|exampleskip}%
+|restorecatcodes%
+\setcatcodes{\^^M=13}%
+\gdef^^M{\quitvmode\endgraf}%
+\egroup%
+\def\verb#1{%
+ \def\ptx@verb##1#1{##1\egroup}%
+ \bgroup
+ \setcatcodes{\\\{\}\$\&\#\^\_\ \~\%=12}%
+ \codefont
+ \ptx@verb
+ }
+
+%
+% Read and process examples.
+%
+\newwrite\ptx@examplewrite
+
+\bgroup
+\setcatcodes{\%=12,\/=14}
+\gdef\Example{/
+ \immediate\openout\ptx@examplewrite=\jobname.pex
+ \immediate\write\ptx@examplewrite{% This is a scratch file used to typeset examples in \jobname.tex.}/
+ \immediate\write\ptx@examplewrite{% You can delete it.}/
+ \immediate\write\ptx@examplewrite{%}/
+ \bgroup
+ \setcatcodes{\\\#\%\^^M\ =12}/
+ \writeexample
+ }/
+\egroup
+
+\bgroup
+\setcatcodes{\^^M=12}%
+\gdef\writeexample#1^^M{%
+ \immediate\write\ptx@examplewrite{\noexpand\example}%
+ \ptx@writeexample}%
+\gdef\ptx@writeexample#1^^M{%
+ \passexpanded{\ifstring{#1}}{\examplestring}%
+ {\immediate\write\ptx@examplewrite{\string\example/}%
+ \immediate\closeout\ptx@examplewrite\egroup%
+ \processexample}%
+ {\immediate\write\ptx@examplewrite{\primunexpanded{#1}}%
+ \ptx@writeexample}%
+ }%
+{\setcatcodes{\\=12,\|=0}|gdef|examplestring{\Example/}}%
+\egroup
+
+\def\typesetexample{{\input\jobname.pex }}
+\def\doexample{{\let\example\ptx@Example\input\jobname.pex }}
+\def\ptx@Example{%
+ \iffnext/{\gobbleoneand\endinput}%
+ }
+% To be redefined for different layout.
+\def\processexample{\typesetexample\doexample}
+
+\def\verb#1{%
+ \def\ptx@verb##1#1{##1\egroup}%
+ \bgroup
+ \setcatcodes{\\\{\}\$\&\#\^\_\ \~\%=12}%
+ \codefont
+ \ptx@verb
+ }
+
+
+\newdimen\extraboxspace
+\newdimen\ptx@extraboxspace_top
+\newdimen\ptx@extraboxspace_right
+\newdimen\ptx@extraboxspace_bottom
+\newdimen\ptx@extraboxspace_left
+
+\newfornoempty\ptx@colorbox_loop{1}#2,{%
+ \ifcase#1
+ \ptx@extraboxspace_top =#2
+ \ptx@extraboxspace_right =#2
+ \ptx@extraboxspace_bottom =#2
+ \ptx@extraboxspace_left =#2
+ \or
+ \ptx@extraboxspace_right =#2
+ \ptx@extraboxspace_left =#2
+ \or
+ \ptx@extraboxspace_bottom =#2
+ \or
+ \ptx@extraboxspace_left =#2
+ \fi
+ \passarguments{\numexpr(#1+1)}%
+ }
+\def\colorbox{%
+ \ifnextnospace[\ptx@colorbox_setborders
+ {\ptx@extraboxspace_top =\extraboxspace
+ \ptx@extraboxspace_right =\extraboxspace
+ \ptx@extraboxspace_bottom =\extraboxspace
+ \ptx@extraboxspace_left =\extraboxspace
+ \ptx@colorbox_do}%
+ }
+\def\ptx@colorbox_setborders[#1]{%
+ \ptx@colorbox_loop{0}{#1,}%
+ \ptx@colorbox_do
+ }
+{\setcatcodes{pt=12}
+\gdef\noPT#1pt{#1 }}
+\def\ptx@colorbox_do#1#2{%
+ \bgroup
+ \setbox0=\hbox{#2}%
+ \hbox{%
+ \pdfliteral{
+ q #1 rg #1 RG
+ -\expandafter\noPT\the\ptx@extraboxspace_left
+ \expandafter\noPT\the\dimexpr(\ht0+\ptx@extraboxspace_top)\relax
+ \expandafter\noPT\the\dimexpr(\wd0+\ptx@extraboxspace_left+\ptx@extraboxspace_right)\relax
+ -\expandafter\noPT\the\dimexpr(\ht0+\ptx@extraboxspace_top+\dp0+\ptx@extraboxspace_bottom)\relax
+ re f Q}%
+ #2}%
+ \egroup
+ }
+
+\def\trace{\tracingcommands4 \tracingmacros4 }
+\def\untrace{\tracingcommands0 \tracingmacros0 }
+
+\restorecatcodes \ No newline at end of file
diff --git a/Master/texmf-dist/tex/plain/pitex/sections.ptx b/Master/texmf-dist/tex/plain/pitex/sections.ptx
new file mode 100644
index 00000000000..aae16e4192e
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/pitex/sections.ptx
@@ -0,0 +1,92 @@
+\newcount\ptx@section_skip % A count, since vertical skips are expressed in number of lines.
+\newcount\ptx@section_link
+\def\sectioncommand#1#2#3{%
+ \par\penalty0
+ \ifvalue #1 : clear = true
+ {\vfil\penalty-10000}% Clear the page...
+ {% Or skip some lines. The "beforeskip" attribute is the number of blank lines one wants before a section
+ % title and "minimum" is the minimum number of lines it must be possible to have after the section title.
+ \ifdim\dimexpr(\pagegoal-\pagetotal) < \numexpr(\usevalueor #1 : beforeskip 0+\usevalueor #1 : minimum 0) \baselineskip
+ \vfil\penalty-10000 % Not enough room.
+ \else
+ \vskip\usevalueor #1 : beforeskip 0 \baselineskip
+ \fi}%
+%
+% Sections have an internal count, incremented here.
+ \storevalueor\ptx@tempsectioncount #1 : internalcount {\def\ptx@tempsectioncount{0}}%
+ \setparameter #1 : e:internalcount = {\the\numexpr(\ptx@tempsectioncount+1)}\par
+ \resetbelow{#1}% Resets all internal counts of sections which depend on the current one (i.e. "section" depends on "chapter", etc.).
+%
+%
+ \ifvalue #1 : link = true {%
+ \global\advance\ptx@section_link 1
+ \pdfdest num \ptx@section_link xyz
+ \pdfoutline attr {/Border [0 0 2]} goto num \ptx@section_link {\detokenize{#2}}}{}%
+ \noindent
+ \hskip\usevalueor #1 : indent {0pt}%
+ \bgroup
+ \ifattribute #1 : color {\pdfcolorstack0 push {\usevalueand #1 : color { rg}{} \usevalueand #1 : color { RG}{}}}{}%
+ \usevalue #1 : font
+ \ifvalue #1 : number = none {}{%
+ \usevalue #1 : beforenumber
+ \ifcasevalue #1 : number
+ \val roman \makeroman
+ \val arabic \unbrace
+ \endval{\usevalue #1 : internalcount }%
+ \usevalue #1 : afternumber
+ }%
+ #3%
+ \ifattribute #1 : color {\pdfcolorstack0 pop}{}
+ \egroup
+ \ifvalue #1 : inline = true
+ {}
+ {\vskip\usevalueor #1:afterskip 0\baselineskip}%
+ }
+\newwhile\resetbelow1{}{%
+ \ifattribute #1 : below
+ {\storevalue\tempbelow #1 : below
+ \setparameter\tempbelow : e:internalcount = 0\par
+ \passvalue{\changewhile} #1 : below
+ }{\breakwhile{}}%
+ }
+\def\makeroman#1{%
+ \uppercase\expandafter{\romannumeral#1\relax}%
+ }
+
+\setparameter metasection :
+ clear = false
+ minimum = 3
+ inline = false
+ number = arabic
+ link = true
+ afternumber = "\kern.3em"
+
+\setparameter chapter section subsection :
+ meta = metasection
+
+\setparameter chapter :
+ clear = true
+ number = arabic
+ below = section
+ afterskip = 3
+ indent = "0pt plus 1fill"
+ beforenumber = "chapitre "
+ afternumber = {\par\hfill}
+
+\setparameter section :
+ beforeskip = 2
+ below = subsection
+
+\setparameter subsection :
+ font = \it
+ beforeskip = 1
+ beforenumber = "\usevalue section:internalcount ."
+ minimum = 3
+
+\def\chaptertitle{}%
+\def\chapter#1{%
+ \def\chaptertitle{#1}%
+ \sectioncommand{chapter}{#1}{#1}%
+ }
+\def\section#1{\sectioncommand{section}{#1}{#1}}
+\def\subsection#1{\sectioncommand{subsection}{#1}{#1}} \ No newline at end of file