diff options
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/core-new.tex | 4 | ||||
-rw-r--r-- | tex/context/base/lang-frd.tex | 140 | ||||
-rw-r--r-- | tex/context/base/lang-frq.tex | 206 | ||||
-rw-r--r-- | tex/context/base/m-layout.tex | 100 | ||||
-rw-r--r-- | tex/context/base/page-lay.tex | 11 | ||||
-rw-r--r-- | tex/context/base/spec-fdf.tex | 2 | ||||
-rw-r--r-- | tex/context/base/spec-tpd.tex | 2 |
8 files changed, 460 insertions, 7 deletions
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index f0c519abc..71c4ed43e 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -15,7 +15,7 @@ \catcode`\{=1 \catcode`\}=2 -\def\contextversion{2004.1.13} +\def\contextversion{2004.1.16} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex index 31870a0c1..7f4d07959 100644 --- a/tex/context/base/core-new.tex +++ b/tex/context/base/core-new.tex @@ -285,8 +285,8 @@ \unexpanded \def\setup % {..} or [..] {\doifnextcharelse\bgroup\dosetups\dosetupsC} -\def\dosetupsA #1{\processcommalist[#1]\dosetups} % {..} -\def\dosetupsB[#1]{\processcommalist[#1]\dosetups} % [..] +\def\dosetupsA #1{\processcommacommand[#1]\dosetups} % {..} +\def\dosetupsB[#1]{\processcommacommand[#1]\dosetups} % [..] \def\dosetupsC[#1]{\dosetups{#1}} % [..] \def\dosetups#1% the grid option will be extended to other main modes diff --git a/tex/context/base/lang-frd.tex b/tex/context/base/lang-frd.tex new file mode 100644 index 000000000..e5b42f481 --- /dev/null +++ b/tex/context/base/lang-frd.tex @@ -0,0 +1,140 @@ +%D \module +%D [ file=lang-frd, +%D version=2004.01.15, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Frequency Table Data, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is expewrimental work! + +% http://www.onzetaal.nl/advies/letterfreq.html + +\startcharactertable[nl] + \charfreq a 7.47 + \charfreq b 1.58 + \charfreq c 1.24 + \charfreq d 5.93 + \charfreq e 18.91 + \charfreq f .81 + \charfreq g 3.4 + \charfreq h 2.38 + \charfreq i 6.5 + \charfreq j 1.46 + \charfreq k 2.25 + \charfreq l 3.57 + \charfreq m 2.21 + \charfreq n 10.03 + \charfreq o 6.06 + \charfreq p 1.57 + \charfreq q .009 + \charfreq r 6.41 + \charfreq s 3.73 + \charfreq t 6.79 + \charfreq u 1.99 + \charfreq v 2.85 + \charfreq w 1.52 + \charfreq x .04 + \charfreq y .035 + \charfreq z 1.39 +\stopcharactertable + +% http://caislab.icu.ac.kr/course/2001/spring/ice605/down/010306.pdf + +% \startcharactertable[en] +% \charfreq a 8.2 +% \charfreq b 1.5 +% \charfreq c 2.8 +% \charfreq d 4.3 +% \charfreq e 12.7 +% \charfreq f 2.2 +% \charfreq g 2 +% \charfreq h 6.1 +% \charfreq i 7 +% \charfreq j .2 +% \charfreq k .8 +% \charfreq l 4 +% \charfreq m 2.4 +% \charfreq n 6.7 +% \charfreq o 7.5 +% \charfreq p 1.9 +% \charfreq q .1 +% \charfreq r 6 +% \charfreq s 6.3 +% \charfreq t 9.1 +% \charfreq u 2.8 +% \charfreq v 1 +% \charfreq w 2.3 +% \charfreq x .1 +% \charfreq y 2 +% \charfreq z .1 +% \stopcharactertable + +% http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm + +\startcharactertable[en] + \charfreq a 8.04 + \charfreq b 1.54 + \charfreq c 3.06 + \charfreq d 3.99 + \charfreq e 12.51 + \charfreq f 2.3 + \charfreq g 1.96 + \charfreq h 5.49 + \charfreq i 7.26 + \charfreq j .16 + \charfreq k .67 + \charfreq l 4.14 + \charfreq m 2.53 + \charfreq n 7.09 + \charfreq o 7.6 + \charfreq p 2 + \charfreq q .11 + \charfreq r 6.12 + \charfreq s 6.54 + \charfreq t 9.25 + \charfreq u 2.71 + \charfreq v .99 + \charfreq w 1.92 + \charfreq x .19 + \charfreq y 1.73 + \charfreq z .09 +\stopcharactertable + +% http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm + +\startcharactertable[de] + \charfreq a 6.47 + \charfreq b 1.93 + \charfreq c 2.68 + \charfreq d 4.83 + \charfreq e 17.48 + \charfreq f 1.65 + \charfreq g 3.06 + \charfreq h 4.23 + \charfreq i 7.73 + \charfreq j .27 + \charfreq k 1.46 + \charfreq l 3.49 + \charfreq m 2.58 + \charfreq n 9.84 + \charfreq o 2.98 + \charfreq p .96 + \charfreq q .02 + \charfreq r 7.54 + \charfreq s 6.83 + \charfreq t 6.13 + \charfreq u 4.17 + \charfreq v .94 + \charfreq w 1.48 + \charfreq x .04 + \charfreq y .08 + \charfreq z 1.14 +\stopcharactertable + +\endinput
\ No newline at end of file diff --git a/tex/context/base/lang-frq.tex b/tex/context/base/lang-frq.tex new file mode 100644 index 000000000..4877e87dc --- /dev/null +++ b/tex/context/base/lang-frq.tex @@ -0,0 +1,206 @@ +%D \module +%D [ file=lang-frq, +%D version=2004.01.15, +%D title=\CONTEXT\ Language Macros, +%D subtitle=Language Frequency Table Support, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{Language Frequency Table Support} + +\unprotect + +\ifx\s!en\undefined \def\v!en{en} \fi +\ifx\??lg\undefined \def\??lg{@@lg} \fi + +%M \usemodule[frqlay] + +%D \macros +%D {charwidthmethod} +%D +%D This module implements a method for determining the width of an +%D average character in a language. It uses the dimensions of the +%D current fonts. +%D +%D \def\ShwChrWd#1#2#3% +%D {\chardef\charwidthmethod#1\relax +%D \mainlanguage[#2#3]\the\dimexpr(\averagecharwidth)} +%D +%D \starttabulatie[|c|c|c|c|c|c|] +%D \HL +%D \NC \NC\bf0=amount\NC\bf1=.5em\NC2=ex\NC\bf3=frequency\NC\bf4=list\NC\NR +%D \HL +%D \NC\bf en\NC\ShwChrWd0en\NC\ShwChrWd1en\NC\ShwChrWd2en\NC\ShwChrWd3en\NC\ShwChrWd4en\NC\NR +%D \NC\bf nl\NC\ShwChrWd0nl\NC\ShwChrWd1nl\NC\ShwChrWd2nl\NC\ShwChrWd3nl\NC\ShwChrWd4nl\NC\NR +%D \NC\bf de\NC\ShwChrWd0de\NC\ShwChrWd1de\NC\ShwChrWd2de\NC\ShwChrWd3de\NC\ShwChrWd4de\NC\NR +%D \HL +%D \stoptabulatie +%D +%D Method~1 ignores the widths and assumes that each character has a +%D width of .5em, which is true for most monospaced fonts. Method~2 +%D takes the x as starting point, and assumes that it's height kind of +%D matches its width. Method~3 is the best one, and determines the +%D average width based on the language specific character table. +%D Method~4 is a mixture between the first two methods: character +%D specific widths applied to an equal distribution. Method~0 reports +%D the total count, which normally is~100. + +\chardef\charwidthmethod=3 % 0=amount 1=em 2=ex 3=frequency 4=flattened >4=ex + +%D \macros +%D {charwidthlanguage} +%D +%D The language used for the calculations is defined as: + +\def\charwidthlanguage{\currentmainlanguage} + +%D \macros +%D {charfreq} +%D +%D This method comes into action in the following macro: + +\def\charfreq#1 #2 % character fraction + {+(\ifcase\charwidthmethod + #2\dimexpr(100\onepoint)% + \or + #2\dimexpr(.5em)% \fontdimen6\font/2 + \or + #2\dimexpr(\fontdimen5\font)% + \or + #2\fontcharwd\font`#1% + \or + \dimexpr(100\fontcharwd\font`#1/\charactertsize\charwidthlanguage)% ugly hack + \else + #2\dimexpr(\fontdimen5\font)% + \fi)} + +%D \macros +%D {startcharactertable} +%D +%D A frequency table is defined with the following macro. The \type +%D {charfreq} macro is used in this table. + +\def\startcharactertable[#1]#2\stopcharactertable % \dimexpr has fuzzy lookahead + {\startnointerference + \long\setgvalue{\??lg:w:#1}{#2}% the width vector + \scratchcounter\zerocount \def\charfreq##1 ##2 {\advance\scratchcounter\plusone} #2% + \long\setxvalue{\??lg:c:#1}{\the\scratchcounter}% the character count + \stopnointerference} + +%D \macros +%D {charactertable,charactertsize} +%D +%D The table content as well as the number of entries can be fetched with +%D the following two macros. The architecture of the table and calling +%D macro permits a fully expandable application. + +\def\charactertable#1% + {\csname\??lg:w:\ifcsname\??lg:w:#1\endcsname#1\else\s!en\fi\endcsname} + +\def\charactertsize#1% + {\csname\??lg:c:\ifcsname\??lg:c:#1\endcsname#1\else\s!en\fi\endcsname} + +%D Although it is of hardly any use, you can inherit a character table: +%D +%D \starttypen +%D \startcharactertable[cz] \charactertable{en} \stopcharactertable +%D \stoptypen +%D +%D We define a default vector with 100\% x's. + +\startcharactertable[en] 100 x \stopcharactertable % kind of default + +%D \macros +%D {averagecharwidth} +%D +%D This macro reports the average width for the current main +%D language (\the \dimexpr (\averagecharwidth)). + +\beginTEX + + \def\averagecharwidth{\the\fontdimen6\font} + +\endTEX + +\beginETEX \dimexpr + + \def\averagecharwidth{\dimexpr((\zeropoint\charactertable\charwidthlanguage)/100)} + +\endETEX + +\def\showcharfreq + {\hbox\bgroup + \charwidthlanguage:% + \dostepwiserecurse041% + {\chardef\charwidthmethod\recurselevel\relax + \enspace\recurselevel/\the\dimexpr(\averagecharwidth)}% + \egroup} + +%D Just for fun, we show a few frequency tables as graphic (\in {figure} +%D [fig:charfreq]). +%D +%D \startbuffer +%D \definepalet [charfreq] [en=darkred, nl=darkgreen, de=darkblue] +%D +%D \def\charfreq#1 #2 % +%D {\startMPdrawing +%D interim linejoin := butt ; +%D a := ASCII "#1" ; +%D if (a >= (ASCII "a")) and (a <= (ASCII "z")) : +%D draw ((0,#2*.25cm)--origin--(0,#2*.5cm)) +%D shifted (a*4mm+o,0) +%D withpen pencircle scaled .5mm +%D withcolor c; +%D fi ; +%D \stopMPdrawing} +%D +%D \resetMPdrawing +%D \startMPdrawing +%D numeric a, o ; a := o := 0 ; +%D color c ; c := .5white ; +%D string s ; s := "" ; +%D \stopMPdrawing +%D +%D \startMPdrawing o := 0mm ; c := \MPcolor{charfreq:en} ; \stopMPdrawing +%D \charactertable{en} +%D +%D \startMPdrawing o := 1mm ; c := \MPcolor{charfreq:nl} ; \stopMPdrawing +%D \charactertable{nl} +%D +%D \startMPdrawing o := 2mm ; c := \MPcolor{charfreq:de} ; \stopMPdrawing +%D \charactertable{de} +%D +%D \startMPdrawing +%D for a := ASCII "a" upto ASCII "z" : +%D draw textext.bot("\strut\tttf " & char a) shifted (a*4mm+1mm,-1mm) ; +%D endfor ; +%D \stopMPdrawing +%D +%D \MPdrawingdonetrue \getMPdrawing \resetMPdrawing +%D \stopbuffer +%D +%D \plaatsfiguur +%D [here] +%D [fig:charfreq] +%D {The character distributions for English, Dutch and German.} +%D {\getbuffer} +%D +%D A few samples of usage of this mechanism are shown below: +%D +%D \startbuffer +%D {\mainlanguage[en]\hsize65\averagecharwidth\mainlanguage[en]\input ward \endgraf} +%D {\mainlanguage[nl]\hsize65\averagecharwidth\mainlanguage[en]\input ward \blanko } +%D {\mainlanguage[de]\hsize65\averagecharwidth\mainlanguage[de]\input ward \blanko } +%D \stopbuffer +%D +%D \typebuffer \getbuffer +%D +%D Although the widthts differ, the consequenes for breaking the paragraph +%D into lines are minimal. + +\protect \endinput
\ No newline at end of file diff --git a/tex/context/base/m-layout.tex b/tex/context/base/m-layout.tex new file mode 100644 index 000000000..5cfc233e6 --- /dev/null +++ b/tex/context/base/m-layout.tex @@ -0,0 +1,100 @@ +%D \module +%D [ file=m-layout, +%D version=2004.01.16, +%D title=\CONTEXT\ Modules, +%D subtitle=Additional Layouts, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE/ Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is a preliminary module, don't depend on these dimensions yet. + +\readsysfile{lang-frq}\donothing\donothing +\readsysfile{lang-frd}\donothing\donothing + +\unprotect + +%def\layouthwratio{\withoutpt{\the\dimexpr(8\paperheight/\dimexpr(\paperwidth/ 8192))}} +%def\layouthwratio{\withoutpt{\the\dimexpr(4\paperheight/\dimexpr(\paperwidth/16384))}} +%def\layouthwratio{\withoutpt{\the\dimexpr(2\paperheight/\dimexpr(\paperwidth/32768))}} + +\def\layouthwratio + {\withoutpt{\the\dimexpr(2\paperheight/(\paperwidth/32768))}} + +\def\layouthfheight + {\dimexpr(\layoutparameter\c!hoofd+\layoutparameter\c!hoofdafstand+ + \layoutparameter\c!voet +\layoutparameter\c!voetafstand )} + +\startsetups[preset-1] + + \xdef\layoutwidth {\dimexpr(\layoutparameter\c!breedte)} + \gdef\layoutheight{\dimexpr(\layouthwratio\dimexpr(\layoutwidth)+\layouthfheight)} + +\stopsetups + +\definelayout + [preset-1-1] + [\c!preset=preset-1, + \c!rugwit=\dimexpr((\paperwidth-\layoutwidth)/2), + \c!breedte=\dimexpr(2\paperwidth/3), + \c!snijwit=\dimexpr((\paperwidth-\layoutwidth)/2), + \c!marge=\dimexpr((\paperwidth-\layoutwidth)/3), + \c!hoofd=2\lineheight, + \c!hoofdafstand=\lineheight, + \c!hoogte=\v!midden, % \layoutheight + \c!voetafstand=\layoutparameter\c!hoofdafstand, % \lineheight, + \c!voet=\layoutparameter\c!hoofd, % 2\lineheight, + \c!kopwit=\dimexpr(1\dimexpr(\paperheight-(\layoutheight+\layouthfheight))/3), + \c!bodemwit=\dimexpr(2\dimexpr(\paperheight-(\layoutheight+\layouthfheight))/3)] + +\startsetups[preset-2] + + \gdef\layouthstep{\dimexpr(\paperwidth /\layoutparameter\c!kolommen)} + \gdef\layoutvstep{\dimexpr(\paperheight/\layoutparameter\c!kolommen)} + +\stopsetups + +\definelayout + [preset-2-1] + [\c!preset=preset-2, + \c!kolommen=12, + \c!rugwit=\layouthstep, + \c!breedte=\v!midden, + \c!snijwit=2\layouthstep, + \c!marge=\layouthstep, + \c!hoofd=2\lineheight, + \c!hoofdafstand=\lineheight, + \c!hoogte=\v!midden, % \layoutheight + \c!voetafstand=\layoutparameter\c!hoofdafstand, + \c!voet=\layoutparameter\c!hoofd, + \c!kopwit=\dimexpr(\layoutvstep-\layoutparameter\c!hoofd-\layoutparameter\c!hoofdafstand), + \c!bodemwit=\dimexpr(2\layoutvstep-\layoutparameter\c!hoofd-\layoutparameter\c!hoofdafstand)] + +\definelayout + [preset-2-2] + [\c!preset=preset-2, + \c!kolommen=12, + \c!rugwit=\layouthstep, + \c!breedte=\v!midden, + \c!snijwit=2\layouthstep, + \c!marge=\layouthstep, + \c!hoofd=2\lineheight, + \c!hoofdafstand=\lineheight, + \c!hoogte=\v!midden, % \layoutheight + \c!voetafstand=\layoutparameter\c!hoofdafstand, + \c!voet=\layoutparameter\c!hoofd, + \c!kopwit=\layoutvstep, + \c!bodemwit=\layoutvstep] % maybe 1.5 + +% \setuplayout[preset-1-1] test \showframe \page +% \setuplayout[preset-1-1][width=65\averagecharwidth] \setuplayout[preset-1-1] test \showframe \page +% \setuplayout[preset-2-1] test \showframe \page +% \setuplayout[preset-2-1][columns=10] \setuplayout[preset-2-1] test \showframe \page +% \setuplayout[preset-2-2] test \showframe \page +% \setuplayout[preset-2-2][columns=10] \setuplayout[preset-2-2] test \showframe \page + +\protect \endinput
\ No newline at end of file diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex index 3abdd6e30..dd93d2101 100644 --- a/tex/context/base/page-lay.tex +++ b/tex/context/base/page-lay.tex @@ -442,8 +442,13 @@ \ifx\setups\undefined \def\setups[#1]{\setdefaultpenalties} \fi +% \newtoks \everybeforelayout \relax +% \newtoks \everyafterlayout \relax + \def\recalculatelayout - {\global\linkermargebreedte \layoutparameter\c!linkermarge + {%\the\everybeforelayout + \setups[\layoutparameter\c!preset]% + \global\linkermargebreedte \layoutparameter\c!linkermarge \global\rechtermargebreedte\layoutparameter\c!rechtermarge \global\linkerrandbreedte \layoutparameter\c!linkerrand \global\rechterrandbreedte \layoutparameter\c!rechterrand @@ -555,6 +560,7 @@ \global\setdimentoatleast\zetbreedte\onepoint \global\setdimentoatleast\zethoogte \onepoint % \checkcurrentlayout % here ? + % \the\everyafterlayout \calculatehsizes \calculatevsizes \calculatepseudocolumns @@ -562,8 +568,6 @@ \recalculatelogos \recalculatebackgrounds} -\newtoks \everylayoutcalculation \relax - \def\calculatepseudocolumns {\global\layoutcolumns\layoutparameter\c!kolommen \global\layoutcolumndistance\layoutparameter\c!kolomafstand @@ -1265,6 +1269,7 @@ \c!dx=\!!zeropoint, \c!dy=\!!zeropoint, \c!grid=\v!nee, + \c!preset=, \c!setups=\systemsetupsprefix\s!default, \c!clipoffset=\!!zeropoint, \c!regels=0, diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex index 993d60235..47a904145 100644 --- a/tex/context/base/spec-fdf.tex +++ b/tex/context/base/spec-fdf.tex @@ -881,6 +881,7 @@ \edef\pdf@@actions{\pdf@@actions /ShowControls \ifdone true\else false\fi}% \doPDFannotation width #7 height #8 data {/Subtype /Movie + /Border [0 0 0] /T (movie \currentmovie) /Movie << /F (#1) /Aspect [\width\space\height] \pdf@@options >> /A << \pdf@@actions >>}% @@ -903,6 +904,7 @@ \flushatshipout % since it can be buried in a chained box {\doPDFannotation width 0pt height 0pt data {/Subtype /Movie + /Border [0 0 0] /T (sound \currentsound) /Movie <</F (#1)>>% \ifx\pdf@@actions\empty\else/A << \pdf@@actions >>\fi}}% diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex index ed8ae3ac1..f673e97c3 100644 --- a/tex/context/base/spec-tpd.tex +++ b/tex/context/base/spec-tpd.tex @@ -153,7 +153,7 @@ %D Some more internal settings. \appendtoksonce - \pdfoutput=0 + \pdfoutput\zerocount \to \everyresetspecials \pdfoutput =1 % we reset that one with \everyresetspecials |