summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/hyplain
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-10-20 15:39:20 +0000
committerKarl Berry <karl@freefriends.org>2006-10-20 15:39:20 +0000
commit67dc1904f7572d9afe9dc9e0f994b5eab848cb58 (patch)
tree5f8aec0be776ed634fb900b01689054215b720ac /Master/texmf-dist/tex/plain/hyplain
parenta9c9e1bbd6917a053cb851ec0633c8737a661fba (diff)
new plain package hyplain (18oct06)
git-svn-id: svn://tug.org/texlive/trunk@2356 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/plain/hyplain')
-rw-r--r--Master/texmf-dist/tex/plain/hyplain/hylang.tex57
-rw-r--r--Master/texmf-dist/tex/plain/hyplain/hypdfplain.ini9
-rw-r--r--Master/texmf-dist/tex/plain/hyplain/hyplain.tex39
-rw-r--r--Master/texmf-dist/tex/plain/hyplain/hyrules.tex112
4 files changed, 217 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/plain/hyplain/hylang.tex b/Master/texmf-dist/tex/plain/hyplain/hylang.tex
new file mode 100644
index 00000000000..05714399267
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/hyplain/hylang.tex
@@ -0,0 +1,57 @@
+%%% This is hylang.tex (version 1.0), where language definitions
+%%% actually occur. The first one should always be
+%%% American English, for compatibility with plain TeX.
+%%%
+%%% Users can modify this file in order to define the
+%%% languages they need.
+%%%
+%%% Every language definition should be followed by a
+%%% \refinelanguage command where conventions specific to
+%%% the language are set; users should at least provide
+%%% the left and right hyphenation minima using
+%%% \hyphenmins{<left>}{<right>}
+%%%
+%%% In the third argument one puts what has to be done
+%%% when activating the language; in the fourth argument
+%%% what needs to be undone.
+
+%%% US English must always come first
+\definebaselanguage{en}{US}{hyphen} %%% <--- don't modify
+\refinelanguage{en}{US}{\hyphenmins{2}{3}}{}
+
+%%% Italian
+\definelanguage{it}{IT}{ithyph}
+\refinelanguage{it}{IT}{\hyphenmins{2}{2}\lccode`\'=`\'}{\lccode`\'=0 }
+
+%%% Add other languages if needed
+%%%
+%%% The arguments to \definelanguage are:
+%%% #1: the language code; it is an arbitrary string, use the
+%%% ISO two-letter language code for uniformity, or `nde' for
+%%% new orthography German
+%%% #2: the nation code; use the uppercase ISO two-letter code
+%%% #3: the file with hyphenation patterns
+%%%
+%%% The arguments to \refinelanguage and \refinedialect are:
+%%% #1 and #2: a pair defined through \definelanguage or \definedialect
+%%% #3: commands to be executed when entering the language
+%%% #4: commands to be undone when entering a new language
+%%%
+% \definelanguage{xx}{YY}{xxhyph}
+% \refinelanguage{xx}{YY}{<something>}{<something>}
+%
+% \definedialect{aa}{BB}{xx}{XX}
+% \refinedialect{aa}{BB}{<something>}{<something>}
+
+% At last the fallback, a language with no patterns
+\definelanguage{zz}{ZZ}{zerohyph}
+% \refinelanguage{zz}{ZZ}{}{} % no need to set conventions
+
+%%% Aliases
+\addalias\US{en}{US}
+\addalias\IT{it}{IT}
+\addalias\ZZ{zz}{ZZ}
+\addalias\nohyphens{zz}{ZZ}
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/plain/hyplain/hypdfplain.ini b/Master/texmf-dist/tex/plain/hyplain/hypdfplain.ini
new file mode 100644
index 00000000000..25671da5537
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/hyplain/hypdfplain.ini
@@ -0,0 +1,9 @@
+%%% This is part of the hyplain package by Enrico Gregorio
+%%% You are allowed to do anything you want with this as long
+%%% as you cite the source and change name to the file
+%%%
+%%% The purpose of this file is to provide an initialization
+%%% for pdfTeX
+\pdfoutput=1
+\input hyplain
+
diff --git a/Master/texmf-dist/tex/plain/hyplain/hyplain.tex b/Master/texmf-dist/tex/plain/hyplain/hyplain.tex
new file mode 100644
index 00000000000..64423ba8fb7
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/hyplain/hyplain.tex
@@ -0,0 +1,39 @@
+%%% This is part of the hyplain package by Enrico Gregorio
+%%% You are allowed to do anything you want with this as long
+%%% as you cite the source and change name to the file
+%%% (but don't rename it plain.tex)
+%%%
+%%% Its purpose is to load plain.tex but not hyphen.tex
+%%% in order to be able to define more languages than
+%%% American English.
+%%%
+%%% By running iniTeX on this file, you end up with a
+%%% plain TeX format with some new facilities for changing
+%%% the language (see hyrules.tex and hydoc.tex)
+
+\catcode`\{=1 % left brace is begin-group character
+\catcode`\}=2 % right brace is end-group character
+\catcode`\@=11 % Now @ is a letter
+
+%%% Save the original meaning of \input
+\let\orig@input\input
+
+%%% D. E. Knuth has decreed that plain.tex cannot be modified
+%%% except for preloaded fonts. But we can always use some
+%%% TeX trick; since the file is immutable, it will contain
+%%% the line `\input hyphen'; at that point we restore the
+%%% original meaning of \input and input hyrules.tex instead
+%%% of hyphen.tex
+\def\input hyphen {\let\input\orig@input \input hyrules }
+
+%%% Here we load plain.tex
+\orig@input plain
+
+%%% We change the contents of \fmtname
+\def\fmtname{plain (multiple language support)}
+%%% Just a reminder for \fmtversion which we keep identical
+%%% to the plain TeX version number
+% \def\fmtversion{3.14159265}
+\def\hyplainversion{1.0}
+
+\dump
diff --git a/Master/texmf-dist/tex/plain/hyplain/hyrules.tex b/Master/texmf-dist/tex/plain/hyplain/hyrules.tex
new file mode 100644
index 00000000000..25e627c5ca1
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/hyplain/hyrules.tex
@@ -0,0 +1,112 @@
+%%% This is part of the hyplain package by Enrico Gregorio, version 1.0
+%%% You are allowed to do anything you want with this as long
+%%% as you cite the source and change name to the file
+%%%
+%%% (Based on HyMaster.tex by Daniel Flipo and Laurent Siebenmann)
+%%%
+%%% The interface is primitive, of course. But plain TeX users
+%%% are at their ease with primitive interfaces ;-)
+%%%
+%%% Note: every language is defined as a pair (<language>,<nation>)
+%%% with ISO two-letter abbreviations to accommodate for national
+%%% variations (for example, (de,DE) and (de,AT) or (de,CH) for German
+%%% in Germany, Austria or Switzerland)
+%%% For New Ortography German, use the three-letter abbreviation `nde'
+%%% A fallback language (zz,ZZ) is provided, with no hyphenation
+%%% patterns
+
+\chardef\myh@us@catcode=\the\catcode`\_
+\catcode`\_=11
+\def\myh@us{_}
+
+%%% \addalias{<control sequence>}{<language>}{<nation>}
+%%% define a new alias for a language; for example
+%%% \addalias{\italiano}{it}{IT}
+\def\addalias#1#2#3{\expandafter\let\expandafter#1\csname #2\myh@us#3\endcsname}
+
+\def\myh@glet{\global\let}
+\def\selectlanguage#1#2{%
+ \expandafter\ifx\csname #1_#2\endcsname\relax
+ \expandafter\myh@glet\csname #1_#2\endcsname\zz_ZZ
+ \myh@nel{#1}{#2}%
+ \fi
+ \csname #1_#2\endcsname
+ \ignorespaces}
+\def\myh@nel#1#2{\message{^^Jhyplain warning: Language #1 for #2 undefined,
+ using fallback instead^^J}}
+
+%%% A primitive interface for adding to extras and noextras
+\newtoks\myh@toks
+\def\addto#1#2#3#4{%
+ \expandafter\let\expandafter\myh@temp\csname extras@#1\myh@us#2\endcsname
+ \myh@toks=\expandafter{\myh@temp}%
+ \myh@toks=\expandafter{\the\myh@toks #3}
+ \expandafter\edef\csname extras@#1\myh@us#2\endcsname{\the\myh@toks}%
+ \expandafter\let\expandafter\myh@temp\csname noextras@#1\myh@us#2\endcsname
+ \myh@toks=\expandafter{\myh@temp}%
+ \myh@toks=\expandafter{\the\myh@toks #4}
+ \expandafter\edef\csname noextras@#1\myh@us#2\endcsname{\the\myh@toks}%
+}
+
+\def\myh@undo{\csname noextras@\myh@lan\endcsname}
+
+%%% \definelanguage has 3 parameters:
+%%% #1: <language> (lowercase ISO abbreviation)
+%%% #2: <nation> (uppercase ISO abbreviation)
+%%% #3: pattern and hyphenation exception file
+\newlinechar`^^J
+\def\definebaselanguage#1#2#3{%
+ \message{***^^JDefining language #1 for #2 using^^J}%
+ \expandafter\chardef\csname l@#1_#2\endcsname=0
+ \expandafter\language\csname l@#1_#2\endcsname
+ \input #3%
+ \message{This is \string\language
+ \expandafter\the\csname l@#1_#2\endcsname^^J***^^J}%
+ \myh@initialize{#1}{#2}}
+\def\definelanguage#1#2#3{%
+ \message{***^^JDefining language #1 for #2 using^^J}%
+ \csname newlanguage\expandafter\endcsname\csname l@#1_#2\endcsname
+ \expandafter\language\csname l@#1_#2\endcsname
+ \input #3%
+ \message{This is \string\language
+ \expandafter\the\csname l@#1_#2\endcsname^^J***^^J}%
+ \myh@initialize{#1}{#2}}
+%%% \definedialect has 4 parameters:
+%%% (#1,#2) is the pair to be defined, (#3,#4) is the pair over
+%%% which the dialect is defined (\definedialect{de}{AT}{de}{DE})
+\def\definedialect#1#2#3#4{%
+ \expandafter\let\csname l@#1_#2\expandafter\endcsname
+ \csname l@#3_#4\endcsname
+ \myh@initialize{#1}{#2}}
+
+\def\myh@initialize#1#2{%
+ \expandafter\def\csname #1_#2\endcsname{%
+ \expandafter\language\csname l@#1_#2\endcsname
+ \myh@undo
+ \def\myh@lan{#1_#2}%
+ \csname extras@#1_#2\endcsname}%
+ \expandafter\def\csname extras@#1_#2\endcsname{}%
+ \expandafter\def\csname noextras@#1_#2\endcsname{}}
+
+%%% \refinelanguage defines the extras for a language
+%%% It has 4 parameters: <language>,<nation>,<extras>,<noextras>
+\def\refinelanguage#1#2#3#4{%
+ \expandafter\def\csname extras@#1_#2\endcsname{#3}%
+ \expandafter\def\csname noextras@#1_#2\endcsname{#4}}
+\let\refinedialect=\refinelanguage
+
+\def\hyphenmins#1#2{\lefthyphenmin=#1\relax\righthyphenmin=#2\relax}
+
+\input hylang
+
+%%% Initialize and restore the underscore
+\let\definebaselanguage\undefined
+\let\definelanguage\undefined
+
+\def\myh@lan{} % initialization
+\def\noextras@{} % initialization
+\en_US
+
+\catcode`\_=\myh@us@catcode
+
+\endinput