diff options
69 files changed, 2715 insertions, 1022 deletions
diff --git a/context/data/cont-cz.tws b/context/data/cont-cz.tws index 099fd9b37..5ef939216 100644 --- a/context/data/cont-cz.tws +++ b/context/data/cont-cz.tws @@ -331,7 +331,7 @@ stopsetup startsetup com:opissoubor: -typ:arg/arg/: +typ:val/arg/: val:*jmeno:: val:*soubor:: stopsetup diff --git a/context/data/cont-de.tws b/context/data/cont-de.tws index 6d1e1c6b5..14280614f 100644 --- a/context/data/cont-de.tws +++ b/context/data/cont-de.tws @@ -331,7 +331,7 @@ stopsetup startsetup com:tippedatei: -typ:arg/arg/: +typ:val/arg/: val:*Name:: val:*Datei:: stopsetup diff --git a/context/data/cont-en.tws b/context/data/cont-en.tws index 1072c529d..62fddc5d4 100644 --- a/context/data/cont-en.tws +++ b/context/data/cont-en.tws @@ -331,7 +331,7 @@ stopsetup startsetup com:typefile: -typ:arg/arg/: +typ:val/arg/: val:*name:: val:*file:: stopsetup diff --git a/context/data/cont-it.tws b/context/data/cont-it.tws index 63702568b..21181c578 100644 --- a/context/data/cont-it.tws +++ b/context/data/cont-it.tws @@ -331,7 +331,7 @@ stopsetup startsetup com:typefile: -typ:arg/arg/: +typ:val/arg/: val:*nome:: val:*file:: stopsetup diff --git a/context/data/cont-nl.tws b/context/data/cont-nl.tws index d5ce25503..3d8869457 100644 --- a/context/data/cont-nl.tws +++ b/context/data/cont-nl.tws @@ -331,7 +331,7 @@ stopsetup startsetup com:typefile: -typ:arg/arg/: +typ:val/arg/: val:*naam:: val:*file:: stopsetup diff --git a/context/data/cont-ro.tws b/context/data/cont-ro.tws index fc3a27748..fbf69d7b5 100644 --- a/context/data/cont-ro.tws +++ b/context/data/cont-ro.tws @@ -331,7 +331,7 @@ stopsetup startsetup com:typefile: -typ:arg/arg/: +typ:val/arg/: val:*nume:: val:*fisier:: stopsetup diff --git a/context/perltk/runperl.zip b/context/perltk/runperl.zip Binary files differdeleted file mode 100644 index 2db7d8033..000000000 --- a/context/perltk/runperl.zip +++ /dev/null diff --git a/context/perltk/texexec.pl b/context/perltk/texexec.pl index e020cddcd..ba666e283 100644 --- a/context/perltk/texexec.pl +++ b/context/perltk/texexec.pl @@ -2,12 +2,13 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $ if 0; # todo: second run of checksum of mp file with --nomprun changes -# todo: merge wybo's enhanced help function [along with updating manual] # todo: warning if no args +# todo: <<<< in messages +# todo: cleanup #D \module #D [ file=texexec.pl, -#D version=2000.03.25, +#D version=2002.05.04, #D title=running \ConTeXt, #D subtitle=\TEXEXEC, #D author=Hans Hagen, @@ -21,23 +22,26 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $ # Thanks to Tobias Burnus for the german translations. # Thanks to Thomas Esser for hooking it into web2c # Thanks to Taco Hoekwater for suggesting improvements +# Thanks to Wybo Dekker for the advanced help interface + +# (I still have to completely understand the help code -) #D We started with a hack provided by Thomas Esser. This #D expression replaces the unix specific line \type #D {#!/usr/bin/perl}. -# require "5.005" ; - -use Cwd ; -use Time::Local ; # needed ? -use Config ; -use Getopt::Long ; +use Cwd ; +use Time::Local ; +use Config ; +use Getopt::Long ; +use Class::Struct ; # needed for help subsystem +# Data::Dumper ; # needed for help subsystem my %ConTeXtInterfaces ; # otherwise problems with strict my %ResponceInterface ; # since i dunno how to allocate else -my %Help ; +# my %Help ; -#use strict ; +# use strict ; #D In this script we will launch some programs and other #D scripts. \TEXEXEC\ uses an ini||file to sort out where @@ -232,13 +236,13 @@ if (($LogFile ne '')&&($LogFile =~ /\w+\.log$/io)) *STDOUT = *LOGFILE ; *STDERR = *LOGFILE } -my $Program = " TeXExec 2.8 - ConTeXt / PRAGMA ADE 1997-2002" ; +my $Program = " TeXExec 3.0 - ConTeXt / PRAGMA ADE 1997-2002" ; -print "\n$Program\n\n"; +print "\n$Program\n\n" ; my $pathslash = '/' ; if ($0 =~ /\\/) { $pathslash = "\\" } my $cur_path = ".$pathslash" ; -my $own_path = $0 ; $own_path =~ s/texexec(\.pl|\.bat|\.exe)//io ; +my $own_path = $0 ; $own_path =~ s/texexec(\.pl|\.bat|)//io ; my $own_type = $1 ; my $own_stub = "" ; @@ -583,208 +587,352 @@ SetInterfaces ( "no" , "norwegian" , "norwegian" ) ; SetInterfaces ( "ro" , "romanian" , "romanian" ) ; SetInterfaces ( "xx" , "experimental" , "english" ) ; -$Help{ARRANGE} = " --arrange process and arrange\n" ; -$Help{BATCH} = " --batch run in batch mode (don't pause)\n" ; -$Help{CENTERPAGE} = " --centerpage center the page on the paper\n" ; -$Help{COLOR} = " --color enable color (when not yet enabled)\n" ; -$Help{USEMODULE} = " --usemodule load some modules first\n" ; -$Help{usemodule} = -$Help{USEMODULE} . " =name : list of modules\n" ; -$Help{XMLFILTER} = " --xmlfilter apply XML filter\n" ; -$Help{xmlfilter} = -$Help{XMLFILTER} . " =name : list of filters\n" ; -$Help{ENVIRONMENT} = " --environment load some environments first\n" ; -$Help{environment} = -$Help{ENVIRONMENT} . " =name : list of environments\n" ; -$Help{FAST} = " --fast skip as much as possible\n" ; -$Help{FIGURES} = " --figures typeset figure directory\n" ; -$Help{figures} = -$Help{FIGURES} . " =a : room for corrections\n" - . " =b : just graphics\n" - . " =c : one (cropped) per page\n" - . " --paperoffset room left at paper border\n" ; -$Help{FINAL} = " --final add a final run without skipping\n" ; -$Help{FORMAT} = " --format fmt file\n" ; -$Help{format} = -$Help{FORMAT} . " =name : format file (memory dump) \n" ; -$Help{MPFORMAT} = " --mpformat mem file\n" ; -$Help{mpformat} = -$Help{MPFORMAT} . " =name : format file (memory dump) \n" ; -$Help{INTERFACE} = " --interface user interface\n" ; -$Help{interface} = -$Help{INTERFACE} . " =en : English\n" - . " =nl : Dutch\n" - . " =de : German\n" - . " =cz : Czech\n" - . " =uk : Brittish\n" - . " =it : Italian\n" ; -$Help{LANGUAGE} = " --language main hyphenation language \n" ; -$Help{language} = -$Help{LANGUAGE} . " =xx : standard abbreviation \n" ; -$Help{LISTING} = " --listing produce a verbatim listing\n" ; -$Help{listing} = -$Help{LISTING} . " --backspace inner margin of the page\n" . - " --topspace top/bottom margin of the page\n" . - " --pretty enable pretty printing\n" . - " --color use color for pretty printing\n" ; -$Help{MAKE} = " --make build format files \n" ; -$Help{make} = -$Help{MAKE} . " --language patterns to include\n" . - " --bodyfont bodyfont to preload\n" . - " --response response interface language\n" . - " --format TeX format\n" . - " --mpformat MetaPost format\n" . - " --program TeX program\n" ; -$Help{MODE} = " --mode running mode \n" ; -$Help{mode} = -$Help{MODE} . " =list : modes to set\n" ; -$Help{MODULE} = " --module typeset tex/pl/mp module\n" ; -$Help{MPTEX} = " --mptex run an MetaPost plus btex-etex cycle\n" ; -$Help{MPXTEX} = " --mpxtex generatet an MetaPostmpx file\n" ; -$Help{NOARRANGE} = " --noarrange process but ignore arrange\n" ; -$Help{NOMP} = " --nomp don't run MetaPost at all\n" ; -$Help{NOMPRUN} = " --nomprun don't run MetaPost at runtime\n" ; -$Help{AUTOMPRUN} = " --automprun MetaPost at runtime when needed\n" ; -$Help{ONCE} = " --once run TeX only once (no TeXUtil either)\n" ; -$Help{OUTPUT} = " --output specials to use\n" ; -$Help{output} = -$Help{OUTPUT} . " =pdftex\n" - . " =dvips\n" - . " =dvipsone\n" - . " =dviwindo\n" - . " =dviview\n" - . " =dvipdfm\n" ; -$Help{PASSON} = ' --passon switches to pass to TeX ("--src" for MikTeX)' . "\n" ; -$Help{PAGES} = " --pages pages to output\n" ; -$Help{pages} = -$Help{PAGES} . " =odd : odd pages\n" . - " =even : even pages\n" . - " =x,y:z : pages x and y to z\n" ; -$Help{PAPER} = " --paper paper input and output format\n" ; -$Help{paper} = -$Help{PAPER} . " =a4a3 : A4 printed on A3\n" . - " =a5a4 : A5 printed on A4\n" ; -$Help{PATH} = " --path document source path\n" ; -$Help{path} = -$Help{PATH} . " =string : path\n" ; -$Help{PDF} = " --pdf produce PDF directly using pdf(e)tex\n" ; -$Help{PDFARRANGE} = " --pdfarrange arrange pdf pages\n" ; -$Help{pdfarrange} = -$Help{PDFARRANGE} . " --paperoffset room left at paper border\n" . - " --paper paper format\n" . - " --noduplex single sided\n" . - " --backspace inner margin of the page\n" . - " --topspace top/bottom margin of the page\n" . - " --markings add cutmarks\n" . - " --background =background graphic\n" . - " --addempty add empty page after\n" . - " --textwidth width of the original (one sided) text\n" ; -$Help{PDFCOMBINE} = " --pdfcombine combine pages to one page\n" ; -$Help{pdfcombine} = -$Help{PDFCOMBINE} . " --paperformat paper format\n" . - " --combination n*m pages per page\n" . - " --paperoffset room left at paper border\n" ; -$Help{PDFCOPY} = " --pdfcopy scale pages down/up\n" ; -$Help{pdfcopy} = -$Help{PDFCOPY} . " --scale new page scale\n" . - " --paperoffset room left at paper border\n" . - " --markings add cutmarks\n" . - " --background =background graphic\n" ; -$Help{PDFSELECT} = " --pdfselect select pdf pages\n" ; -$Help{pdfselect} = -$Help{PDFSELECT} . " --selection pages to select\n" . - " =odd : odd pages\n" . - " =even : even pages\n" . - " =x,y:z : pages x and y to z\n" . - " --paperoffset room left at paper border\n" . - " --paperformat paper format\n" . - " --backspace inner margin of the page\n" . - " --topspace top/bottom margin of the page\n" . - " --markings add cutmarks\n" . - " --background =background graphic\n" . - " --addempty add empty page after\n" . - " --textwidth width of the original (one sided) text\n" ; -$Help{PRINT} = " --print page imposition scheme\n" ; -$Help{print} = -$Help{PRINT} . " =up : 2 pages per sheet doublesided \n" . - " =down : 2 rotated pages per sheet doublesided \n" ; -$Help{RESULT} = " --result resulting file \n" ; -$Help{result} = -$Help{RESULT} . " =name : filename \n" ; -$Help{INPUT} = " --input input file (if used)\n" ; -$Help{input} = -$Help{INPUT} . " =name : filename \n" ; -$Help{SUFFIX} = " --suffix resulting file suffix\n" ; -$Help{suffix} = -$Help{SUFFIX} . " =string : suffix \n" ; -$Help{RUNS} = " --runs maximum number of TeX runs \n" ; -$Help{runs} = -$Help{RUNS} . " =n : number of runs\n" ; -$Help{SILENT} = " --silent minimize (status) messages\n" ; -$Help{TEX} = " --tex TeX binary \n" ; -$Help{tex} = -$Help{TEX} . " =name : binary of executable \n" ; -$Help{VERBOSE} = " --verbose shows some additional info \n" ; -$Help{HELP} = " --help show this or more, e.g. '--help interface'\n" ; - -$Help{ALONE} = " --alone bypass utilities (e.g. fmtutil for non-standard fmt's)\n" ; -$Help{TEXUTIL} = " --texutil force TeXUtil run\n" ; -$Help{SETFILE} = " --setfile load environment (batch) file\n" ; +#### old help system + +# $Help{ARRANGE} = " --arrange process and arrange\n" ; +# $Help{BATCH} = " --batch run in batch mode (don't pause)\n" ; +# $Help{CENTERPAGE} = " --centerpage center the page on the paper\n" ; +# $Help{COLOR} = " --color enable color (when not yet enabled)\n" ; +# $Help{USEMODULE} = " --usemodule load some modules first\n" ; +# $Help{usemodule} = +# $Help{USEMODULE} . " =name : list of modules\n" ; +# $Help{XMLFILTER} = " --xmlfilter apply XML filter\n" ; +# $Help{xmlfilter} = +# $Help{XMLFILTER} . " =name : list of filters\n" ; +# $Help{ENVIRONMENT} = " --environment load some environments first\n" ; +# $Help{environment} = +# $Help{ENVIRONMENT} . " =name : list of environments\n" ; +# $Help{FAST} = " --fast skip as much as possible\n" ; +# $Help{FIGURES} = " --figures typeset figure directory\n" ; +# $Help{figures} = +# $Help{FIGURES} . " =a : room for corrections\n" +# . " =b : just graphics\n" +# . " =c : one (cropped) per page\n" +# . " --paperoffset room left at paper border\n" ; +# $Help{FINAL} = " --final add a final run without skipping\n" ; +# $Help{FORMAT} = " --format fmt file\n" ; +# $Help{format} = +# $Help{FORMAT} . " =name : format file (memory dump) \n" ; +# $Help{MPFORMAT} = " --mpformat mem file\n" ; +# $Help{mpformat} = +# $Help{MPFORMAT} . " =name : format file (memory dump) \n" ; +# $Help{INTERFACE} = " --interface user interface\n" ; +# $Help{interface} = +# $Help{INTERFACE} . " =en : English\n" +# . " =nl : Dutch\n" +# . " =de : German\n" +# . " =cz : Czech\n" +# . " =uk : Brittish\n" +# . " =it : Italian\n" ; +# $Help{LANGUAGE} = " --language main hyphenation language \n" ; +# $Help{language} = +# $Help{LANGUAGE} . " =xx : standard abbreviation \n" ; +# $Help{LISTING} = " --listing produce a verbatim listing\n" ; +# $Help{listing} = +# $Help{LISTING} . " --backspace inner margin of the page\n" . +# " --topspace top/bottom margin of the page\n" . +# " --pretty enable pretty printing\n" . +# " --color use color for pretty printing\n" ; +# $Help{MAKE} = " --make build format files \n" ; +# $Help{make} = +# $Help{MAKE} . " --language patterns to include\n" . +# " --bodyfont bodyfont to preload\n" . +# " --response response interface language\n" . +# " --format TeX format\n" . +# " --mpformat MetaPost format\n" . +# " --program TeX program\n" ; +# $Help{MODE} = " --mode running mode \n" ; +# $Help{mode} = +# $Help{MODE} . " =list : modes to set\n" ; +# $Help{MODULE} = " --module typeset tex/pl/mp module\n" ; +# $Help{MPTEX} = " --mptex run an MetaPost plus btex-etex cycle\n" ; +# $Help{MPXTEX} = " --mpxtex generatet an MetaPostmpx file\n" ; +# $Help{NOARRANGE} = " --noarrange process but ignore arrange\n" ; +# $Help{NOMP} = " --nomp don't run MetaPost at all\n" ; +# $Help{NOMPRUN} = " --nomprun don't run MetaPost at runtime\n" ; +# $Help{AUTOMPRUN} = " --automprun MetaPost at runtime when needed\n" ; +# $Help{ONCE} = " --once run TeX only once (no TeXUtil either)\n" ; +# $Help{OUTPUT} = " --output specials to use\n" ; +# $Help{output} = +# $Help{OUTPUT} . " =pdftex\n" +# . " =dvips\n" +# . " =dvipsone\n" +# . " =dviwindo\n" +# . " =dviview\n" +# . " =dvipdfm\n" ; +# $Help{PASSON} = ' --passon switches to pass to TeX ("--src" for MikTeX)' . "\n" ; +# $Help{PAGES} = " --pages pages to output\n" ; +# $Help{pages} = +# $Help{PAGES} . " =odd : odd pages\n" . +# " =even : even pages\n" . +# " =x,y:z : pages x and y to z\n" ; +# $Help{PAPER} = " --paper paper input and output format\n" ; +# $Help{paper} = +# $Help{PAPER} . " =a4a3 : A4 printed on A3\n" . +# " =a5a4 : A5 printed on A4\n" ; +# $Help{PATH} = " --path document source path\n" ; +# $Help{path} = +# $Help{PATH} . " =string : path\n" ; +# $Help{PDF} = " --pdf produce PDF directly using pdf(e)tex\n" ; +# $Help{PDFARRANGE} = " --pdfarrange arrange pdf pages\n" ; +# $Help{pdfarrange} = +# $Help{PDFARRANGE} . " --paperoffset room left at paper border\n" . +# " --paper paper format\n" . +# " --noduplex single sided\n" . +# " --backspace inner margin of the page\n" . +# " --topspace top/bottom margin of the page\n" . +# " --markings add cutmarks\n" . +# " --background =background graphic\n" . +# " --addempty add empty page after\n" . +# " --textwidth width of the original (one sided) text\n" ; +# $Help{PDFCOMBINE} = " --pdfcombine combine pages to one page\n" ; +# $Help{pdfcombine} = +# $Help{PDFCOMBINE} . " --paperformat paper format\n" . +# " --combination n*m pages per page\n" . +# " --paperoffset room left at paper border\n" ; +# $Help{PDFCOPY} = " --pdfcopy scale pages down/up\n" ; +# $Help{pdfcopy} = +# $Help{PDFCOPY} . " --scale new page scale\n" . +# " --paperoffset room left at paper border\n" . +# " --markings add cutmarks\n" . +# " --background =background graphic\n" ; +# $Help{PDFSELECT} = " --pdfselect select pdf pages\n" ; +# $Help{pdfselect} = +# $Help{PDFSELECT} . " --selection pages to select\n" . +# " =odd : odd pages\n" . +# " =even : even pages\n" . +# " =x,y:z : pages x and y to z\n" . +# " --paperoffset room left at paper border\n" . +# " --paperformat paper format\n" . +# " --backspace inner margin of the page\n" . +# " --topspace top/bottom margin of the page\n" . +# " --markings add cutmarks\n" . +# " --background =background graphic\n" . +# " --addempty add empty page after\n" . +# " --textwidth width of the original (one sided) text\n" ; +# $Help{PRINT} = " --print page imposition scheme\n" ; +# $Help{print} = +# $Help{PRINT} . " =up : 2 pages per sheet doublesided \n" . +# " =down : 2 rotated pages per sheet doublesided \n" ; +# $Help{RESULT} = " --result resulting file \n" ; +# $Help{result} = +# $Help{RESULT} . " =name : filename \n" ; +# $Help{INPUT} = " --input input file (if used)\n" ; +# $Help{input} = +# $Help{INPUT} . " =name : filename \n" ; +# $Help{SUFFIX} = " --suffix resulting file suffix\n" ; +# $Help{suffix} = +# $Help{SUFFIX} . " =string : suffix \n" ; +# $Help{RUNS} = " --runs maximum number of TeX runs \n" ; +# $Help{runs} = +# $Help{RUNS} . " =n : number of runs\n" ; +# $Help{SILENT} = " --silent minimize (status) messages\n" ; +# $Help{TEX} = " --tex TeX binary \n" ; +# $Help{tex} = +# $Help{TEX} . " =name : binary of executable \n" ; +# $Help{VERBOSE} = " --verbose shows some additional info \n" ; +# $Help{HELP} = " --help show this or more, e.g. '--help interface'\n" ; +# +# $Help{ALONE} = " --alone bypass utilities (e.g. fmtutil for non-standard fmt's)\n" ; +# $Help{TEXUTIL} = " --texutil force TeXUtil run\n" ; +# $Help{SETFILE} = " --setfile load environment (batch) file\n" ; +# +# if ($HelpAsked) +# { if (@ARGV) +# { foreach (@ARGV) { s/\-//go ; print "$Help{$_}\n" } } +# else +# { print $Help{ARRANGE} ; +# print $Help{BATCH} ; +# print $Help{CENTERPAGE} ; +# print $Help{COLOR} ; +# # print $Help{CONVERT} ; +# print $Help{INPUT} ; +# print $Help{USEMODULE} ; +# print $Help{XMLFILTER} ; +# print $Help{ENVIRONMENT} ; +# print $Help{FAST} ; +# print $Help{FIGURES} ; +# print $Help{FINAL} ; +# print $Help{FORMAT} ; +# print $Help{INTERFACE} ; +# print $Help{LISTING} ; +# print $Help{LANGUAGE} ; +# print $Help{MAKE} ; +# print $Help{MODE} ; +# print $Help{MODULE} ; +# print $Help{MPTEX} ; +# print $Help{MPXTEX} ; +# print $Help{NOARRANGE} ; +# print $Help{NOMP} ; +# print $Help{NOMPRUN} ; +# print $Help{AUTOMPRUN} ; +# print $Help{ONCE} ; +# print $Help{OUTPUT} ; +# print $Help{PAGES} ; +# print $Help{PAPER} ; +# print $Help{PASSON} ; +# print $Help{PATH} ; +# print $Help{PDFARRANGE} ; +# print $Help{PDFCOMBINE} ; +# print $Help{PDFCOPY} ; +# print $Help{PDFSELECT} ; +# print $Help{PDF} ; +# print $Help{PRINT} ; +# print $Help{RESULT} ; +# print $Help{SUFFIX} ; +# print $Help{RUNS} ; +# print $Help{SILENT} ; +# print $Help{TEX} ; +# print $Help{VERBOSE} ; +# print $Help{ALONE} ; +# print $Help{TEXUTIL} ; +# print $Help{SETFILE} ; +# print "\n" ; +# print $Help{HELP} ; +# print "\n" } +# exit 0 } + +#### new help system, written by Wybo Dekker + +# Sub-option + +struct Subopt => + { desc => '$' , # description + vals => '%' } ; # assignable values + +# Main option + +struct Opt => + { desc => '$' , # desciption + vals => '%' , # assignable values + subs => '%' } ; # suboptions + +# read a main option plus its +# description, +# assignable values and +# sub-options and their +# description and +# assignable values + +sub read_options + { $recurse++ ; + my $v = shift; + chomp ; + my $opt = $recurse ? Subopt->new() : Opt->new() ; + $opt->desc($v) ; + + while(@opts) + { $_ = shift @opts ; + if (/^--+/) + { unshift @opts, $_ if $recurse ; last } + if ($recurse && !/^=/) + { unshift @opts, $_ ; last } + chomp ; + my ($kk,$vv) = split(/\s+/,$_,2); # was \t + $vv||='' ; + if (/^=/) + { $opt->vals($kk,$vv) } + elsif (!$recurse) + { $opt->subs($kk,read_options($vv)) } } + $recurse-- ; + $opt } + +my $helpdone = 0 ; + +sub print_opt + { my ($k,$opt)=@_ ; + if ($helpdone) { $shorthelp or print "\n" } $helpdone = 1 ; # hh + $~ = 'H1' ; + write ; + return if $shorthelp<0 ; + for $k (sort keys %{$opt->vals}) {print_val($k,${$opt->vals}{$k}) } + return if $shorthelp>0 ; + for $k (sort keys %{$opt->subs}) {print_subopt($k,${$opt->subs}{$k}) } +format H1 = +@>>>>>>>>>>>>>>>>>>>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +"--$k",$opt->desc +. + } + +sub print_subopt + { my ($k,$opt) = @_ ; + $~ = 'H3' ; + write ; + for $k (sort keys %{$opt->vals}) + {print_val($k,${$opt->vals}{$k}) } +format H3 = +@>>>>>>>>>>>>>>>>>>>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +"--$k",$opt->desc +. + } + +sub print_val + { my ($k,$opt) = @_ ; + $~ = 'H2' ; write ; +format H2 = + @<<<<<<< : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$k,$opt +. + } + +# read all options + +$recurse-- ; +@opts = <DATA> ; +while(@opts) + { $_ = shift @opts ; + last if /^--+/ ; + my ($k,$v) = split(/\s+/,$_,2); # was \t + $Help{$k} = read_options($v) } + +# help to help + +sub show_help_options + { print # "\n" . + " --help overview of all options and their values\n" . + " --help all all about all options\n" . + " --help short just the main options\n" . + " --help mode ... pdf all about a few options\n" . + " --help '*.pdf' all about options containing 'pdf'\n" } ; + +# determine what user wants to see if ($HelpAsked) - { if (@ARGV) - { foreach (@ARGV) { s/\-//go ; print "$Help{$_}\n" } } - else - { print $Help{ARRANGE} ; - print $Help{BATCH} ; - print $Help{CENTERPAGE} ; - print $Help{COLOR} ; -# print $Help{CONVERT} ; - print $Help{INPUT} ; - print $Help{USEMODULE} ; - print $Help{XMLFILTER} ; - print $Help{ENVIRONMENT} ; - print $Help{FAST} ; - print $Help{FIGURES} ; - print $Help{FINAL} ; - print $Help{FORMAT} ; - print $Help{INTERFACE} ; - print $Help{LISTING} ; - print $Help{LANGUAGE} ; - print $Help{MAKE} ; - print $Help{MODE} ; - print $Help{MODULE} ; - print $Help{MPTEX} ; - print $Help{MPXTEX} ; - print $Help{NOARRANGE} ; - print $Help{NOMP} ; - print $Help{NOMPRUN} ; - print $Help{AUTOMPRUN} ; - print $Help{ONCE} ; - print $Help{OUTPUT} ; - print $Help{PAGES} ; - print $Help{PAPER} ; - print $Help{PASSON} ; - print $Help{PATH} ; - print $Help{PDFARRANGE} ; - print $Help{PDFCOMBINE} ; - print $Help{PDFCOPY} ; - print $Help{PDFSELECT} ; - print $Help{PDF} ; - print $Help{PRINT} ; - print $Help{RESULT} ; - print $Help{SUFFIX} ; - print $Help{RUNS} ; - print $Help{SILENT} ; - print $Help{TEX} ; - print $Help{VERBOSE} ; - print $Help{ALONE} ; - print $Help{TEXUTIL} ; - print $Help{SETFILE} ; - print "\n" ; - print $Help{HELP} ; - print "\n" } - exit 0 } + { $shorthelp = 0 ; + @help = (sort keys %Help) ; + if ("@ARGV" eq "all") + { # everything + } + elsif ("@ARGV" eq "short") + { # nearly everything + $shorthelp-- } + elsif ("@ARGV" eq "help") + { # help on help + show_help_options ; + exit } + elsif (@ARGV) + { # one or a few options, completely + my @h=@ARGV ; + @help = () ; + for (@h) + { # print "testing $_\n"; + # next if (/^[\*\?]/) ; # HH, else error + if (/^[\*\?]/) { $_ = ".$_" } # HH, else error + $Help{$_} and push(@help,$_) or do + { my $unknown = $_ ; + for (keys %Help) + { /$unknown/ and push(@help,$_) } } } } + else + { # all main option and their assignable values + $shorthelp++ } } + +sub show_help_info + { map { print_opt($_,$Help{$_}) } @help } + +# uncomment this to see the structure of a Help element: +# print Dumper($Help{pdfselect}); + +#### end of help system my $FinalRunNeeded = 0 ; @@ -792,9 +940,9 @@ sub MPJobName { my $JobName = shift ; my $MPfile = shift ; my $MPJobName = '' ; - if (-s "$JobName-$MPfile.mp">50) + if (-s "$JobName-$MPfile.mp">100) { $MPJobName = "$JobName-$MPfile.mp" } - elsif (-s "$MPfile.mp">50) + elsif (-s "$MPfile.mp">100) { $MPJobName = "$MPfile.mp" } else { $MPJobName = "" } @@ -804,14 +952,12 @@ sub RunPerlScript { my ($ScriptName, $Options) = @_ ; if ($dosish) # { if (-e "$TeXScriptsPath$ScriptName.pl") - { # print "$TeXScriptsPath$ScriptName$own_type" ; - if (-e "$TeXScriptsPath$ScriptName$own_type") + { if (-e "$TeXScriptsPath$ScriptName$own_type") # { system ("perl $TeXScriptsPath$ScriptName.pl $Options") } } { system ("$own_stub$TeXScriptsPath$ScriptName$own_type $Options") } } else { system ("$ScriptName $Options") } } - sub ConvertXMLFile { my $FileName = shift ; RunPerlScript($SGMLtoTeX, "$FileName.xml") } @@ -841,9 +987,7 @@ sub CheckOutputFormat sub MakeOptionFile { my ($FinalRun, $FastDisabled, $JobName, $JobSuffix) = @_ ; - unless (open (OPT, ">$JobName.top")) - { print " problem with writing : $JobName.top\n" ; - open (OPT, ">$JobName-opt.log") } + open (OPT, ">$JobName.top") ; print OPT "\\unprotect\n" ; if ($Result) # no '' test { print OPT "\\setupsystem[file=$Result]\n" } @@ -1018,24 +1162,24 @@ sub CompareFiles # 2 = tuo { return 0 } } sub CheckPositions - { return if ($DVIspec eq '') ; - my $JobName = shift ; my $TuoName = "$JobName.tuo" ; - if (open(POS,"$TuoName")) - { seek POS, (-s $TuoName) - 5000, 0 ; - while (<POS>) - { if (/\% *position commands *\: *(\d*) *\(unresolved\)/io) - { if ($1) - { print " dvi positions : $1 ($DVIspec ." ; - close (POS) ; - open(POS,">>$TuoName") ; - $ENV{uc "$DVIspec.TEXFONTSDIR"} = $TeXFontsPath ; - print POS "\%\n\% extracted from dvi file by $DVIspec:\n\%\n" ; - close(POS) ; - print "." ; - RunPerlScript ($DVIspec, "$JobName >> $TuoName") ; - print ".)\n" } - last } } - close (POS) } } + { return if ($DVIspec eq '') ; + my $JobName = shift ; my $TuoName = "$JobName.tuo" ; + if (open(POS,"$TuoName")) + { seek POS, (-s $TuoName) - 5000, 0 ; + while (<POS>) + { if (/\% *position commands *\: *(\d*) *\(unresolved\)/io) + { if ($1) + { print " dvi positions : $1 ($DVIspec ." ; + close (POS) ; + open(POS,">>$TuoName") ; + $ENV{uc "$DVIspec.TEXFONTSDIR"} = $TeXFontsPath ; + print POS "\%\n\% extracted from dvi file by $DVIspec:\n\%\n" ; + close(POS) ; + print "." ; + RunPerlScript ($DVIspec, "$JobName >> $TuoName") ; + print ".)\n" } + last } } + close (POS) } } # my @ExtraPrograms = () ; # @@ -1406,10 +1550,10 @@ sub RunModule next unless $Suffix =~ /(tex|mp|pl|pm)/io ; DoRunModule($Name, $Suffix) } } -# the next one can be more efficient: directly process ted +# the next one can be more efficient: directly process ted # file a la --use=abr-01,mod-01 -sub DoRunModule +sub DoRunModule { my ($FileName,$FileSuffix) = @_ ; RunPerlScript ($TeXUtil, "--documents $FileName.$FileSuffix" ) ; print " module : $FileName\n\n" ; @@ -1759,7 +1903,7 @@ sub RunFormats { if ($Interface eq $MetaFun) { RunMpFormat ($MetaFun) ; $MetaFunDone = 1 } elsif ($Interface eq $MpToPdf) - { RunOneFormat ("$MpToPdf") } + { if ($TeXExecutable =~ /pdf/io) { RunOneFormat ("$MpToPdf") } } else { RunOneFormat ("$ConTeXtFormatsPrefix$Interface") } } # @@ -1913,8 +2057,8 @@ $TexFound = $MergeBE || /btex .*? etex/o ; if ($MergeBE) { s/beginfig\s*\((\d+)\)\s*\;/beginfig($1)\;\n$mpbetex{$1}\n/goims } # flush - unless (/beginfig\s*\(\s*0\s*\)/gmois) - { print MP $mpbetex{0} } + unless (/beginfig\s*\(\s*0\s*\)/gmois) + { print MP $mpbetex{0} } print MP $_ ; print MP "end .\n" ; close(MP) } @@ -2010,14 +2154,16 @@ if ($SetFile ne "") { load_set_file ($SetFile,$Verbose) } # todo : more consistent argv handling -# -# sub ifargs -# { $problems = (@ARGV==0) ; +# +# sub ifargs +# { $problems = (@ARGV==0) ; # if ($problems) # { print " warning : nothing to do\n" } -# return $problems } +# return $problems } -if ($TypesetListing) + if ($HelpAsked) + { show_help_info } +elsif ($TypesetListing) { RunListing (@ARGV) } elsif ($TypesetFigures) { RunFigures (@ARGV) } @@ -2031,15 +2177,187 @@ elsif ($MakeFormats) else { RunFormats } } elsif (@ARGV) - { @ARGV = <@ARGV> ; -foreach (@ARGV) { s/\\/\//goi } - RunFiles } -else - { print $Help{HELP} ; - unless ($Verbose) { print $Help{VERBOSE} } } - + { @ARGV = <@ARGV> ; RunFiles } +# else +# { # print $Help{HELP} ; +# # unless ($Verbose) { print $Help{VERBOSE} } } +elsif (!$HelpAsked) + { show_help_options } + $TotalTime = time - $TotalTime ; -print "\n total run time : $TotalTime seconds\n" ; +unless ($HelpAsked) + { print "\n total run time : $TotalTime seconds\n" } if ($Problems) { exit 1 } + +__DATA__ +arrange process and arrange +----------- +batch run in batch mode (don't pause) +----------- +centerpage center the page on the paper +----------- +color enable color (when not yet enabled) +----------- +usemodule load some modules first +=name list of modules +----------- +xmlfilter apply XML filter +=name list of filters +----------- +environment load some environments first +=name list of environments +----------- +fast skip as much as possible +----------- +figures typeset figure directory +=a room for corrections +=b just graphics +=c one (cropped) per page +paperoffset room left at paper border +----------- +final add a final run without skipping +----------- +format fmt file +=name format file (memory dump) +----------- +mpformat mem file +=name format file (memory dump) +----------- +interface user interface +=en English +=nl Dutch +=de German +=cz Czech +=uk Brittish +=it Italian +----------- +language main hyphenation language +=xx standard abbreviation +----------- +listing produce a verbatim listing +backspace inner margin of the page +topspace top/bottom margin of the page +pretty enable pretty printing +color use color for pretty printing +----------- +make build format files +language patterns to include +bodyfont bodyfont to preload +response response interface language +format TeX format +mpformat MetaPost format +program TeX program +----------- +mode running mode +=list modes to set +----------- +module typeset tex/pl/mp module +----------- +mptex run an MetaPost plus btex-etex cycle +----------- +mpxtex generatet an MetaPostmpx file +----------- +noarrange process but ignore arrange +----------- +nomp don't run MetaPost at all +----------- +nomprun don't run MetaPost at runtime +----------- +automprun MetaPost at runtime when needed +----------- +once run TeX only once (no TeXUtil either) +----------- +output specials to use +=pdftex Han The Than's pdf backend +=dvips Thomas Rokicky's dvi to ps converter +=dvipsone YandY's dvi to ps converter +=dviwindo YandY's windows previewer +=dvipdfm Mark Wicks' dvi to pdf converter +----------- +passon switches to pass to TeX (--src for MikTeX) +----------- +pages pages to output +=odd odd pages +=even even pages +=x,y:z pages x and y to z +----------- +paper paper input and output format +=a4a3 A4 printed on A3 +=a5a4 A5 printed on A4 +----------- +path document source path +=string path +----------- +pdf produce PDF directly using pdf(e)tex +----------- +pdfarrange arrange pdf pages +paperoffset room left at paper border +paper paper format +noduplex single sided +backspace inner margin of the page +topspace top/bottom margin of the page +markings add cutmarks +background +=string background graphic +addempty add empty page after +textwidth width of the original (one sided) text +----------- +pdfcombine combine pages to one page +paperformat paper format +combination n*m pages per page +paperoffset room left at paper border +----------- +pdfcopy scale pages down/up +scale new page scale +paperoffset room left at paper border +markings add cutmarks +background +=string background graphic +----------- +pdfselect select pdf pages +selection pages to select +=odd odd pages +=even even pages +=x,y:z pages x and y to z +paperoffset room left at paper border +paperformat paper format +backspace inner margin of the page +topspace top/bottom margin of the page +markings add cutmarks +background +=string background graphic +addempty add empty page after +textwidth width of the original (one sided) text +----------- +print page imposition scheme +=up 2 pages per sheet doublesided +=down 2 rotated pages per sheet doublesided +----------- +result resulting file +=name filename +----------- +input input file (if used) +=name filename +----------- +suffix resulting file suffix +=string suffix +----------- +runs maximum number of TeX runs +=n number of runs +----------- +silent minimize (status) messages +----------- +tex TeX binary +=name binary of executable +----------- +verbose shows some additional info +----------- +help show this or more, e.g. '--help interface' +----------- +alone bypass utilities (e.g. fmtutil for non-standard fmt's) +----------- +texutil force TeXUtil run +----------- +setfile load environment (batch) file diff --git a/context/perltk/texutil.pl b/context/perltk/texutil.pl index 34a0f6eda..b7c9d4ddd 100644 --- a/context/perltk/texutil.pl +++ b/context/perltk/texutil.pl @@ -1007,7 +1007,8 @@ BEGIN # $pm_path =~ s/texutil\.pl.*// } $pm_path = $0 ; $pm_path =~ s/\\/\//o ; - $pm_path =~ s/texutil\.pl.*//io ; + # $pm_path =~ s/texutil\.pl.*//io ; + $pm_path =~ s/(.*)texutil.*?$/$1/i ; if ($pm_path eq "") { $pm_path = "./" } } use lib $pm_path ; diff --git a/metapost/context/mp-core.mp b/metapost/context/mp-core.mp index 0c409264f..918838e33 100644 --- a/metapost/context/mp-core.mp +++ b/metapost/context/mp-core.mp @@ -316,6 +316,154 @@ def do_initialize_par (expr fpos, tpos, mpos, ppos, rw,rl,rr,rh,ra,ri) = enddef ; +if unknown TopSkip : TopSkip := 0 fi ; +if unknown StrutHeight : StrutHeight := 0 fi ; + +pair last_multi_par_shift ; last_multi_par_shift := origin ; + +def relocate_multipars (expr xy) = + last_multi_par_shift := xy ; + for i=1 upto nofmultipars : + multipars[i] := multipars[i] shifted last_multi_par_shift ; + endfor ; +enddef ; + +boolean compensate_multi_par_topskip ; +compensate_multi_par_topskip := true ; + +boolean span_multi_column_pars ; +span_multi_column_pars := false ; + +vardef multi_par_at_top (expr i) = + (round (ypart ulcorner multipars[i]) = round (ypart ulcorner + (TextAreas[multirefs[i]] shifted last_multi_par_shift))) +enddef ; + +def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, + tn,tx,ty,tw,th,td, + wn,wx,wy,ww,wh,wd, + pn,px,py,pw,ph,pd, + rw,rl,rr,rh,ra,ri) = + + if span_multi_column_pars : + begingroup ; + save TextAreas ; path TextAreas[] ; + save NOfTextAreas ; numeric NOfTextAreas ; + for i=1 upto NOfTextColumns : + TextAreas[i] := TextColumns[i] ; + endfor ; + NOfTextAreas := NOfTextColumns ; + fi ; + + last_multi_par_shift := origin ; + + % rh/ra/ri not yet supported + + numeric fpos ; fpos := 1 ; initialize_box_pos(fpos,fn,fx,fy,fw,fh,fd) ; + numeric tpos ; tpos := 2 ; initialize_box_pos(tpos,tn,tx,ty,tw,th,td) ; + numeric wpos ; wpos := 3 ; initialize_box_pos(wpos,wn,wx,wy,ww,wh,wd) ; + numeric ppos ; ppos := 4 ; initialize_box_pos(ppos,pn,px,py,pw,ph,pd) ; + + numeric par_strut_height, par_strut_depth, par_line_height ; + + par_strut_height := ph ; + par_strut_depth := pd ; + par_line_height := ph + pd ; + + if wxy[wpos]>0 : + left_skip := rl + xpart llxy[wpos] - xpart llxy[ppos] ; + right_skip := rw - left_skip - ww ; + else : + left_skip := rl ; + right_skip := rr ; + fi ; + + path multipar, multipars[] ; + numeric multiref, multirefs[] ; + numeric multiloc, multilocs[] ; % 1=begin 2=between 3=end + + ii := 0 ; nn := NOfTextAreas+1 ; nofmultipars := 0 ; + + def set_multipar (expr i) = + ((TextAreas[i] leftenlarged -left_skip) rightenlarged -right_skip) + enddef ; + + def save_multipar (expr i, l, p) = + nofmultipars := nofmultipars + 1 ; + multirefs[nofmultipars] := i ; + multilocs[nofmultipars] := l ; + multipars[nofmultipars] := unspiked simplified p ; + enddef ; + + for i=1 upto NOfTextAreas : + multipar := set_multipar(i) ; + if (nxy[fpos]=RealPageNumber) and (InsideTextArea(i,llxy[fpos])) : + % first one in chain + ii := i ; + if (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,llxy[tpos])) : + nn := i ; + + if compensate_multi_par_topskip : + TopSkipCorrection := TopSkip - StrutHeight ; + + if round(ypart ulxy[fpos] + TopSkipCorrection) = + round(ypart ulcorner TextAreas[i]) : + ulxy[fpos] := ulxy[fpos] shifted (0,TopSkipCorrection) ; + urxy[fpos] := urxy[fpos] shifted (0,TopSkipCorrection) ; + fi ; + fi ; + + if ypart llxy[fpos] = ypart llxy[tpos] : + multipar := llxy[fpos] -- + lrxy[tpos] -- + urxy[tpos] -- + ulxy[fpos] -- + cycle ; + else : + multipar := (xpart llcorner multipar, ypart llxy[tpos]) -- + llxy[tpos] -- + ulxy[tpos] -- + (xpart lrcorner multipar, ypart ulxy[tpos]) -- + (xpart urcorner multipar, ypart urxy[fpos]) -- + urxy[fpos] -- + lrxy[fpos] -- + (xpart ulcorner multipar, ypart lrxy[fpos])-- + cycle ; + fi ; + else : + multipar := llcorner multipar -- + lrcorner multipar -- + (xpart lrcorner multipar, ypart urxy[fpos]) -- + urxy[fpos] -- + lrxy[fpos] -- + (xpart ulcorner multipar, ypart lrxy[fpos])-- cycle ; + fi ; + save_multipar (i,1,multipar) ; + elseif (nxy[tpos]=RealPageNumber) and (InsideTextArea(i,llxy[tpos])) : + % last one in chain + nn := i ; + multipar := ulcorner multipar -- + urcorner multipar -- + (xpart lrcorner multipar, ypart urxy[tpos]) -- + ulxy[tpos] -- + llxy[tpos] -- + (xpart llcorner multipar, ypart llxy[tpos]) -- + cycle ; + save_multipar (i,3,multipar) ; + fi ; + endfor ; + + for i=ii+1 upto nn-1 : + % rest of chain + save_multipar(i,2,set_multipar(i)) ; + endfor ; + + if span_multi_column_pars : + endgroup ; + fi ; + +enddef ; + color boxgridcolor ; boxgridcolor := .8red ; color boxlinecolor ; boxlinecolor := .8blue ; color boxfillcolor ; boxfillcolor := .8white ; @@ -347,13 +495,14 @@ def draw_par = % 1 2 11 endfor ; enddef ; +def do_show_par (expr p, r, c) = + if length(p) > 2 : for i=0 upto length(p) : + draw fullcircle scaled r shifted point i of p + withpen pencircle scaled .5pt withcolor c ; + endfor ; fi ; +enddef ; + def show_par = - def do_show_par (expr p, r, c) = - if length(p) > 2 : for i=0 upto length(p) : - draw fullcircle scaled r shifted point i of p - withpen pencircle scaled .5pt withcolor c ; - endfor ; fi ; - enddef ; if length(mxy) > 2 : draw mxy dashed evenly withpen pencircle scaled .5pt withcolor .5white ; @@ -364,6 +513,25 @@ def show_par = draw pref withpen pencircle scaled 2pt ; enddef ; +def draw_multi_pars = + for i=1 upto nofmultipars : + do_draw_par(multipars[i]) ; + if boxgridtype= 1 : + draw baseline_grid (multipars[i],boxgriddirection,true ) withcolor boxgridcolor ; + elseif boxgridtype= 2 : + draw baseline_grid (multipars[i],boxgriddirection,false) withcolor boxgridcolor ; + elseif boxgridtype=11 : + draw graphic_grid(multipars[i],distance,distance,distance/2,distance/2) ; + fi ; + endfor ; +enddef ; + +def show_multi_pars = + for i=1 upto nofmultipars : + do_show_par(multipars[i], 6pt, .5blue) ; + endfor ; +enddef ; + vardef do_draw_par (expr p) = if (length p>2) and (bbwidth(p)>1) and (bbheight(p)>1) : save pp ; path pp ; diff --git a/metapost/context/mp-page.mp b/metapost/context/mp-page.mp index 4dfdb1634..035b65bd6 100644 --- a/metapost/context/mp-page.mp +++ b/metapost/context/mp-page.mp @@ -31,6 +31,150 @@ if unknown InPageBody : boolean InPageBody ; InPageBody := false ; fi ; +def SaveTextAreas = + path SavedTextAreas [] ; + path SavedTextColumns[] ; + numeric NOfSavedTextAreas ; + numeric NOfSavedTextColumns ; + for i=1 upto NOfTextAreas : + SavedTextAreas[i] := TextAreas[i] ; + endfor ; + for i=1 upto NOfTextColumns : + SavedTextColumns[i] := TextColumns[i] ; + endfor ; + NOfSavedTextAreas := NOfTextAreas ; + NOfSavedTextColumns := NOfTextColumns ; +enddef ; + +def ResetTextAreas = + path TextAreas[], TextColumns[]; + numeric NOfTextAreas ; NOfTextAreas := 0 ; + numeric NOfTextColumns ; NOfTextColumns := 0 ; +enddef ; + +ResetTextAreas ; SaveTextAreas ; + +def RegisterTextArea (expr x, y, w, h, d) = + begingroup ; save p ; path p ; + p := unitsquare xyscaled(w,h+d) shifted (x,y-d) ; + if NOfTextAreas>0 : + % if needed, concatenate areas + if (round(llcorner TextAreas[NOfTextAreas]) = round(ulcorner p)) and + (round(lrcorner TextAreas[NOfTextAreas]) = round(urcorner p)) : + p := ulcorner TextAreas[NOfTextAreas] -- + urcorner TextAreas[NOfTextAreas] -- + lrcorner p -- + llcorner p -- + cycle ; + else : + NOfTextAreas := NOfTextAreas + 1 ; + fi ; + else : + NOfTextAreas := NOfTextAreas + 1 ; + fi ; + TextAreas[NOfTextAreas] := p ; + if NOfTextColumns>0 : + if (round(xpart llcorner TextColumns[NOfTextColumns]) = round(xpart ulcorner p)) and + (round(xpart lrcorner TextColumns[NOfTextColumns]) = round(xpart urcorner p)) : + p := ulcorner TextColumns[NOfTextColumns] -- + urcorner TextColumns[NOfTextColumns] -- + lrcorner p -- + llcorner p -- + cycle ; + else : + NOfTextColumns := NOfTextColumns + 1 ; + fi ; + else : + NOfTextColumns := NOfTextColumns + 1 ; + fi ; + TextColumns[NOfTextColumns] := p ; + endgroup ; +enddef ; + +vardef InsideTextArea (expr _i_, _xy_) = + ( (round(xpart _xy_) >= round(xpart llcorner TextAreas[_i_])) and + (round(xpart _xy_) <= round(xpart lrcorner TextAreas[_i_])) and + (round(ypart _xy_) >= round(ypart llcorner TextAreas[_i_])) and + (round(ypart _xy_) <= round(ypart urcorner TextAreas[_i_])) ) +enddef ; + +vardef InsideSavedTextArea (expr _i_, _xy_) = + ( (round(xpart _xy_) >= round(xpart llcorner SavedTextAreas[_i_])) and + (round(xpart _xy_) <= round(xpart lrcorner SavedTextAreas[_i_])) and + (round(ypart _xy_) >= round(ypart llcorner SavedTextAreas[_i_])) and + (round(ypart _xy_) <= round(ypart urcorner SavedTextAreas[_i_])) ) +enddef ; + +vardef TextAreaX (expr x) = + numeric _TextAreaX_ ; _TextAreaX_ := 0 ; + for i := 1 upto NOfTextAreas : + if (round(x) >= round(xpart llcorner TextAreas[i])) and + (round(x) <= round(xpart lrcorner TextAreas[i])) : + _TextAreaX_ := xpart llcorner TextAreas[i] ; + fi ; + endfor ; + _TextAreaX_ +enddef ; + +vardef TextAreaY (expr y) = + numeric _TextAreaY_ ; _TextAreaY_ := 0 ; + for i := 1 upto NOfTextAreas : + if (round(y) >= round(ypart llcorner TextAreas[NOfTextAreas])) and + (round(y) <= round(ypart ulcorner TextAreas[NOfTextAreas])) : + _TextAreaY_ := ypart llcorner TextAreas[NOfTextAreas] ; + fi ; + endfor ; + _TextAreaY_ +enddef ; + +vardef TextAreaXY (expr x, y) = + pair _TextAreaXY_ ; _TextAreaXY_ := origin ; + for i := 1 upto NOfTextAreas : + if (round(x) >= round(xpart llcorner TextAreas[i])) and + (round(x) <= round(xpart lrcorner TextAreas[i])) and + (round(y) >= round(ypart llcorner TextAreas[i])) and + (round(y) <= round(ypart ulcorner TextAreas[i])) : + _TextAreaXY_ := llconer TextAreas[i] ; + fi ; + endfor ; + _TextAreaXY_ +enddef ; + +vardef TextAreaW (expr x) = + numeric _TextAreaW_ ; _TextAreaW_ := 0 ; + for i := 1 upto NOfTextAreas : + if (round(x) >= round(xpart llcorner TextAreas[i])) and + (round(x) <= round(xpart lrcorner TextAreas[i])) : + _TextAreaW_ := bbwidth(TextAreas[i]) ; + fi ; + endfor ; + _TextAreaW_ +enddef ; + +vardef TextAreaH (expr y) = + numeric _TextAreaH_ ; _TextAreaH_ := 0 ; + for i := 1 upto NOfTextAreas : + if (round(y) >= round(ypart llcorner TextAreas[i])) and + (round(y) <= round(ypart ulcorner TextAreas[i])) : + _TextAreaH_ := bbheight(TextAreas[i]) ; + fi ; + endfor ; + _TextAreaH_ +enddef ; + +vardef TextAreaWH (expr x, y) = + pair _TextAreaWH_ ; _TextAreaWH_ := origin ; + for i := 1 upto NOfTextAreas : + if (round(x) >= round(xpart llcorner TextAreas[i])) and + (round(x) <= round(xpart lrcorner TextAreas[i])) and + (round(y) >= round(ypart llcorner TextAreas[i])) and + (round(y) <= round(ypart ulcorner TextAreas[i])) : + _TextAreaWH_ := (bbwidth(TextAreas[i]),bbheight(TextAreas[i])) ; + fi ; + endfor ; + _TextAreaWH_ +enddef ; + PageNumber := 0 ; PaperHeight := 845.04684pt ; PaperWidth := 597.50787pt ; diff --git a/metapost/context/mp-spec.mp b/metapost/context/mp-spec.mp index 93a36a4eb..05f5cecad 100644 --- a/metapost/context/mp-spec.mp +++ b/metapost/context/mp-spec.mp @@ -158,17 +158,19 @@ fi ; newinternal shadefactor ; shadefactor := 1 ; +pair shadeoffset ; shadeoffset := origin ; + vardef define_linear_shade (expr a, b, ca, cb) = flush_special(30, 15, "0 1 " & decimal shadefactor & " " & - dddecimal ca & ddecimal a & - dddecimal cb & ddecimal b ) ; + dddecimal ca & ddecimal (a shifted shadeoffset) & + dddecimal cb & ddecimal (b shifted shadeoffset) ) ; _special_counter_ enddef ; vardef define_circular_shade (expr a, b, ra, rb, ca, cb) = flush_special(31, 17, "0 1 " & decimal shadefactor & " " & - dddecimal ca & ddecimal a & " " & decimal ra & - dddecimal cb & ddecimal b & " " & decimal rb ) ; + dddecimal ca & ddecimal (a shifted shadeoffset) & " " & decimal ra & + dddecimal cb & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ; _special_counter_ enddef ; diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex index 269f17318..f88d3b094 100644 --- a/tex/context/base/colo-ini.tex +++ b/tex/context/base/colo-ini.tex @@ -237,7 +237,7 @@ \def\colorCpattern{C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k:\@@cl@@A:\@@cl@@t} \def\colorRpattern{R:\@@cl@@r:\@@cl@@g:\@@cl@@b:\@@cl@@A:\@@cl@@t} -\def\definecolor% +\def\definecolor {\dodoubleargument\dodefinecolor} \def\dodefinecolor[#1][#2]% @@ -399,7 +399,7 @@ \fi \else \@EAEAEA#1\csname\??cr\currentpalet#2\endcsname\od - \fi\fi + \fi \fi\fi} \endTEX @@ -901,7 +901,7 @@ \expandafter\noglobalstartcolor \fi} -\def\stopcolor% +\def\stopcolor {\ifincolor \doglobalstopcolor \else @@ -981,6 +981,9 @@ \else \doifcolorelse\previouscolor {\ifx\currentcolor\previouscolor\else + % alternatively we could let \startcolormode handle this + \dostoptransparency % really needed + % \dostopcolormode % less safe but more efficient \startcolormode\previouscolor \fi} {\dostoptransparency @@ -1258,8 +1261,8 @@ \def\doformatgray#1:% {\getvalue{doformatgray#1}} -\def\grayvalue% - {\dowithcolor\doformatgray} +\def\grayvalue + {\dowithcolor\doformatgray} %D \macros %D {localstartraster,localstopraster, @@ -1281,11 +1284,8 @@ \def\localstopraster {\dostopgraymode} -\def\startraster - {\localstartraster} - -\def\stopraster - {\localstopraster} +\let\startraster\localstartraster +\let\stopraster \localstopraster %D In this documentation we will not go into too much details %D on palets. Curious users can find more information on this @@ -1727,6 +1727,14 @@ \else 0% \fi\fi\fi]} +%D \macros +%D {everyshapebox} +%D +%D A terrible hack, needed because we cannot have marks in +%D shape boxes. + +\appendtoks \localcolortrue \to \everyshapebox + %D We default to the colors defined in \module{colo-rgb} and %D support both \kap{RGB} and \kap{CMYK} output. diff --git a/tex/context/base/cont-de.tex b/tex/context/base/cont-de.tex index 2e410fd54..9e75bc0cf 100644 --- a/tex/context/base/cont-de.tex +++ b/tex/context/base/cont-de.tex @@ -27,6 +27,7 @@ \installlanguage [\s!fr] [\c!status=\v!start] \installlanguage [\s!es] [\c!status=\v!start] \installlanguage [\s!nl] [\c!status=\v!start] +\installlanguage [\s!it] [\c!status=\v!start] \installlanguage [deo] [\c!status=\v!start] diff --git a/tex/context/base/cont-en.tex b/tex/context/base/cont-en.tex index a0ff80769..bfd38e7ea 100644 --- a/tex/context/base/cont-en.tex +++ b/tex/context/base/cont-en.tex @@ -26,6 +26,7 @@ \installlanguage [\s!de] [\c!status=\v!start] \installlanguage [\s!fr] [\c!status=\v!start] \installlanguage [\s!es] [\c!status=\v!start] +\installlanguage [\s!it] [\c!status=\v!start] \installlanguage [\s!nl] [\c!status=\v!start] \setupbodyfont [cmr,rm,12pt] diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index cad90244f..1ebd70ba1 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -20,6 +20,30 @@ \unprotect +% we don't register the paragraph characteristics, only the +% width + +\appendtoks + \setinnerparpositions % see "techniek" for application +\to \everytabulate + +\def\OTRSETnaturalflush + {\bgroup + \forgetall % new + \setbox0\vbox to \columnfreecells\lineheight + {\vskip-\topskip + \vskip\lineheight + \prevdepth\dp\strutbox + \unvbox\normalpagebox + \vfill}% + \setbox2\hbox + {\OTRSETplacebottomnotes}% + \setbox\scratchbox\hbox + {\wd0=\zeropoint\box0\box2}% + \dp\scratchbox\dp\strutbox + \OTRSEThandleflushedtext1 + \egroup} + \appendtoks \checkcurrentlayout \to \everystarttext \def\flushfootnotes {\flushnotes} @@ -140,11 +164,13 @@ \boxhasheighttrue \!!heighta\localheight \fi\fi + % this should be an option ! ! ! ! \ifdim\!!widtha=\hsize \parindent\zeropoint \setlocalhsize \!!widtha\localhsize \fi + % i.e. disable (colsetbackgroundproblemintechniek) \advance\!!widtha -2\@@localoffset \advance\!!heighta -2\@@localoffset \ifx\localstrut\v!nee @@ -268,6 +294,28 @@ \egroup \egroup} +%D This alternative is slower, since it works on top of the +%D color (stack) mechanism, but it does provide nesting. + +\def\dosetrastercolor#1% + {\edef\@@cl@@s{#1}% + \ifx\@@cl@@s\empty + \let\@@rsraster + \fi + \setevalue{\??cr\??rs}{\colorSpattern}} + +\def\localstartraster[#1]% + {\bgroup\dosetrastercolor{#1}\localstartcolor[\??rs]} + +\def\localstopraster + {\localstopcolor\egroup} + +\def\startraster[#1]% + {\bgroup\dosetrastercolor{#1}\startcolor[\??rs]} + +\def\stopraster + {\stopcolor\egroup} + \def\fontclassname#1#2% {\ifcsname\??ff#1#2\endcsname \fontclassname{#1}{\csname\??ff#1#2\endcsname}% @@ -307,45 +355,10 @@ \box\scratchbox \egroup} -% transparency ! - -\def\dodoglobalstopcolor - {\ifcase\colorlevel \else - \donoglobalstopcolor - \global\@EA\let\@EA\previouscolor\csname\@@currentcolorname\endcsname - \ifcase\colorlevel\relax - \docolormark\empty - \dostoptransparency - \dostopcolormode - \else % let's do a bit redundant testing here - \docolormark\previouscolor - \ifx\previouscolor\empty - \dostoptransparency - \dostopcolormode - \else - \doifcolorelse\previouscolor - {\ifx\currentcolor\previouscolor\else -% alternatively we could let \startcolormode handle this -\dostoptransparency % really needed -%\dostopcolormode % less safe but more efficient - \startcolormode\previouscolor - \fi} - {\dostoptransparency - \dostopcolormode}% - \fi - \fi - \fi} - \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} % todo : hoe komt box er uit -% \def\@@itemcounter {\s!itemcount} -> non nested continue -% -% todo : option to merge itemgroup [ig-one a b c] [ig-two d e f] - -\def\@@itemcounter {\s!itemcount\currentitemgroup} - \long\def\startexternalfigure {\dotripleempty\dostartexternalfigure} @@ -385,24 +398,26 @@ \def\dodoschrijfregelnummer% {% beware of em's, the font is already switched ! - \setbox0=\hbox{\@@rncommando{\regelweergave}}% - \vsmashbox0% - \ifcase\linenumberlocation - \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! - \or - %\llap{\hbox to \@@rnbreedte{\hss\box0\hskip\linkermargeafstand}}% - \inleftmargin - {\forgetall - \doifelse\@@rnbreedte\v!marge - {\hsize\linkermargebreedte}{\hsize\@@rnbreedte}% - \alignedline\@@rnuitlijnen\v!rechts{\box0\hskip\@@rnafstand}}% - \else - \inrightmargin - {\forgetall - \doifelse\@@rnbreedte\v!marge - {\hsize\rechtermargebreedte}{\hsize\@@rnbreedte}% - \alignedline\@@rnuitlijnen\v!links{\hskip\@@rnafstand\box0}}% - \fi} + \setbox\scratchbox\hbox + {\setbox0\hbox{\@@rncommando{\regelweergave}}\vsmashbox0% + \ifcase\linenumberlocation + \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! + \or + %\llap{\hbox to \@@rnbreedte{\hss\box0\hskip\linkermargeafstand}}% + \inleftmargin + {\forgetall + \doifelse\@@rnbreedte\v!marge + {\hsize\linkermargebreedte}{\hsize\@@rnbreedte}% + \alignedline\@@rnuitlijnen\v!rechts{\box0\hskip\@@rnafstand}}% + \else + \inrightmargin + {\forgetall + \doifelse\@@rnbreedte\v!marge + {\hsize\rechtermargebreedte}{\hsize\@@rnbreedte}% + \alignedline\@@rnuitlijnen\v!links{\hskip\@@rnafstand\box0}}% + \fi}% + \vsmashbox\scratchbox + \box\scratchbox} \stelregelnummerenin [\c!breedte=\ifcase\linenumberlocation2em\else\v!marge\fi, @@ -587,11 +602,11 @@ \ifnum\gotocellcounter>#1\relax \line{\strut}\crlf \line{\strut}\crlf - \column + \kolom % \column \writestatus{columnset}{quitting goto cell}% \exitloop \else - \column + \kolom % \column \fi \else \exitloop @@ -1061,8 +1076,8 @@ \chuckTABLEautorow \else\ifnum\currentTABLEcolumn=0 \TABLEnoalign - {\global\let\checkTABLEautorow=\empty - \global\let\chuckTABLEautorow=\empty}% + {\global\let\checkTABLEautorow\empty + \global\let\chuckTABLEautorow\empty}% \else \setTABLEerror\TABLEmissingcolumn \handleTABLEerror diff --git a/tex/context/base/cont-nl.tex b/tex/context/base/cont-nl.tex index 2f4d33662..974790061 100644 --- a/tex/context/base/cont-nl.tex +++ b/tex/context/base/cont-nl.tex @@ -27,6 +27,7 @@ \installlanguage [\s!fr] [\c!status=\v!start] \installlanguage [\s!es] [\c!status=\v!start] \installlanguage [\s!nl] [\c!status=\v!start] +\installlanguage [\s!it] [\c!status=\v!start] \setupbodyfont [cmr,rm,12pt] diff --git a/tex/context/base/cont-uk.tex b/tex/context/base/cont-uk.tex index cc087c36d..b7ade6157 100644 --- a/tex/context/base/cont-uk.tex +++ b/tex/context/base/cont-uk.tex @@ -27,6 +27,7 @@ \installlanguage [\s!fr] [\c!status=\v!start] \installlanguage [\s!es] [\c!status=\v!start] \installlanguage [\s!nl] [\c!status=\v!start] +\installlanguage [\s!it] [\c!status=\v!start] \setupbodyfont [cmr,rm,12pt] diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 29bc8ab95..81b6b4d9a 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -15,7 +15,7 @@ \catcode`\{=1 \catcode`\}=2 -\def\contextversion{2002.5.15} +\def\contextversion{2002.6.7} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using @@ -105,6 +105,7 @@ \input core-var.tex \input core-ins.tex \input core-fil.tex +\input core-con.tex %D We already need some synonyms (patterns). At runtime this %D file will be reloaded. @@ -174,7 +175,7 @@ \input core-grd.tex \input core-ver.tex \input core-vis.tex -\input core-con.tex +%input core-con.tex \input core-rul.tex \input core-new.tex \input core-tab.tex diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex index 165701a24..75ac2395c 100644 --- a/tex/context/base/core-con.tex +++ b/tex/context/base/core-con.tex @@ -32,11 +32,8 @@ %D %D \showsetup{\y!numbers} -\def\numbers#1% - {\number#1} - -\def\Numbers#1% - {\number#1} +\def\numbers#1{\number#1} +\def\Numbers#1{\number#1} %D \macros %D {romannumerals,Romannumerals} @@ -133,16 +130,16 @@ \def\doconvertcharacters#1#2% {\ifnum#2>26 \bgroup - \!!counta=#2 - \ifnum\!!counta>0 - \advance\!!counta by -1 - \!!countb=\!!counta - \divide\!!counta by 26 - \!!countc=\!!counta - \multiply\!!countc by 26 - \advance\!!countb by -\!!countc + \!!counta#2 + \ifnum\!!counta>\zerocount + \advance\!!counta \minusone + \!!countb\!!counta + \divide\!!counta 26 + \!!countc\!!counta + \multiply\!!countc 26 + \advance\!!countb -\!!countc \doconvertcharacters#1{\!!counta}% - \advance\!!countb by 1 + \advance\!!countb \plusone #1{\the\!!countb}% \fi \egroup @@ -150,11 +147,8 @@ #1{#2}% pure expansion, used in references \fi} -\def\characters% - {\doconvertcharacters\character} - -\def\Characters% - {\doconvertcharacters\Character} +\def\characters{\doconvertcharacters\character} +\def\Characters{\doconvertcharacters\Character} %D \macros %D {greeknumerals,Greeknumerals} @@ -191,7 +185,7 @@ {{\os\number#1}} \unexpanded\def\oldstyleromannumerals#1% - {{\leftrulefalse\rightrulefalse\ss\txx\boxrulewidth=.15ex + {{\leftrulefalse\rightrulefalse\ss\txx\boxrulewidth.15ex \ruledhbox spread .15em{\hss\uppercased{\romannumerals{#1}}\hss}}} %D \macros @@ -201,7 +195,7 @@ %D passed to \type{\write} en \type{\message}. That's why we %D introduce: -\def\protectconversion% +\def\protectconversion {\def\doconvertcharacters##1{##1}} % was \relax %{\def\doconvertcharacters##1{\ifcase0##1 0\else##1\fi}} more save @@ -249,7 +243,7 @@ {\doconvertmonth} \def\MONTH#1% - {{\let\labeltext=\LABELTEXT\month{#1}}} + {{\let\labeltext\LABELTEXT\month{#1}}} %D We never explicitly needed this, but Tobias Burnus pointed %D out that it would be handy to convert to the day of the @@ -286,9 +280,9 @@ \def\getdayoftheweek#1#2#3% {\bgroup - \!!counta=#3\relax + \!!counta#3\relax \advance\!!counta -1 - \!!countb=\!!counta + \!!countb\!!counta \multiply\!!countb 365 \advance\!!countb \ifcase#2\relax 0 \or 0 \or 31 \or 59 \or 90 \or120 \or151 \or @@ -297,16 +291,20 @@ \ifnum#2>2 \doifleapyearelse{#3}{\advance\!!countb 1}{}\relax \fi - \!!countc=\!!counta - \DoDiv\!!countc by4to\!!countc + \!!countc\!!counta +% \DoDiv\!!countc by4to\!!countc + \dosetdivision\!!countc4\!!countc \advance\!!countb \!!countc - \!!countc=\!!counta - \DoDiv\!!countc by100to\!!countc + \!!countc\!!counta +% \DoDiv\!!countc by100to\!!countc + \dosetdivision\!!countc{100}\!!countc \advance\!!countb -\!!countc - \!!countc=\!!counta - \DoDiv\!!countc by400to\!!countc + \!!countc\!!counta +% \DoDiv\!!countc by400to\!!countc + \dosetdivision\!!countc{400}\!!countc \advance\!!countb \!!countc - \DoMod\!!countb by7to\!!countb +% \DoMod\!!countb by7to\!!countb + \dosetmodulo\!!countb7\!!countb \advance\!!countb 1 \@EA\egroup\@EA\normalweekday\the\!!countb\relax} @@ -352,7 +350,7 @@ {\doconvertday} \def\WEEKDAY#1% - {{\let\labeltext=\LABELTEXT\doconvertday{#1}}} + {{\let\labeltext\LABELTEXT\doconvertday{#1}}} %D \macros %D {weekoftheday} @@ -384,23 +382,25 @@ %D The number of days is available in the macro \type %D {\numberofdays}. -\def\doifleapyearelse#1#2#3% +\def\doifleapyearelse#1% #2#3% {\bgroup \!!doneafalse - \!!counta=#1% - \DoMod\!!counta by4to\!!countb - \ifnum\!!countb=0 - \DoMod\!!counta by100to\!!countb - \ifnum\!!countb=0 \else \!!doneatrue \fi - \DoMod\!!counta by400to\!!countb - \ifnum\!!countb=0 \!!doneatrue \fi + \!!counta#1% +% \DoMod\!!counta by4to\!!countb + \dosetmodulo\!!counta4\!!countb + \ifcase\!!countb +% \DoMod\!!counta by100to\!!countb + \dosetmodulo\!!counta{100}\!!countb + \ifcase\!!countb \else \!!doneatrue \fi +% \DoMod\!!counta by400to\!!countb + \dosetmodulo\!!counta{400}\!!countb + \ifcase\!!countb \!!doneatrue \fi \fi \if!!donea - \egroup\def\next{#2}% + \egroup\@EA\firstoftwoarguments % \def\next{#2}% \else - \egroup\def\next{#3}% - \fi - \next} + \egroup\@EA\secondoftwoarguments % \def\next{#3}% + \fi} % \next} \def\getdayspermonth#1#2% {\doifleapyearelse{#1} @@ -511,6 +511,41 @@ % \fi % \egroup} +% \def\complexcurrentdate[#1]% +% {\bgroup +% \let\labellanguage\currentlanguage +% \def\betweendates{\let\betweendates\dobetweendates}% +% \lowercase{\edef\!!stringa{#1}}% permits usage in \kap +% \@EA\processallactionsinset\@EA +% [\!!stringa] +% [ \v!dag=>\betweendates\the\normalday, +% \v!dag+=>\betweendates\ordinaldaynumber\normalday, +% \v!maand=>\betweendates\month\normalmonth, +% \v!jaar=>\betweendates\the\normalyear, +% \v!spatie=>\unskip\ \hskip\datesignal,% optimization -) +% \ =>\unskip\ \hskip\datesignal,% optimization -) +% d=>\the\normalday, +% d+=>\ordinaldaynumber\normalday, +% m=>\the\normalmonth, +% j=>\the\normalyear, +% y=>\the\normalyear, +% w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear, +% dd=>\ifnum\normalday >9 \else0\fi\the\normalday, +% dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday}, +% mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth, +% jj=>\expandafter\gobbletwoarguments\the\normalyear, +% yy=>\expandafter\gobbletwoarguments\the\normalyear, +% \v!weekdag=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear, +% \v!kenmerk=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]}, +% \s!unknown=>\unskip +% \commalistelement +% \hskip\datesignal +% \def\betweendates{\let\betweendates\dobetweendates}]% +% \ifdim\lastskip=\datesignal\relax +% \unskip +% \fi +% \egroup} + \def\complexcurrentdate[#1]% {\bgroup \let\labellanguage\currentlanguage @@ -519,19 +554,22 @@ \@EA\processallactionsinset\@EA [\!!stringa] [ \v!dag=>\betweendates\the\normalday, - \v!dag+=>\betweendates\ordinaldaynumber\normalday, + %\v!dag+=>\betweendates\ordinaldaynumber\normalday, + \v!dag+=>\betweendates\convertnumber{\v!day+}\normalday, \v!maand=>\betweendates\month\normalmonth, \v!jaar=>\betweendates\the\normalyear, \v!spatie=>\unskip\ \hskip\datesignal,% optimization -) \ =>\unskip\ \hskip\datesignal,% optimization -) - d=>\the\normalday, - d+=>\ordinaldaynumber\normalday, - m=>\the\normalmonth, - j=>\the\normalyear, - y=>\the\normalyear, + d=>\convertnumber\v!dag\normalday, + %d+=>\ordinaldaynumber\normalday, + d+=>\convertnumber{\v!day+}\normalday, + m=>\convertnumber\v!maand\normalmonth, + j=>\convertnumber\v!jaar\normalyear, + y=>\convertnumber\v!jaar\normalyear, w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear, dd=>\ifnum\normalday >9 \else0\fi\the\normalday, - dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday}, + %dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday}, + dd+=>\convertnumber{\v!day+}{\ifnum\normalday >9 \else0\fi\the\normalday}, mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth, jj=>\expandafter\gobbletwoarguments\the\normalyear, yy=>\expandafter\gobbletwoarguments\the\normalyear, @@ -555,9 +593,9 @@ {\bgroup \iffirstargument \getparameters[\??da][d=\normalday,m=\normalmonth,y=\normalyear,#1]% - \normalday =\@@dad\relax - \normalmonth=\@@dam\relax - \normalyear =\@@day\relax + \normalday \@@dad\relax + \normalmonth\@@dam\relax + \normalyear \@@day\relax \ifsecondargument \currentdate[#2]% \else @@ -579,8 +617,10 @@ %D keys \type {h}, \type {m} and a separator. \def\calculatecurrenttime - {\DoDiv\time by60to\scratchcounter\edef\currenthour {\the\scratchcounter}% - \DoMod\time by60to\scratchcounter\edef\currentminute{\the\scratchcounter}} +% {\DoDiv\time by60to\scratchcounter\edef\currenthour {\the\scratchcounter}% +% \DoMod\time by60to\scratchcounter\edef\currentminute{\the\scratchcounter}} + {\dosetdivision\time{60}\scratchcounter\edef\currenthour {\the\scratchcounter}% + \dosetmodulo \time{60}\scratchcounter\edef\currentminute{\the\scratchcounter}} \appendtoks \calculatecurrenttime \to \everyjob @@ -610,10 +650,10 @@ \long\def\processmonth#1#2#3% year month command {\bgroup \getdayspermonth{#1}{#2}% - \dostepwiserecurse{1}{\numberofdays}{1} - {\normalyear =#1\relax - \normalmonth=#2\relax - \normalday =\recurselevel\relax + \dostepwiserecurse1\numberofdays1% + {\normalyear #1\relax + \normalmonth#2\relax + \normalday \recurselevel\relax #3}% \egroup} @@ -621,10 +661,10 @@ \long\def\processyear#1#2#3#4% year command before after {\bgroup - \dorecurse{\lastmonth} - {\normalyear =#1\relax - \normalmonth=\recurselevel\relax - #3\processmonth{\normalyear}{\normalmonth}{#2}#4}% + \dorecurse\lastmonth + {\normalyear #1\relax + \normalmonth\recurselevel\relax + #3\processmonth\normalyear\normalmonth{#2}#4}% \egroup} %D \macros @@ -644,30 +684,122 @@ %D \defineconversion [roman] [\romannumerals] %D \defineconversion [set 1] [$\star$,$\bullet$,$\ast$] %D \stoptypen +%D +%D You can define a language dependent conversion with: +%D +%D \starttypen +%D \defineconversion [en] [whatever] [\something] +%D \stoptypen -\def\dodefineconversion[#1][#2]% - {\ConvertConstantAfter\doifinstringelse{,}{#2} - {\scratchcounter=0 +% \def\dodefineconversion[#1][#2]% +% {\ConvertConstantAfter\doifinstringelse{,}{#2} +% {\scratchcounter=0 +% \def\docommando##1% +% {\advance\scratchcounter 1 +% \setvalue{\??cv#1\the\scratchcounter}{##1}}% +% \processcommalist[#2]\docommando +% \setvalue{\??cv#1}##1{\csname\??cv#1##1\endcsname}} +% {\setvalue{\??cv#1}{#2}}} +% +% \def\defineconversion% +% {\dodoubleargument\dodefineconversion} + +\def\defineconversion + {\dotripleempty\dodefineconversion} + +\def\dodefineconversion[#1][#2][#3]% + {\ifthirdargument + \dododefineconversion[#1][#2][#3]% + \else + \dododefineconversion[][#1][#2]% + \fi} + +\def\dododefineconversion[#1][#2][#3]% + {\ConvertConstantAfter\doifinstringelse{,}{#3} + {\scratchcounter\zerocount \def\docommando##1% - {\advance\scratchcounter by 1 - \setvalue{\??cv#1\the\scratchcounter}{##1}}% - \processcommalist[#2]\docommando - \setvalue{\??cv#1}##1{\csname\??cv#1##1\endcsname}} - {\setvalue{\??cv#1}{#2}}} + {\advance\scratchcounter \plusone + \setvalue{\??cv#1#2\the\scratchcounter}{##1}}% + \processcommalist[#3]\docommando + \setvalue{\??cv#1#2}##1{\csname\??cv#1#2##1\endcsname}} + {\setvalue{\??cv#1#2}{#3}}} + +% \def\convertnumber#1% +% {\csname\??cv#1\endcsname} + +% \def\convertnumber#1% +% {\csname\??cv +% \ifundefined{\??cv\currentlanguage#1}\else\currentlanguage\fi +% #1\endcsname} + +% \def\doifconversiondefinedelse#1% +% {\ifundefined{\??cv#1}% +% \@EA\secondoftwoarguments +% \else +% \@EA\firstoftwoarguments +% \fi} + +% \def\doifconversiondefinedelse#1% +% {\ifundefined{\??cv\ifundefined{\??cv\currentlanguage:#1}\else\currentlanguage\fi#1}% +% \@EA\secondoftwoarguments +% \else +% \@EA\firstoftwoarguments +% \fi} + +\beginETEX \ifcsname + +\def\convertnumber#1% + {\csname\??cv + \ifcsname\??cv\currentlanguage#1\endcsname + \currentlanguage#1% + \else\ifcsname\??cv#1\endcsname + #1% + \else + \s!default + \fi\fi + \endcsname} + +\def\doifconversiondefinedelse#1% + {\ifcsname\??cv\currentlanguage#1\endcsname + \@EA\firstoftwoarguments + \else\ifcsname\??cv#1\endcsname + \@EAEAEA\firstoftwoarguments + \else + \@EAEAEA\secondoftwoarguments + \fi\fi} + +\endETEX -\def\defineconversion% - {\dodoubleargument\dodefineconversion} +\beginTEX \def\convertnumber#1% - {\csname\??cv#1\endcsname} + {\csname\??cv + \@EA\ifx\csname\??cv\currentlanguage#1\endcsname\relax + \@EA\ifx\ifcsname\??cv#1\endcsname\relax + \s!default + \else + #1% + \fi + \else + \currentlanguage#1% + \fi + \endcsname} \def\doifconversiondefinedelse#1% - {\ifundefined{\??cv#1}% - \@EA\secondoftwoarguments + {\@EA\ifx\csname\??cv\currentlanguage#1\endcsname\relax + \@EA\ifx\ifcsname\??cv#1\endcsname\relax + \@EAEAEA\secondoftwoarguments + \else + \@EAEAEA\firstoftwoarguments + \fi \else \@EA\firstoftwoarguments \fi} +\endTEX + +\defineconversion [\s!default] [\number] + %D As longs as symbols are linked to levels or numbers, we can %D also use the conversion mechanism, but in for instance the %D itemization macros, we prefer symbols because they can more diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex index 064c13144..443d65b41 100644 --- a/tex/context/base/core-des.tex +++ b/tex/context/base/core-des.tex @@ -762,7 +762,8 @@ \v!marge=>\setvalue{\??lb#1\c!commando}{\inmarge }]% % inefficient, we need to redesign this command \definieernummer - [#1][\c!wijze=\@@nrwijze]% \getvalue{\??lb#1\c!wijze}]% + [#1] + [\c!wijze=\getvalue{\??lb#1\c!wijze}]% % generated commands \setvalue {#1}{\dodoubleempty\dodoorlabel[#1]}% \setvalue{\s!reset #1}{\resetnummer[#1]}% @@ -770,7 +771,7 @@ \setvalue{\e!volgende#1}{\dodoubleempty\dovolgendedoorlabel[#1]}% \setvalue{\c!huidige #1}{\huidigenummer[#1]}} -\def\doorlabelen% +\def\doorlabelen {\dodoubleargumentwithset\dodoorlabelen} \steldoordefinierenin diff --git a/tex/context/base/core-fil.tex b/tex/context/base/core-fil.tex index b866f478e..39fb5be66 100644 --- a/tex/context/base/core-fil.tex +++ b/tex/context/base/core-fil.tex @@ -257,8 +257,10 @@ {\doifnotflagged{#2} {\let#1\undefined \startreadingfile + \bgroup \cleanupfeatures % better \setnormalcatcodes / test first \readfile{#2}\donothing\donothing + \egroup \stopreadingfile \doglobal\setflag{#2}}% \ifx#1\undefined diff --git a/tex/context/base/core-fld.tex b/tex/context/base/core-fld.tex index bc0e0e8a7..2ed365849 100644 --- a/tex/context/base/core-fld.tex +++ b/tex/context/base/core-fld.tex @@ -186,8 +186,11 @@ \xdef\@@FieldKids {#5}% \xdef\@@FieldGroup {#6}% \setfieldmodes #7% - \xdef\@@FieldValues {#8}% - \xdef\@@FieldDefault{#9}} + \bgroup + \def\par{\string\n\string\n}% + \xdef\@@FieldValues {#8}% + \xdef\@@FieldDefault{#9}% + \egroup} \def\changefield#1% {\setfield{#1}\@@FieldType\@@FieldRoot\@@FieldParent\@@FieldKids\@@FieldGroup @@ -405,30 +408,30 @@ {\ifsecondargument \edef\currentfieldname{#1}% just in case we're inside a loop \doifundefinedelse{define#2field} - {\writestatus{\m!fields}{unknown field type #2}} + {\writestatus\m!fields{unknown field type #2}} {\doifundefined{fielddata\currentfieldname} {\getmainfieldkids{\currentfieldname}% \ifdefinemainfield \ifx\@@FieldKids\empty - \let\@@FieldMode=\fieldlonermode + \let\@@FieldMode\fieldlonermode \else - \let\@@FieldMode=\fieldparentmode + \let\@@FieldMode\fieldparentmode \fi \def\@@FieldAuto{1}% \else - \let\@@FieldMode=\fieldlonermode + \let\@@FieldMode\fieldlonermode \def\@@FieldAuto{0}% \fi \def\@@FieldFree{0}% \getvalue{define#2field}{\currentfieldname}{#2}{#3}{#4}{#5}}}% \else - \writestatus{\m!fields}{pass fieldname and fieldtype}% + \writestatus\m!fields{pass fieldname and fieldtype}% \fi} \def\definelinefield#1#2#3#4#5% {\setfield{#1}{#2}{}{}{\@@FieldKids}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{}{#4}} -\let\definetextfield =\definelinefield +\let\definetextfield=\definelinefield \def\definechoicefield#1#2#3#4#5% {\doifelsenothing{#4} diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex index ee1548ddd..d15ad7bce 100644 --- a/tex/context/base/core-grd.tex +++ b/tex/context/base/core-grd.tex @@ -344,189 +344,389 @@ %\fi \fi} +% \def\dodosnaptogrid +% {\dowithnextbox +% {\bgroup +% \ifdim\nextboxht<\teksthoogte % handle special case (like page fig) +% \ifcase\@@alignsnapbox\relax +% \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low +% \ifshowgridboxes +% \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% +% \fi +% \getnoflines{\ht\nextbox}% +% \setbox\nextbox\vbox to \noflines\lineheight +% {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi +% \ifnum\@@alignsnap>2 \vfill\fi +% \box\nextbox +% \ifnum\@@alignsnap<4 \vfill\fi}% +% \fi +% \ifshowgridboxes +% \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% +% \fi +% \forgetall +% \par +% \ifvbox\nextbox +% \setbox\nextbox\hbox{\box\nextbox}% don't ask +% \fi +% \scratchskip\lastskip +% \edef\presnapskip{\the\lastskip}% +% % mixing single/double columns sometimes goes wrong, +% % check 'som' document +% \ifbinnenkolommen +% \forcepresnaptrue +% \fi +% \forcedpresnapcorrection +% \ifdim\ht\nextbox>\ht\strutbox +% \scratchdimen\ht\nextbox +% \ifcase\@@presnap\relax +% \ifdim\scratchskip>\zeropoint\relax +% \scratchcounter\scratchskip +% \advance\scratchcounter -\openlineheight +% \ifnum\scratchcounter<0 +% \scratchcounter-\scratchcounter +% \fi +% \ifnum\scratchcounter<10 % \lastkip is about \openlineheight +% \advance\scratchdimen -\openstrutdepth +% \edef\presnapskip{*\presnapskip}% +% \else\ifdim\scratchskip>\openlineheight +% %<\openlineheight \else +% \advance\scratchdimen -\openstrutdepth +% \edef\presnapskip{*\presnapskip}% +% \fi\fi +% \fi +% \fi +% \getnoflines\scratchdimen +% \advance\noflines -1 +% \ifnum\noflines>0 +% \scratchdimen\noflines\lineheight +% \else +% \scratchdimen\zeropoint +% \fi +% \else +% \scratchdimen\zeropoint +% \fi +% \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign\lineheight \fi +% \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi +% \edef\presnap{\the\scratchdimen}% +% \ifstrutsnapping +% \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi +% \fi +% \ifdim\dp\nextbox>\dp\strutbox +% \getnoflines{\dp\nextbox}% +% \advance\noflines -1 +% \ifnum\noflines>0 +% \scratchdimen\noflines\lineheight +% \else +% \scratchdimen\zeropoint +% \fi +% \else +% \scratchdimen\zeropoint +% \fi +% \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi +% \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign\lineheight \fi +% \edef\postsnap{\the\scratchdimen}% +% \ifstrutsnapping +% \ht\nextbox\ht\strutbox +% \dp\nextbox\dp\strutbox +% \else +% \scratchdimen\presnap +% \advance\scratchdimen \ht\strutbox +% \ht\nextbox\scratchdimen +% \scratchdimen\postsnap +% \advance\scratchdimen \dp\strutbox +% \dp\nextbox\scratchdimen +% \fi +% \hbox{\tracedsnapping\box\nextbox}% +% \ifstrutsnapping +% \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi +% \fi +% \else +% \scratchdimen\ht\nextbox\relax +% \ifcase\@@alignsnapbox +% % can't happen here +% \or +% \getrawnoflines\scratchdimen +% \else +% \getnoflines \scratchdimen +% \fi +% \scratchdimen\noflines\lineheight\relax +% \advance\scratchdimen-\strutdepth +% \ifnum\pagetotal>\zeropoint +% \else % disable this as option +% \advance\scratchdimen-\strutheight +% \advance\scratchdimen+\topskip +% \fi +% \dimen0=\scratchdimen +% \dimen2=\strutdepth +% \ifshowgridboxes +% \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% +% \fi +% \dp\nextbox\dp\strutbox +% \dimen4=\ht\nextbox +% \dimen6=\dp\nextbox +% \setbox\nextbox\vbox to \scratchdimen +% {\forgetall +% \ifnum\@@alignsnap>2 \vfill\fi % 3 4 +% \iftracegridsnapping +% \scratchdimen\@@alignsnapamount\relax +% \setbox\scratchbox\hbox +% {\ifdim\scratchdimen<\zeropoint +% \tracedgridamount\zeropoint{-\scratchdimen}% +% \else +% \tracedgridamount\scratchdimen\zeropoint +% \fi}% +% \smashbox\scratchbox +% \setbox\nextbox\hbox{\box\scratchbox\box\nextbox}% +% \fi +% \setbox\nextbox\hbox +% {\scratchdimen\@@alignsnapamount\relax +% \ifcase\@@alignsnapdepth\or +% % don't change this ever ! +% \ifdim\dimen0<\lineheight +% % otherwise it is ok, but ending up inside +% % the next paragraph is seldom what we want, +% % so we move one line up +% \advance\scratchdimen-\lineheight +% \advance\scratchdimen\strutheight +% \else +% % otherwise we can move down to the +% % baseline +% \advance\scratchdimen\dimen6 +% \fi +% \fi +% \lower\scratchdimen\box\nextbox}% +% \ht\nextbox\dimen4 +% \dp\nextbox\dimen6 +% \box\nextbox +% \nointerlineskip % \offinterlineskip +% \ifnum\@@alignsnap<4 \vfill\fi % 2 3 +% \kern\zeropoint}% +% \ifshowgridboxes +% \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% +% \fi +% \let\presnapskip\@@alignsnapamount +% \ifnum\@@alignsnap>2 \def\presnap {+}\fi +% \ifnum\@@alignsnap<4 \def\postsnap{+}\fi +% \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}% +% \par +% \ht\nextbox\dimen0 +% \dp\nextbox\dimen2 +% \forcedpresnapcorrection +% \nointerlineskip +% \box\nextbox +% \fi +% \else +% \setbox\nextbox\vbox to \teksthoogte +% {\ifdim\nextboxdp=\zeropoint +% \hbox{\lower\strutdepth\box\nextbox} +% \else % this branch is yet untested +% \vss +% \hbox{\lower\nextboxdp\box\nextbox} +% \vskip-\strutdepth +% \fi}% +% \nextboxdp\strutdepth +% \box\nextbox +% \fi +% \extrasnapreset +% \enablepresnapcorrection +% \global\chardef\@@alignsnap0 +% \global\chardef\@@alignsnapbox0 +% \egroup}} + +\newif\ifboxedsnapping \boxedsnappingtrue + \def\dodosnaptogrid {\dowithnextbox {\bgroup -\ifdim\nextboxht<\teksthoogte % handle special case (like page fig) - \ifcase\@@alignsnapbox\relax - \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low - \ifshowgridboxes - \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% - \fi - \getnoflines{\ht\nextbox}% - \setbox\nextbox\vbox to \noflines\lineheight - {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi - \ifnum\@@alignsnap>2 \vfill\fi - \box\nextbox + \ifdim\ht\nextbox<\teksthoogte % handle special case (like page fig) + \ifcase\@@alignsnapbox\relax + \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low + \ifshowgridboxes + \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% + \fi + \getnoflines{\ht\nextbox}% + \setbox\nextbox\vbox to \noflines\lineheight + {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi + \ifnum\@@alignsnap>2 \vfill\fi + \box\nextbox \ifnum\@@alignsnap<4 \vfill\fi}% - \fi - \ifshowgridboxes - \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% - \fi - \forgetall - \par - \ifvbox\nextbox - \setbox\nextbox\hbox{\box\nextbox}% don't ask - \fi - \scratchskip\lastskip - \edef\presnapskip{\the\lastskip}% - % mixing single/double columns sometimes goes wrong, - % check 'som' document - \ifbinnenkolommen - \forcepresnaptrue - \fi - \forcedpresnapcorrection - \ifdim\ht\nextbox>\ht\strutbox - \scratchdimen\ht\nextbox - \ifcase\@@presnap\relax - \ifdim\scratchskip>\zeropoint\relax - \scratchcounter\scratchskip - \advance\scratchcounter -\openlineheight - \ifnum\scratchcounter<0 - \scratchcounter-\scratchcounter + \fi + \ifshowgridboxes + \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% + \fi + \forgetall + \par + \ifvbox\nextbox + \setbox\nextbox\hbox{\box\nextbox}% don't ask + \fi + \scratchskip\lastskip + \edef\presnapskip{\the\lastskip}% + % mixing single/double columns sometimes goes wrong, + % check 'som' document + \ifbinnenkolommen + \forcepresnaptrue + \fi + \forcedpresnapcorrection + \ifdim\ht\nextbox>\ht\strutbox + \scratchdimen\ht\nextbox + \ifcase\@@presnap\relax + \ifdim\scratchskip>\zeropoint\relax + \scratchcounter\scratchskip + \advance\scratchcounter -\openlineheight + \ifnum\scratchcounter<0 + \scratchcounter-\scratchcounter + \fi + \ifnum\scratchcounter<10 % \lastkip is about \openlineheight + \advance\scratchdimen -\openstrutdepth + \edef\presnapskip{*\presnapskip}% + \else\ifdim\scratchskip>\openlineheight + %<\openlineheight \else + \advance\scratchdimen -\openstrutdepth + \edef\presnapskip{*\presnapskip}% + \fi\fi \fi - \ifnum\scratchcounter<10 % \lastkip is about \openlineheight - \advance\scratchdimen -\openstrutdepth - \edef\presnapskip{*\presnapskip}% - \else\ifdim\scratchskip>\openlineheight - %<\openlineheight \else - \advance\scratchdimen -\openstrutdepth - \edef\presnapskip{*\presnapskip}% - \fi\fi \fi - \fi - \getnoflines\scratchdimen + \getnoflines\scratchdimen % maybe raw ? \advance\noflines -1 - \ifnum\noflines>0 - \scratchdimen\noflines\lineheight + \ifnum\noflines>0 + \scratchdimen\noflines\lineheight + \else + \scratchdimen\zeropoint + \fi \else \scratchdimen\zeropoint \fi - \else - \scratchdimen\zeropoint - \fi - \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign\lineheight \fi - \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi - \edef\presnap{\the\scratchdimen}% - \ifstrutsnapping - \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi - \fi - \ifdim\dp\nextbox>\dp\strutbox - \getnoflines{\dp\nextbox}% - \advance\noflines -1 - \ifnum\noflines>0 - \scratchdimen\noflines\lineheight + \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign\lineheight \fi + \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi + \edef\presnap{\the\scratchdimen}% + \ifstrutsnapping +\ifboxedsnapping + \getrawnoflines\scratchdimen + \advance\scratchdimen-\noflines\lineheight + \vskip\scratchdimen % disappears at top of page + \dorecurse\noflines{\vbox{\strut}\nobreak}% +\else \ifdim\scratchdimen=\zeropoint + % nothing to skip +\else % disappears at top of page + \vskip\scratchdimen +\fi \fi + \fi + \ifdim\dp\nextbox>\dp\strutbox + \getnoflines{\dp\nextbox}% + \advance\noflines -1 + \ifnum\noflines>0 + \scratchdimen\noflines\lineheight + \else + \scratchdimen\zeropoint + \fi \else \scratchdimen\zeropoint \fi + \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi + \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign\lineheight \fi + \edef\postsnap{\the\scratchdimen}% + \ifstrutsnapping + \ht\nextbox\ht\strutbox + \dp\nextbox\dp\strutbox + \else + \scratchdimen\presnap + \advance\scratchdimen \ht\strutbox + \ht\nextbox\scratchdimen + \scratchdimen\postsnap + \advance\scratchdimen \dp\strutbox + \dp\nextbox\scratchdimen + \fi + \hbox{\tracedsnapping\box\nextbox}% + \ifstrutsnapping + \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi + \fi \else - \scratchdimen\zeropoint - \fi - \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi - \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign\lineheight \fi - \edef\postsnap{\the\scratchdimen}% - \ifstrutsnapping - \ht\nextbox\ht\strutbox + \scratchdimen\ht\nextbox\relax + \ifcase\@@alignsnapbox + % can't happen here + \or + \getrawnoflines\scratchdimen + \else + \getnoflines \scratchdimen + \fi + \scratchdimen\noflines\lineheight\relax + \advance\scratchdimen-\strutdepth + \ifnum\pagetotal>\zeropoint + \else % disable this as option + \advance\scratchdimen-\strutheight + \advance\scratchdimen+\topskip + \fi + \dimen0=\scratchdimen + \dimen2=\strutdepth + \ifshowgridboxes + \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% + \fi \dp\nextbox\dp\strutbox - \else - \scratchdimen\presnap - \advance\scratchdimen \ht\strutbox - \ht\nextbox\scratchdimen - \scratchdimen\postsnap - \advance\scratchdimen \dp\strutbox - \dp\nextbox\scratchdimen - \fi - \hbox{\tracedsnapping\box\nextbox}% - \ifstrutsnapping - \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi - \fi - \else - \scratchdimen\ht\nextbox\relax - \ifcase\@@alignsnapbox - % can't happen here - \or - \getrawnoflines\scratchdimen - \else - \getnoflines \scratchdimen - \fi - \scratchdimen\noflines\lineheight\relax - \advance\scratchdimen-\strutdepth - \ifnum\pagetotal>\zeropoint - \else % disable this as option - \advance\scratchdimen-\strutheight - \advance\scratchdimen+\topskip - \fi - \dimen0=\scratchdimen - \dimen2=\strutdepth - \ifshowgridboxes - \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% - \fi - \dp\nextbox\dp\strutbox - \dimen4=\ht\nextbox - \dimen6=\dp\nextbox - \setbox\nextbox\vbox to \scratchdimen - {\forgetall - \ifnum\@@alignsnap>2 \vfill\fi % 3 4 - \iftracegridsnapping - \scratchdimen\@@alignsnapamount\relax - \setbox\scratchbox\hbox - {\ifdim\scratchdimen<\zeropoint - \tracedgridamount\zeropoint{-\scratchdimen}% - \else - \tracedgridamount\scratchdimen\zeropoint - \fi}% - \smashbox\scratchbox - \setbox\nextbox\hbox{\box\scratchbox\box\nextbox}% - \fi - \setbox\nextbox\hbox - {\scratchdimen\@@alignsnapamount\relax - \ifcase\@@alignsnapdepth\or - % don't change this ever ! - \ifdim\dimen0<\lineheight - % otherwise it is ok, but ending up inside - % the next paragraph is seldom what we want, - % so we move one line up - \advance\scratchdimen-\lineheight - \advance\scratchdimen\strutheight - \else - % otherwise we can move down to the - % baseline - \advance\scratchdimen\dimen6 + \dimen4=\ht\nextbox + \dimen6=\dp\nextbox + \setbox\nextbox\vbox to \scratchdimen + {\forgetall + \ifnum\@@alignsnap>2 \vfill\fi % 3 4 + \iftracegridsnapping + \scratchdimen\@@alignsnapamount\relax + \setbox\scratchbox\hbox + {\ifdim\scratchdimen<\zeropoint + \tracedgridamount\zeropoint{-\scratchdimen}% + \else + \tracedgridamount\scratchdimen\zeropoint + \fi}% + \smashbox\scratchbox + \setbox\nextbox\hbox{\box\scratchbox\box\nextbox}% + \fi + \setbox\nextbox\hbox + {\scratchdimen\@@alignsnapamount\relax + \ifcase\@@alignsnapdepth\or + % don't change this ever ! + \ifdim\dimen0<\lineheight + % otherwise it is ok, but ending up inside + % the next paragraph is seldom what we want, + % so we move one line up + \advance\scratchdimen-\lineheight + \advance\scratchdimen\strutheight + \else + % otherwise we can move down to the + % baseline + \advance\scratchdimen\dimen6 + \fi \fi - \fi - \lower\scratchdimen\box\nextbox}% - \ht\nextbox\dimen4 - \dp\nextbox\dimen6 - \box\nextbox - \nointerlineskip % \offinterlineskip - \ifnum\@@alignsnap<4 \vfill\fi % 2 3 - \kern\zeropoint}% - \ifshowgridboxes - \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% + \lower\scratchdimen\box\nextbox}% + \ht\nextbox\dimen4 + \dp\nextbox\dimen6 + \box\nextbox + \nointerlineskip % \offinterlineskip + \ifnum\@@alignsnap<4 \vfill\fi % 2 3 + \kern\zeropoint}% + \ifshowgridboxes + \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% + \fi + \let\presnapskip\@@alignsnapamount + \ifnum\@@alignsnap>2 \def\presnap {+}\fi + \ifnum\@@alignsnap<4 \def\postsnap{+}\fi + \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}% + \par + \ht\nextbox\dimen0 + \dp\nextbox\dimen2 + \forcedpresnapcorrection + \nointerlineskip + \box\nextbox \fi - \let\presnapskip\@@alignsnapamount - \ifnum\@@alignsnap>2 \def\presnap {+}\fi - \ifnum\@@alignsnap<4 \def\postsnap{+}\fi - \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}% - \par - \ht\nextbox\dimen0 - \dp\nextbox\dimen2 - \forcedpresnapcorrection - \nointerlineskip + \else + \setbox\nextbox\vbox to \teksthoogte + {\ifdim\nextboxdp=\zeropoint + \hbox{\lower\strutdepth\box\nextbox} + \else % this branch is yet untested + \vss + \hbox{\lower\nextboxdp\box\nextbox} + \vskip-\strutdepth + \fi}% + \nextboxdp\strutdepth \box\nextbox \fi -\else - \setbox\nextbox\vbox to \teksthoogte - {\ifdim\nextboxdp=\zeropoint - \hbox{\lower\strutdepth\box\nextbox} - \else % this branch is yet untested - \vss - \hbox{\lower\nextboxdepth\box\nextbox} - \vskip-\strutdepth - \fi}% - \nextboxdp\strutdepth - \box\nextbox -\fi \extrasnapreset \enablepresnapcorrection \global\chardef\@@alignsnap0 diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex index c0dbad663..7659dd9c2 100644 --- a/tex/context/base/core-itm.tex +++ b/tex/context/base/core-itm.tex @@ -84,7 +84,7 @@ \def\@@localitemsymbol #1{\??op\currentitemgroup\c!symbool\s!local #1} \def\@@currentitemsymbol#1{\??op\currentitemgroup\c!symbool #1} -\def\@@itemcounter {\s!itemcount} % {\s!itemcount\currentitemgroup} +\def\@@itemcounter{\s!itemcount\currentitemgroup} \def\doitembreak#1{\iftextitems\else\dosomebreak#1\fi} @@ -632,7 +632,7 @@ \fi \else % 2 en hoger \ifparagraphitems \else - \let\previtemlevel=\itemlevel + \let\previtemlevel\itemlevel \decrement\previtemlevel \getitemparameter\previtemlevel\c!tussen % = itemlevel-1 \fi @@ -713,7 +713,9 @@ \c!breedte=1.5em, \c!factor=0, \c!afstand=.5em, - \c!uitlijnen=\v!normaal, + %\c!uitlijnen=\v!normaal, % definitely not \v!normaal, see mails and + \c!uitlijnen=, % debug reports of David A & Patrick G on context list + \c!kleur=, \c!inspringen=, % untouched if empty \c!kleur=, \c!letter=, % kan tzt weg diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index 94336ebe6..c986a5e56 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -31,6 +31,8 @@ %S %S CheckChar $ +% \appendtoks \reportprotectionstate \to \everydump + \unprotect \def\currentproject {} @@ -102,16 +104,17 @@ \doifundefined{preloadfonts} {\let\preloadfonts=\relax} \doifundefined{preloadspecials} {\let\preloadspecials=\relax} -\def\loadsystemfiles% - {\readsysfile{\f!newfilename} - {\showmessage{\m!systems}{2}{\f!newfilename}}{}% - \readsysfile{\f!oldfilename} - {\showmessage{\m!systems}{2}{\f!oldfilename}}{}% - \readsysfile{\f!filfilename} - {\showmessage{\m!systems}{2}{\f!filfilename}}{}% - \readsysfile{\f!sysfilename} - {\showmessage{\m!systems}{2}{\f!sysfilename}}{}} - +% \def\loadsystemfiles% +% {\reportprotectionstate +% \readsysfile{\f!newfilename} +% {\showmessage{\m!systems}{2}{\f!newfilename}}{}% +% \readsysfile{\f!oldfilename} +% {\showmessage{\m!systems}{2}{\f!oldfilename}}{}% +% \readsysfile{\f!filfilename} +% {\showmessage{\m!systems}{2}{\f!filfilename}}{}% +% \readsysfile{\f!sysfilename} +% {\showmessage{\m!systems}{2}{\f!sysfilename}}{}} +% % test \@@svgebied \def\loadallsystemfiles#1% @@ -124,7 +127,8 @@ \fi} \def\loadsystemfiles% - {\readsysfile{\f!newfilename} + {\reportprotectionstate + \readsysfile{\f!newfilename} {\showmessage{\m!systems}{2}{\f!newfilename}}{}% \readsysfile{\f!oldfilename} {\showmessage{\m!systems}{2}{\f!oldfilename}}{}% @@ -150,7 +154,8 @@ \def\loadoptionfile% {\readjobfile{\jobname.\f!optionextension} {\showmessage{\m!systems}{2}{\jobname.\f!optionextension}}% - {}} + %{\showmessage{\m!systems}{2}{\jobname.\f!optionextension}}} + {\writestatus{\m!systems}{no \jobname.\f!optionextension}}} % \newevery \everyjob \EveryJob % \appendtoks ... \to \everyjob @@ -207,6 +212,9 @@ \expandafter\end \fi} +\let\starttext\starttekst +\let\stoptext \stoptekst + \let\normalend=\end \def\end% diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index 8ca5aa031..4c85f1511 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -101,7 +101,7 @@ \abovedisplayshortskip\!!zeropoint \belowdisplayshortskip\!!zeropoint} -\doorlabelen +\definieernummer % \doorlabelen [\v!formule] [\c!tekst=\v!formule, \c!wijze=\@@fmwijze, diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex index 9191c1c2d..2351fe77d 100644 --- a/tex/context/base/core-pos.tex +++ b/tex/context/base/core-pos.tex @@ -15,6 +15,8 @@ % todo: topskip als optie voor eerste regel achtergrond +% todo: build pos layers on top of layers + %D Although \TEX\ has a rather powerful channel to the outside %D world, called \type {\special}, real communication with %D other programs is complicated by the fact that no positional @@ -328,7 +330,7 @@ %D position as well as execute an action associated with that %D position. -\def\initializenextposition% +\def\initializenextposition {\ifpositioning \else \global\positioningtrue \dosetpositionpapersize @@ -487,24 +489,65 @@ {\removelastspace \setpositionplus{e:#1}{\parposcounter}\hbox{\strut}} +%\def\ffpos#1% +% {\setpositionbox{b:#1}\hbox{\strut}\wpos{#1}% +% \ignorespaces} +% +%\def\ttpos#1% +% {\removelastspace +% \setpositionbox{e:#1}\hbox{\strut}} + \def\ffpos#1% - {\setpositionbox{b:#1}\hbox{\strut}\wpos{#1}% + {\setpositionplus{b:#1}{\parposcounter}\hbox{\strut}\wpos{#1}% \ignorespaces} \def\ttpos#1% {\removelastspace - \setpositionbox{e:#1}\hbox{\strut}} + \setpositionplus{e:#1}{\parposcounter}\hbox{\strut}} + +%\def\wpos#1% +% {\dontleavehmode\vadjust % may disappear if buried +% {\setbox0=\hbox{\raise\dp\strutbox\hbox{\hpos{w:#1} +% {\strut +% \hskip-\leftskip +% \hskip\hsize +% \hskip-\rightskip}}}% +% \smashbox0 +% \rlap{\box0}}} \def\wpos#1% {\dontleavehmode\vadjust % may disappear if buried - {\setbox0=\hbox{\raise\dp\strutbox\hbox{\hpos{w:#1} - {\strut - \hskip-\leftskip - \hskip\hsize - \hskip-\rightskip}}}% + {\setbox0\hbox{\raise\dp\strutbox\hbox{\rawwpos{#1}}}% \smashbox0 \rlap{\box0}}} +\def\wwpos#1% + {\rlap + {\setbox0\hbox{\rawwpos{#1}}% + \smashbox0 + \box0}} + +\def\rawwpos#1% + {\hpos{w:#1} + {\strut + \hskip-\leftskip + \hskip\hsize + \hskip-\rightskip}} + +% the next macro disables par positions (in inner boxes) and +% only registers the width + +\def\setinnerparpositions + {\let\fpos\ffpos + \let\tpos\ttpos + \let\wpos\wwpos} + +% example of usage: (see for application "techniek") +% +% \appendtoks +% \setinnerparpositions +% \to \everytabulate + %D When we want to calculate more complex backgrounds, we %D need to know what the current indentation scheme is. At %D the cost of many positions and memory, we can keep track @@ -772,7 +815,8 @@ \def\positionoverlay#1% {\ifpositioning \vbox to \overlayheight - {\edef\MPanchor##1{\MPpos{#1::\MPanchoridentifier:\realfolio}}% + {\edef\MPanchorid{#1::\MPanchoridentifier:\realfolio}% + \edef\MPanchor##1{\MPpos{\MPanchorid}}% \the\everyinsertpositionaction \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\realfolio}% \hpos @@ -932,7 +976,7 @@ %D Graphics that span two positions. -\def\setMPpositiongraphicrange% +\def\setMPpositiongraphicrange {\doquadruplegroupempty\dosetMPpositiongraphicrange} \def\dosetMPpositiongraphicrange#1#2#3#4% bpos epos tag vars @@ -982,7 +1026,8 @@ \to \MPinitializations %D Some of these macros are pretty clever but too complicated -%D to be nice. +%D to be nice. When things are kind of stable I'll clean up +%D this mess. %D THIS NEEDS A CLEANUP @@ -1072,8 +1117,8 @@ % initialize_par(\MPpos{b:\MPvar{self}}, % \MPpos{e:\MPvar{self}}, % \MPpos{text:\realfolio}, -% \MPpos{p:\parcounter}, -% \MPvv {p:\parcounter}{0,0,0,0,0,0}) ; +% \MPpos{p:\MPparcounter}, +% \MPvv {p:\MPparcounter}{0,0,0,0,0,0}) ; % \includeMPgraphic{mpos:par:setup} ; % \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ; % anchor_par(\MPanchor{b:\MPvar{self}}) ; @@ -1083,30 +1128,19 @@ %D Less readable but shorter. -\ifx\parcounter\undefined \newcounter\parcounter \fi +\ifx\MPparcounter\undefined \newcounter\MPparcounter \fi -\def\MPself {\MPvar{self}} -\def\MPbself {b:\MPself} -\def\MPeself {e:\MPself} -\def\MPwself {w:\MPself} -\def\paranchor{p:\parcounter} +\def\MPself {\MPvar{self}} +\def\MPbself {b:\MPself} +\def\MPeself {e:\MPself} +\def\MPwself {w:\MPself} +\def\MPparanchor{p:\MPparcounter} -% \startMPpositionmethod{mpos:par} -% \edef\parcounter{\MPv\MPbself{1}{0}}% -% \startMPpositiongraphic{mpos:par}% -% {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius} -% initialize_par(\MPpos\MPbself, \MPpos\MPeself, -% \MPpos\textanchor, \MPpos\paranchor, -% \MPvv\paranchor{0,0,0,0,0,0}) ; -% \includeMPgraphic{mpos:par:setup} ; -% \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ; -% anchor_par(\MPanchor\MPbself) ; -% \stopMPpositiongraphic -% \MPpositiongraphic{mpos:par}{}% -% \stopMPpositionmethod +\def\MPl#1{\MPplus{#1}20} +\def\MPr#1{\MPplus{#1}30} \startMPpositionmethod{mpos:par} - \edef\parcounter{\MPv\MPbself{1}{0}}% + \edef\MPparcounter{\MPv\MPbself{1}{0}}% \doifpositionelse\MPwself {\startMPpositiongraphic{mpos:par}% {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius} @@ -1122,8 +1156,8 @@ initialize_par(\MPpos\MPbself, \MPpos\MPeself, \MPpos\textanchor, - \MPpos\paranchor, - \MPvv \paranchor{0,0,0,0,0,0}) ; + \MPpos\MPparanchor, + \MPvv \MPparanchor{0,0,0,0,0,0}) ; \includeMPgraphic{mpos:par:setup} ; \includeMPgraphic{\MPvar{mp}} ; anchor_par(\MPanchor\MPbself) ; @@ -1131,7 +1165,32 @@ \MPpositiongraphic{mpos:par}{}% \stopMPpositionmethod -%D So far for the unreadable alternative. +%D The next alternative works in columnsets : + +\startuseMPgraphic{mpos:par:columnset} + draw_multi_pars ; + \iftracepositions show_multi_pars ; \fi +\stopuseMPgraphic + +\startMPpositionmethod{mpos:par:columnset} + \edef\MPparcounter{\MPv\MPbself{1}{0}}% + \startMPpositiongraphic{mpos:par}% + {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius} + \includeMPgraphic{mpos:par:setup} ; + prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself, + \MPpos\MPparanchor,\MPvv\MPparanchor{0,0,0,0,0,0}) ; + relocate_multipars(-\MPxy\MPanchorid) ; % inside layerpos + \includeMPgraphic{\MPvar{mp}} ; + \stopMPpositiongraphic + \MPpositiongraphic{mpos:par}{}% +\stopMPpositionmethod + +%D \starttypen +%D \setupbackground +%D [test] +%D [mp=mpos:par:columnset, +%D methode=mpos:par:columnset] +%D \stoptypen \newcounter\textbackgrounddepth @@ -1211,7 +1270,8 @@ {\setMPpositiongraphicrange % moet veel efficienter {b:\currentparbackground}% {e:\currentparbackground}% - {mpos:par}% +% {mpos:par}% + {\getvalue{\??td#1\c!methode}}% {self=\currentparbackground, mp=\getvalue{\??td#1\c!mp}, gridtype=\getvalue{\??td#1\c!variant}, @@ -1226,7 +1286,7 @@ lineradius=\getvalue{\??td#1\c!straal}}}% \stoppositionoverlay} -\def\stoptextbackground% +\def\stoptextbackground {\dodostoptextbackground \carryoverpar\egroup} @@ -1241,6 +1301,7 @@ \def\dostarttextbackgroundpar {\getvalue{\??td\currenttextbackground\c!voor}% +% {\forgetall\noindent\fpos\currentparbackground}\ignorespaces \noindent\fpos\currentparbackground\ignorespaces \bgroup \nobreak \vskip-\lineheight \nobreak @@ -1270,7 +1331,7 @@ \let\textparwidth \!!zeropoint \def\calculatetextpardimensions - {\docalculatetextpardimensions\btbanchor \etbanchor \paranchor} + {\docalculatetextpardimensions\btbanchor \etbanchor \MPparanchor} \def\calculatenexttextpardimensions {\docalculatetextpardimensions\nextbtbanchor\nextetbanchor\relax} @@ -1281,11 +1342,11 @@ \edef\textparpages{\the\scratchcounter}% \ifcase\scratchcounter % one page - \scratchdimen =\MPy#1%\btanchor + \scratchdimen \MPy#1%\btanchor \advance\scratchdimen-\MPy#2%\etbanchor \else % two or more pages - \scratchdimen =\MPy#1%\btanchor + \scratchdimen \MPy#1%\btanchor \advance\scratchdimen-\MPy#2%\etbanchor \advance\scratchdimen-\MPy\textanchor \advance\scratchdimen \MPy\textanchor @@ -1303,16 +1364,16 @@ \edef\textparheight{\the\scratchdimen}% \ifcase\scratchcounter % one page - \scratchdimen =\MPx#2%\etbanchor + \scratchdimen \MPx#2%\etbanchor \advance\scratchdimen-\MPx#1%\btanchor \else % two or more pages / maybe also hang \ifx#3\relax - \scratchdimen=\tekstbreedte + \scratchdimen\zetbreedte % \tekstbreedte \else - \scratchdimen=\MPw\paranchor - \advance\scratchdimen-\MPl\paranchor - \advance\scratchdimen-\MPr\paranchor + \scratchdimen\MPw\MPparanchor + \advance\scratchdimen-\MPl\MPparanchor + \advance\scratchdimen-\MPr\MPparanchor \fi \fi \edef\textparwidth{\the\scratchdimen}} @@ -1343,7 +1404,7 @@ \def\dodefinetextbackground[#1][#2]% {\ifsecondargument \copyparameters[\??td#1][\??td] - [\c!status,\c!plaats,\c!variant,\c!mp, + [\c!status,\c!plaats,\c!variant,\c!mp,\c!methode, \c!achtergrond,\c!achtergrondkleur,\c!hoek,\c!niveau, \c!achtergrondoffset, \c!straal,\c!kader,\c!kaderkleur,\c!lijndikte, @@ -1389,6 +1450,7 @@ \setuptextbackground [\c!mp=mpos:par:shape, + \c!methode=mpos:par, \c!status=\v!start, \c!plaats=\v!tekst, \c!linkeroffset=\!!zeropoint, % 1em, @@ -1599,10 +1661,10 @@ \newcounter\noftabpositions \newtoks \posXCtoks -\def\tbPOSprefix% +\def\tbPOSprefix {tbp:\noftabpositions:} -\def\tablepos% +\def\tablepos {\scratchtoks\posXCtoks \global\posXCtoks\emptytoks \the\scratchtoks} diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index 63c6bd582..5cd9b00d7 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -2117,40 +2117,42 @@ %D special driver (using \type{\executecommand}). % better: [command(name)] and \definereference[name][command(name)] - -\setglobalsystemreference \rt!exec \v!CloseDocument {close} -\setglobalsystemreference \rt!exec \v!ExitViewer {exit} -\setglobalsystemreference \rt!exec \v!FirstPage {first} -\setglobalsystemreference \rt!exec \v!LastPage {last} -\setglobalsystemreference \rt!exec \v!NextJump {forward} -\setglobalsystemreference \rt!exec \v!NextPage {next} -\setglobalsystemreference \rt!exec \v!PauseMovie {pausemovie} -\setglobalsystemreference \rt!exec \v!PauseSound {pausesound} -\setglobalsystemreference \rt!exec \v!PreviousJump {backward} -\setglobalsystemreference \rt!exec \v!PreviousPage {previous} -\setglobalsystemreference \rt!exec \v!PrintDocument {print} -\setglobalsystemreference \rt!exec \v!SaveForm {exportform} -\setglobalsystemreference \rt!exec \v!LoadForm {importform} -\setglobalsystemreference \rt!exec \v!ResetForm {resetform} -\setglobalsystemreference \rt!exec \v!ResumeMovie {resumemovie} -\setglobalsystemreference \rt!exec \v!ResumeSound {resumesound} -\setglobalsystemreference \rt!exec \v!SaveDocument {save} -\setglobalsystemreference \rt!exec \v!SearchDocument {search} -\setglobalsystemreference \rt!exec \v!SearchAgain {searchagain} -\setglobalsystemreference \rt!exec \v!StartMovie {startmovie} -\setglobalsystemreference \rt!exec \v!StartSound {startsound} -\setglobalsystemreference \rt!exec \v!StopMovie {stopmovie} -\setglobalsystemreference \rt!exec \v!StopSound {stopsound} -\setglobalsystemreference \rt!exec \v!SubmitForm {submitform} -\setglobalsystemreference \rt!exec \v!SwapViewer {swap} -\setglobalsystemreference \rt!exec \v!ViewerHelp {help} -\setglobalsystemreference \rt!exec \v!HideField {hide} -\setglobalsystemreference \rt!exec \v!ShowField {show} -\setglobalsystemreference \rt!exec \v!GotoPage {gotopage} -\setglobalsystemreference \rt!exec \v!Query {query} -\setglobalsystemreference \rt!exec \v!QueryAgain {queryagain} -\setglobalsystemreference \rt!exec \v!FitWidth {fitwidth} -\setglobalsystemreference \rt!exec \v!FitHeight {fitheight} + +\setglobalsystemreference \rt!exec \v!CloseDocument {close} +\setglobalsystemreference \rt!exec \v!ExitViewer {exit} +\setglobalsystemreference \rt!exec \v!FirstPage {first} +\setglobalsystemreference \rt!exec \v!LastPage {last} +\setglobalsystemreference \rt!exec \v!NextJump {forward} +\setglobalsystemreference \rt!exec \v!NextPage {next} +\setglobalsystemreference \rt!exec \v!PauseMovie {pausemovie} +\setglobalsystemreference \rt!exec \v!PauseSound {pausesound} +\setglobalsystemreference \rt!exec \v!PreviousJump {backward} +\setglobalsystemreference \rt!exec \v!PreviousPage {previous} +\setglobalsystemreference \rt!exec \v!PrintDocument {print} +\setglobalsystemreference \rt!exec \v!SaveForm {exportform} +\setglobalsystemreference \rt!exec \v!LoadForm {importform} +\setglobalsystemreference \rt!exec \v!ResetForm {resetform} +\setglobalsystemreference \rt!exec \v!ResumeMovie {resumemovie} +\setglobalsystemreference \rt!exec \v!ResumeSound {resumesound} +\setglobalsystemreference \rt!exec \v!SaveDocument {save} +\setglobalsystemreference \rt!exec \v!SaveNamedDocument{savenamed} +\setglobalsystemreference \rt!exec \v!OpenNamedDocument{opennamed} +\setglobalsystemreference \rt!exec \v!SearchDocument {search} +\setglobalsystemreference \rt!exec \v!SearchAgain {searchagain} +\setglobalsystemreference \rt!exec \v!StartMovie {startmovie} +\setglobalsystemreference \rt!exec \v!StartSound {startsound} +\setglobalsystemreference \rt!exec \v!StopMovie {stopmovie} +\setglobalsystemreference \rt!exec \v!StopSound {stopsound} +\setglobalsystemreference \rt!exec \v!SubmitForm {submitform} +\setglobalsystemreference \rt!exec \v!SwapViewer {swap} +\setglobalsystemreference \rt!exec \v!ViewerHelp {help} +\setglobalsystemreference \rt!exec \v!HideField {hide} +\setglobalsystemreference \rt!exec \v!ShowField {show} +\setglobalsystemreference \rt!exec \v!GotoPage {gotopage} +\setglobalsystemreference \rt!exec \v!Query {query} +\setglobalsystemreference \rt!exec \v!QueryAgain {queryagain} +\setglobalsystemreference \rt!exec \v!FitWidth {fitwidth} +\setglobalsystemreference \rt!exec \v!FitHeight {fitheight} %D Executing the command looks alike the previous goto macros. diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index 7a400695c..81f6c822f 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -96,17 +96,11 @@ %D efficient, but sometimes give better results. The dimensions %D of the resullting box are set to zero. -\setvalue{\v!punt graybox}% - {\processraster\symbol\rasterdot} +\setvalue{\v!punt graybox}{\processraster\symbol\rasterdot} +\setvalue{\v!lijn graybox}{\processraster\symbol\rasterbox} -\setvalue{\v!lijn graybox}% - {\processraster\symbol\rasterbox} - -\def\rasterdot% - {\rasterfont.} - -\def\rasterbox% - {\hss\vrule\!!width.4pt\!!height.4pt\!!depth\zeropoint} +\def\rasterdot{\rasterfont.} +\def\rasterbox{\hss\vrule\!!width.4pt\!!height.4pt\!!depth\zeropoint} %D Now of course we need: @@ -146,7 +140,7 @@ %D %D \showsetup{\y!setupscreens} -\def\setupscreens% +\def\setupscreens {\dodoubleargument\getparameters[\??rs]} %D The most appropriate way to call for this feature is @@ -1289,15 +1283,29 @@ \localbegstrut \let\next=} +% \def\doformatboxWidth% +% {\vbox +% \bgroup +% \dopresetformatbox +% \hsize\!!widtha +% \raggedcommand +% \bgroup +% \localbegstrut +% \aftergroup\localendstrut +% \aftergroup\egroup +% \let\next=} + \def\doformatboxWidth% {\vbox \bgroup \dopresetformatbox \hsize\!!widtha \raggedcommand + \dobeforeframedbox \bgroup \localbegstrut \aftergroup\localendstrut + \aftergroup\doafterframedbox \aftergroup\egroup \let\next=} diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index 03006bb13..288d01748 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -354,16 +354,29 @@ % suited for chinese too: +% \def\@@sectionconversion#1#2% a doublure with \@@shortsectionnumber +% {\ifnum#2=0 0\else % else troubles with \uchar +% \@EA\ifx\csname\??se#1\@@sectieblok\c!conversie\endcsname\relax +% \@EA\ifx\csname\??se#1\c!conversie\endcsname\relax +% #2% +% \else +% \getvalue{\??cv\getvalue{\??se#1\c!conversie}}{#2}% +% \fi +% \else +% \getvalue{\??cv\getvalue{\??se#1\@@sectieblok\c!conversie}}{#2}% +% \fi +% \fi} + \def\@@sectionconversion#1#2% a doublure with \@@shortsectionnumber {\ifnum#2=0 0\else % else troubles with \uchar \@EA\ifx\csname\??se#1\@@sectieblok\c!conversie\endcsname\relax \@EA\ifx\csname\??se#1\c!conversie\endcsname\relax #2% \else - \getvalue{\??cv\getvalue{\??se#1\c!conversie}}{#2}% + \convertnumber{\getvalue{\??se#1\c!conversie}}{#2}% \fi \else - \getvalue{\??cv\getvalue{\??se#1\@@sectieblok\c!conversie}}{#2}% + \convertnumber{\getvalue{\??se#1\@@sectieblok\c!conversie}}{#2}% \fi \fi} @@ -1118,16 +1131,25 @@ \fi \fi}} - \def \writtenfullsectionnumber {\string\fullsectionnumber} - \def \ignoredfullsectionnumber#1#2#3{#3} - \let \storedfullsectionnumber \relax -\unexpanded\def \naturalfullsectionnumber#1#2#3{\sectiebloklabel{#1}{\getvalue{\??cv#2}{#3}}} - \def\expandablefullsectionnumber#1#2#3{#3} -\unexpanded\def \limitedfullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}} + \def \writtenfullsectionnumber {\string\fullsectionnumber} + \def \ignoredfullsectionnumber#1#2#3{#3} + \let \storedfullsectionnumber \relax +% \def\expandablefullsectionnumber#1#2#3{#3} +%\unexpanded\def \naturalfullsectionnumber#1#2#3{\sectiebloklabel{#1}{\getvalue{\??cv#2}{#3}}} +%\unexpanded\def \limitedfullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}} % under test: % -% \def\expandablefullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}} +% \def\expandablefullsectionnumber#1#2#3{\getvalue{\??cv#2}{#3}} + +\def\expandablefullsectionnumber#1#2#3% + {\convertnumber{#2}{#3}} + +\unexpanded\def\naturalfullsectionnumber#1#2#3% + {\sectiebloklabel{#1}{\convertnumber{#2}{#3}}} + +\unexpanded\def\limitedfullsectionnumber#1#2#3% + {\convertnumber{#2}{#3}} \def\setfullsectionnumber#1% {\doifelsevalue{#1\c!kopconversie}{\v!ja} diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index a4e111f06..9f2750b4d 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -1190,6 +1190,8 @@ \newdimen\openlineheight \newdimen\openstrutheight \newdimen\openstrutdepth +\newdimen\topskipgap + \def\strutheightfactor {.72} \def\strutdepthfactor {.28} @@ -1227,6 +1229,7 @@ \def\topskipcorrection% {\ifdim\topskip>\openstrutheight + % == \vskip\topskipgap \vskip\topskip \vskip-\openstrutheight \fi @@ -1239,6 +1242,8 @@ \ifr@ggedbottom\!!plus5\globalbodyfontsize\fi \fi \relax % the skip + \topskipgap\topskip + \advance\topskipgap -\openstrutheight\relax \ifdim\topskip<\strutheightfactor\openlineheight \topskip\strutheightfactor\openlineheight\relax \fi} @@ -1270,7 +1275,8 @@ \def\spacing#1% {\ifgridsnapping - \doifnot{#1}{1}{\showmessage{\m!layouts}{11}{#1}}% + %\doifnot{#1}{1}{\showmessage{\m!layouts}{11}{#1}}% + \ifdim#1pt=1pt\else\showmessage{\m!layouts}{11}{#1}\fi \edef\spacingfactor{1}% \else \edef\spacingfactor{#1}% @@ -1636,7 +1642,7 @@ % % much faster and important since TABLE uses them a lot: -\def\dodosetraggedcommand#1% +\def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! {\let\raggedcommand\relax \let\raggedtopcommand\empty \let\raggedbottomcommand\empty diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex index 7d7dba09e..eb2b19e30 100644 --- a/tex/context/base/core-tbl.tex +++ b/tex/context/base/core-tbl.tex @@ -715,6 +715,245 @@ %D The main processing macro is large but splitting it up %D would make things less clear. +\def\doregistertabulateparoptions + {\ifinsidefloat \else \iftrialtypesetting \else + \registerparoptions + \global\let\registertabulateparoptions\empty + \fi \fi} + +\appendtoks + \global\let\registertabulateparoptions\doregistertabulateparoptions +\to \everytabulate + +\newtoks\everytabulaterow + +\appendtoks + \registertabulateparoptions +\to \everytabulaterow + +% keep for a while ! ! ! +% +% \def\processtabulate[|#1|]% in the process of optimizing +% {\tabulateunit=\getvalue{\??tt\currenttabulate\c!eenheid}% +% \checkfulltabulatecontent +% \ExpandFirstAfter\processaction % use \setalignmentswitch instead +% [\getvalue{\??tt\currenttabulate\c!uitlijnen}] +% [\v!normaal=>\def\@@tabulatealign{0}, % = default value +% \v!rechts=>\def\@@tabulatealign{1}, +% \v!links=>\def\@@tabulatealign{2}, +% \v!midden=>\def\@@tabulatealign{3}, +% \s!default=>\def\@@tabulatealign{0}, +% \s!unknown=>\def\@@tabulatealign{0}]% +% \let\pretabskip\!!zeropoint +% \def\postabskip{.5\tabulateunit}% +% %\doglobal\newcounter\tabulatecolumns +% %\doglobal\newcounter\nofautotabulate +% \global\tabulatecolumns\zerocount +% \global\nofautotabulate\zerocount +% \doglobal\newcounter\noftabulatelines +% \let\totalnoftabulatelines\noftabulatelines +% \let\minusnoftabulatelines\noftabulatelines +% \global\tabulatepwidth\zeropoint +% \global\tabulateequalfalse +% \resettabulatepheight +% \def\NC{\tabulatenormalcolumn0}% +% \def\RC{\tabulatenormalcolumn1}% +% \def\HC{\tabulatenormalcolumn2}% +% \def\EQ{\tabulateequalcolumn 0}% +% \def\RQ{\tabulateequalcolumn 1}% +% \def\HQ{\tabulateequalcolumn 2}% +% \def\NG{\NC\handletabulatecharalign}% +% \def\NR% next row +% {\doglobal\increment\noftabulatelines +% \global\tabulatefirstflushedfalse +% \global\tabulateequalfalse +% \xdef\tabulatecolumn{0}% +% \resettabulatepheight +% \unskip\unskip\crcr\flushtabulated +% \TABLEnoalign +% {\iftolerantTABLEbreak\else +% \ifnum\noftabulatelines=1 +% \dotabulatenobreak +% \else\ifnum\noftabulatelines=\minusnoftabulatelines +% \ifnum\tabulatemaxplines<2 +% \dotabulatenobreak +% \fi +% \fi\fi +% \fi +% \global\tabulatefirstflushedfalse}}% +% \let\HL\empty \let\SR\NR \let\AR\NR +% \let\FL\empty \let\FR\NR +% \let\ML\empty \let\MR\NR +% \let\LL\empty \let\LR\NR +% \global\let\flushtabulated\empty +% \let\savedbar=|\let|=\nexttabulate +% \tabskip\zeropoint +% \ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint +% \!!toksa{&\hbox to \tabulateindent{\the\everytabulaterow\hss}##% +% \tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut +% &##\tabskip\zeropoint}% +% \else +% \!!toksa{&\hbox to \tabulateindent{\the\everytabulaterow\hss}##\strut&##}% +% \fi +% \tabulatewidth\zeropoint +% |#1X|\relax +% \tabulatewidth\zeropoint +% \dorecurse\tabulatecolumns % can be made faster +% {\doifundefinedelse{\@@tabbox@@\recurselevel} +% {\expandafter\newbox\csname\@@tabbox@@\recurselevel\endcsname}% +% {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}% +% \appendtoks&##\to\!!toksa +% \appendtoks\doglobal\increment\tabulatecolumn\to\!!toksa +% \appendtoks\NC\unskip\unskip\crcr\flushtabulated\to\tabulatedummy % no count +% \xdef\tabulatecolumn{0}% +% \resettabulatepheight +% \def\bskip% +% {\setbox\tabulatebox=\vbox\bgroup +% \global\let\tabulatehook\notabulatehook}% +% \def\eskip +% {\par\egroup +% \global\let\tabulatehook\dotabulatehook}% +% \let|\savedbar +% \global\let\tabulatehook\dotabulatehook +% \doifvalue{\??tt\currenttabulate\c!inspringen}{\v!nee} +% {\forgetparindent}% +% \ifinsidefloat +% \let\tabulateindent\!!zeropoint +% \else +% \setlocalhsize \hsize\localhsize +% \fi +% \dontcomplain +% \forgetall +% \setbox0=\vbox % outside if because of line counting +% {\footnotesenabledfalse +% \let\tabulateindent\!!zeropoint +% \trialtypesettingtrue % very important +% \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}}% +% \ifnum\nofautotabulate>0 +% \tabulatewidth\hsize +% \advance\tabulatewidth -\wd0 +% \advance\tabulatewidth -\tabulatepwidth +% \ifnum\nofautotabulate>0 +% \divide\tabulatewidth \nofautotabulate\relax +% \fi +% \fi +% \ifsplittabulate +% \splittopskip\ht\strutbox +% \global\let\flushtabulatedindeed\empty +% \long\def\bbskip% +% {\ifvoid\csname\@@tabbox@@\tabulatecolumn\endcsname +% \ifx\flushtabulatedindeed\empty\else +% \setbox0\hbox +% \fi +% \fi}% +% \def\bskip% +% {\ifvoid\csname\@@tabbox@@\tabulatecolumn\endcsname +% \global\setbox\csname\@@tabbox@@\tabulatecolumn\endcsname=\vbox +% \bgroup +% \global\let\tabulatehook\notabulatehook +% \ifautotabulate\hsize\tabulatewidth\fi +% %\begstrut % interferes with pre-\pars +% \ignorespaces +% \def\eskip% +% {\par\egroup +% \settabulatepheight +% \global\let\tabulatehook\dotabulatehook +% \splitofftabulatebox}% +% \else +% \let\eskip\empty +% \dontcomplain +% \global\let\tabulatehook\dotabulatehook +% \expandafter\splitofftabulatebox +% \fi}% +% \gdef\flushtabulated% +% {\TABLEnoalign % noalign % no interference ! +% {\global\let\flushtabulatedindeed\empty +% \handletabulatepbreak +% \dorecurse\tabulatecolumns % was: \noftabcolumns +% {\ifvoid\csname\@@tabbox@@\recurselevel\endcsname\else +% \gdef\flushtabulatedindeed{\the\tabulatedummy}% +% \fi}% +% \global\tabulatefirstflushedtrue}% +% \flushtabulatedindeed}% +% \else +% % tabhook op alles ? +% \def\bskip% +% {\vtop\bgroup +% \ifautotabulate\hsize\tabulatewidth\fi +% %\begstrut % interferes with pre-\pars +% \ignorespaces}% +% \def\eskip% +% {\par\egroup}% +% \fi +% \let\totalnoftabulatelines\noftabulatelines +% \let\minusnoftabulatelines\noftabulatelines +% \decrement\minusnoftabulatelines +% \doglobal\newcounter\noftabulatelines +% \def\HL{\TABLEnoalign +% {\ifnum\noftabulatelines=0 \FL +% \else\ifnum\noftabulatelines<\totalnoftabulatelines\relax \ML +% \else \LL +% \fi\fi}}% +% \def\tablebaselinecorrection +% {\def\dobaselinecorrection +% {\vskip-\prevdepth +% \vskip\dp\strutbox +% \vskip\dp\strutbox}% +% \baselinecorrection}% +% \def\FL{\TABLEnoalign +% {\ifinsidefloat\else +% \doifemptyvalue{\??tt\currenttabulate\c!voor} % no expansion +% {\tablebaselinecorrection}% +% \fi +% \tabulaterule +% \dotabulatenobreak +% \tabulateruleseperator +% \prevdepth\dp\strutbox +% \dotabulatenobreak}}% +% \def\ML{\TABLEnoalign +% {\tabulateruleseperator +% \tabulaterule +% \ifnum\noftabulatelines>1 \ifnum\noftabulatelines<\minusnoftabulatelines +% \vskip\topskip\allowbreak\vskip-\topskip +% \vskip-\getvalue{\??tt\currenttabulate\c!lijndikte}% +% \tabulaterule +% \fi\fi +% \tabulateruleseperator}}% +% \def\LL{\TABLEnoalign +% {\dotabulatenobreak +% \tabulateruleseperator +% \dotabulatenobreak +% \tabulaterule +% \ifinsidefloat\else +% \doifemptyvalue{\??tt\currenttabulate\c!na} % no expansion +% {\vskip\dp\strutbox +% \vbox{\strut}% +% \vskip-\lineheight}% +% \fi}}% +% \chardef\tabulatepass=2 +% \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}% +% \prevdepth\dp\strutbox % nog eens beter, temporary hack +% \doifvalue{\??tt\currenttabulate\c!afstand}{\v!grid} +% {\vskip-\dp\strutbox}% experimental tm-prikkels +% \egroup +% \ifinsidefloat \else +% \getvalue{\??tt\currenttabulate\c!na}% +% \fi +% \egroup} + +\def\flushtabulateindent + {\ifnum\tabulatecolumn=0 + \hbox to \tabulateindent + {% we now have a local hsize, and since we want to + % register positional info (i.e. real hsizes) we + % need to reconstitute the original hsize + \advance\hsize\tabulateindent + % this is indeed rtaher messy and took a few hours + % to dis/uncover + \the\everytabulaterow + \hss}% + \fi} + \def\processtabulate[|#1|]% in the process of optimizing {\tabulateunit=\getvalue{\??tt\currenttabulate\c!eenheid}% \checkfulltabulatecontent @@ -761,20 +1000,22 @@ \dotabulatenobreak \fi \fi\fi - \fi}}% + \fi + \global\tabulatefirstflushedfalse}}% \let\HL\empty \let\SR\NR \let\AR\NR \let\FL\empty \let\FR\NR \let\ML\empty \let\MR\NR \let\LL\empty \let\LR\NR \global\let\flushtabulated\empty \let\savedbar=|\let|=\nexttabulate - \tabskip\zeropoint + \tabskip\zeropoint \ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint - \!!toksa{&\hbox to \tabulateindent{}##% + \!!toksa{&\flushtabulateindent\strut##% \tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut &##\tabskip\zeropoint}% \else - \!!toksa{&\hbox to \tabulateindent{}##\strut&##}% + \!!toksa{&\flushtabulateindent\strut##% + &##\tabskip\zeropoint}% \fi \tabulatewidth\zeropoint |#1X|\relax @@ -801,7 +1042,7 @@ \ifinsidefloat \let\tabulateindent\!!zeropoint \else - \setlocalhsize \hsize=\localhsize + \setlocalhsize \hsize\localhsize \fi \dontcomplain \forgetall @@ -809,7 +1050,7 @@ {\footnotesenabledfalse \let\tabulateindent\!!zeropoint \trialtypesettingtrue % very important - \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}}% + \@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}}% \ifnum\nofautotabulate>0 \tabulatewidth\hsize \advance\tabulatewidth -\wd0 @@ -849,11 +1090,12 @@ \gdef\flushtabulated% {\TABLEnoalign % noalign % no interference ! {\global\let\flushtabulatedindeed\empty +\xdef\tabulatecolumn{0}% \handletabulatepbreak \dorecurse\tabulatecolumns % was: \noftabcolumns {\ifvoid\csname\@@tabbox@@\recurselevel\endcsname\else \gdef\flushtabulatedindeed{\the\tabulatedummy}% - \fi} + \fi}% \global\tabulatefirstflushedtrue}% \flushtabulatedindeed}% \else @@ -908,11 +1150,11 @@ \ifinsidefloat\else \doifemptyvalue{\??tt\currenttabulate\c!na} % no expansion {\vskip\dp\strutbox - \vbox{\strut} + \vbox{\strut}% \vskip-\lineheight}% \fi}}% \chardef\tabulatepass=2 - \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}% + \@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}% \prevdepth\dp\strutbox % nog eens beter, temporary hack \doifvalue{\??tt\currenttabulate\c!afstand}{\v!grid} {\vskip-\dp\strutbox}% experimental tm-prikkels diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index fe369675a..d82dc3bf2 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -459,7 +459,7 @@ % \edef\!!stringa{\getvalue{#1\c!escape}}% % \@EA\catcode\@EA`\!!stringa=\@@escape} -\def\setupcommandsintype#1% +\def\setupcommandsintype#1% can also be \string\ {\setupgroupedtype \edef\\{\getvalue{#1\c!escape}}% \letvalue{\\}=\\% for instance \/=/ @@ -787,7 +787,7 @@ \c!evenmarge=\!!zeropoint, \c!onevenmarge=\!!zeropoint, \c!blanko=\v!regel, - \c!escape=/, + \c!escape=/, % beware \string\ , should also be accepted \c!regels=] %D \macros @@ -1097,8 +1097,11 @@ %\processfileverbatim{\pathplusfile\f!currentpath{#2}}% \stopverbatimcolor \stopopelkaar} % includes \egroup - {{\tttf[\makemessage{\m!verbatims}{1}{#2}]}% - \showmessage{\m!verbatims}{1}{#2}}% + {\bgroup + \expanded{\convertargument#2}\to\ascii + \tttf[\makemessage{\m!verbatims}{1}\ascii]% + \showmessage{\m!verbatims}{1}\ascii + \egroup}% \getvalue{\??tp#1\c!na}} %D \macros diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex index 507844bf1..880d398b1 100644 --- a/tex/context/base/enco-def.tex +++ b/tex/context/base/enco-def.tex @@ -368,7 +368,8 @@ % idem -\def\promille{\permille} +\def\promille{\perthousand} +\def\permille{\perthousand} \def\procent {\percent } \def\permine {\fakepermine} diff --git a/tex/context/base/font-chi.tex b/tex/context/base/font-chi.tex index 49c70aeb2..267e75563 100644 --- a/tex/context/base/font-chi.tex +++ b/tex/context/base/font-chi.tex @@ -879,6 +879,12 @@ \defineconversion [ac] [\arabicchinesenumber] \defineconversion [arabicchinese] [\arabicchinesenumber] +%D Date conversion: + +\defineconversion [cn] [\v!dag] [\chinesenumber] +\defineconversion [cn] [\v!maand] [\chinesenumber] +\defineconversion [cn] [\v!jaar] [\chinesenumber] + %D \macros %D {SimChi, TraChi} %D diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex index 016fcfe56..4af5532ee 100644 --- a/tex/context/base/font-ini.tex +++ b/tex/context/base/font-ini.tex @@ -1523,7 +1523,6 @@ \setfontcharacteristics \the\everyfontswitch \fi} - \endTEX \beginETEX \ifcsname @@ -2127,8 +2126,8 @@ \ifdefiningunknownfont \else \definingunknownfonttrue \def\defineunknownsubfont##1% - {\doifundefined{\@size@\getvalue{\??ft#1##1}} - {\defineunknownfont{\getvalue{\??ft#1##1}}}}% + {\doifundefined{\@size@\getvalue{\??ft#1##1}} + {\defineunknownfont{\getvalue{\??ft#1##1}}}}% \processcommalist [\s!text,\s!script,\s!scriptscript,\c!x,\c!xx,\c!groot,\c!klein] \defineunknownsubfont @@ -2318,10 +2317,10 @@ \def\dodoswitchpoints#1% {\doifundefined{\@size@#1} {\defineunknownfont{#1}}% - \defineunknownfontstyles{#1}% + %\defineunknownfontstyles{#1}% \doifdefinedelse{\@size@#1} {\getvalue{\@size@#1}% - \localbodyfontsize=#1\relax + \localbodyfontsize#1\relax \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize \checkbodyfontenvironment[\normalizedbodyfontsize]} {\showmessage{\m!fonts}{4}{#1}}} @@ -2405,7 +2404,7 @@ \doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \fi}% - \chardef\currentxfontsize=0\relax} + \chardef\currentxfontsize0\relax} \def\dodosetfont#1#2% #1 = set/switch state {\dododosetfont{#1}{#2}{\showmessage{\m!fonts}{4}{#2}}} @@ -2417,11 +2416,11 @@ \doifundefined{\@size@\normalizedsetfont} {\defineunknownfont{#2}}% \doifdefinedelse{\@size@\normalizedsetfont} - {\localbodyfontsize=\normalizedsetfont - \let\normalizedbodyfontsize=\normalizedsetfont} + {\localbodyfontsize\normalizedsetfont + \let\normalizedbodyfontsize\normalizedsetfont} {#3\dosetsubstitutefont{#1}{#2}}} {\doifelse{#2}{\v!reset} - {\let\fontsize=\empty} + {\let\fontsize\empty} {\doifdefinedelse{\@style@#2} {\edef\fontstyle{#2}} {\doreadfontdefinitionfile{#1}{#2}}}}} @@ -2678,7 +2677,7 @@ \beginTEX \def\dosetcurrentfontxxxalternative#1#2#3#4% - {\chardef\currentxfontsize=#2 + {\chardef\currentxfontsize#2 \ifmmode #4% \else\expandafter\ifx\csname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname\relax\else @@ -2690,7 +2689,7 @@ \beginETEX \ifcsname \def\dosetcurrentfontxxxalternative#1#2#3#4% - {\chardef\currentxfontsize=#2 + {\chardef\currentxfontsize#2 \ifmmode #4% \else\ifcsname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname diff --git a/tex/context/base/lang-chi.tex b/tex/context/base/lang-chi.tex index 31829073e..9367e2fd4 100644 --- a/tex/context/base/lang-chi.tex +++ b/tex/context/base/lang-chi.tex @@ -24,18 +24,18 @@ \installlanguage[\s!cn][\c!status=\v!start] -\setupheadtext [\s!cn] [\v!inhoud=\uchar{196}{191}\uchar{194}{188}] -\setupheadtext [\s!cn] [\v!tabellen=\uchar{196}{191}\uchar{177}{237}] -\setupheadtext [\s!cn] [\v!figuren=\uchar{196}{191}\uchar{205}{188}] +\setupheadtext [\s!cn] [\v!inhoud={\cnencodecontents}] +\setupheadtext [\s!cn] [\v!tabellen={\cnencodetables}] +\setupheadtext [\s!cn] [\v!figuren={\cnencodefigures}] \setupheadtext [\s!cn] [\v!grafieken=Graphics] \setupheadtext [\s!cn] [\v!intermezzos=Intermezzos] -\setupheadtext [\s!cn] [\v!index=\uchar{203}{247}\uchar{210}{253}] -\setupheadtext [\s!cn] [\v!afkortingen=Abbreviations] -\setupheadtext [\s!cn] [\v!logos=Logos] -\setupheadtext [\s!cn] [\v!eenheden=Units] +\setupheadtext [\s!cn] [\v!index={\cnencodeindex}] +\setupheadtext [\s!cn] [\v!afkortingen={\cnencodeabbreviations}] +\setupheadtext [\s!cn] [\v!logos={\cnencodelogos}] +\setupheadtext [\s!cn] [\v!eenheden={\cnencodeunits}] -\setuplabeltext [\s!cn] [\v!tabel=\uchar{177}{237} ] -\setuplabeltext [\s!cn] [\v!figuur=\uchar{205}{188} ] +\setuplabeltext [\s!cn] [\v!tabel={\cnencodetable}] +\setuplabeltext [\s!cn] [\v!figuur={\cnencodefigure}] \setuplabeltext [\s!cn] [\v!intermezzo=Intermezzo ] \setuplabeltext [\s!cn] [\v!grafiek=Illustration ] \setuplabeltext [\s!cn] [\v!bijlage=] @@ -57,6 +57,15 @@ \def\cnencoding{\enableencoding[\chineseencoding]} % ugly and temporary \startencoding[gbk] + \definecommand cnencodecontents {\uchar{196}{191}\uchar{194}{188}} + \definecommand cnencodetables {\uchar{177}{237}\uchar{184}{241}} + \definecommand cnencodefigures {\uchar{205}{188}\uchar{208}{206}} + \definecommand cnencodeindex {\uchar{203}{247}\uchar{210}{253}} + \definecommand cnencodeabbreviations {\uchar{203}{245}\uchar{194}{212}\uchar{211}{239}} + \definecommand cnencodelogos {\uchar{187}{213}\uchar{177}{225}} + \definecommand cnencodeunits {\uchar{188}{198}\uchar{193}{191}\uchar{181}{165}\uchar{206}{187}} + \definecommand cnencodetable {\uchar{177}{237}} + \definecommand cnencodefigure {\uchar{205}{188}} \definecommand cnencodedintro {\uchar{181}{218}} \definecommand cnencodedpart {\uchar{178}{191}\uchar{183}{214}} \definecommand cnencodedchapter {\uchar{213}{194}} @@ -64,6 +73,15 @@ \stopencoding \startencoding[big5] + \definecommand cnencodecontents {\uchar{165}{216}\uchar{191}{253}} + \definecommand cnencodetables {\uchar{170}{237}\uchar{174}{230}} + \definecommand cnencodefigures {\uchar{185}{207}\uchar{167}{206}} + \definecommand cnencodeindex {\uchar{175}{193}\uchar{174}{222}} + \definecommand cnencodeabbreviations {\uchar{191}{89}\uchar{178}{164}\uchar{187}{121}} + \definecommand cnencodelogos {\uchar{192}{178}\uchar{188}{208}} + \definecommand cnencodeunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}} + \definecommand cnencodetable {\uchar{170}{237}} + \definecommand cnencodefigure {\uchar{185}{207}} \definecommand cnencodedintro {\uchar{178}{196}} \definecommand cnencodedpart {\uchar{179}{161}\uchar{164}{192}} \definecommand cnencodedchapter {\uchar{179}{185}} @@ -98,6 +116,7 @@ \setuplabeltext [\s!cn] [\v!thursday=\uchar{208}{199}\uchar{198}{218}\uchar{203}{196}] \setuplabeltext [\s!cn] [\v!friday=\uchar{208}{199}\uchar{198}{218}\uchar{206}{229}] \setuplabeltext [\s!cn] [\v!saturday=\uchar{208}{199}\uchar{198}{218}\uchar{193}{249}] + \stopencoding \startencoding[big5] diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex index 6f515f1ee..365c77cbe 100644 --- a/tex/context/base/lang-ita.tex +++ b/tex/context/base/lang-ita.tex @@ -448,6 +448,8 @@ \highordinalstr{er}% \fi} +\defineconversion [\s!fr] [\v!dag+] [\frordinaldaynumber] + %D \ShowAllLanguageValues [\s!fr] [french] franse slag %D \ShowAllLanguageValues [\s!es] [spanish] spaans benauwd %D \ShowAllLanguageValues [\s!it] [italian] italiaanse ... diff --git a/tex/context/base/lang-lab.tex b/tex/context/base/lang-lab.tex index 0db599889..167b0a956 100644 --- a/tex/context/base/lang-lab.tex +++ b/tex/context/base/lang-lab.tex @@ -99,34 +99,35 @@ \def\labellanguage{\defaultlanguage\currentmainlanguage} \def\headlanguage {\defaultlanguage\currentmainlanguage} -\def\headtext% +\unexpanded\def\headtext {\let\handletextprefix\firstoftwoarguments \dogetupsometextprefix\headlanguage\c!titel} -\def\leftlabeltext% +\unexpanded\def\leftlabeltext {\let\handletextprefix\firstoftwoarguments \dogetupsometextprefix\labellanguage\c!label} -\def\rightlabeltext% +\unexpanded\def\rightlabeltext {\let\handletextprefix\secondoftwoarguments \dogetupsometextprefix\labellanguage\c!label} +\unexpanded\def\LEFTLABELTEXT + {\def\handletextprefix##1##2{\uppercase{##1}}\DOLABELTEXT} + +\unexpanded\def\RIGHTLABELTEXT + {\def\handletextprefix##1##2{\uppercase{##2}}\DOLABELTEXT} + \def\DOLABELTEXT#1% {\bgroup \the\everyuppercase \dogetupsometextprefix\labellanguage\c!label{#1}% not \labeltext (see \MONTH) \egroup} -\def\LEFTLABELTEXT% - {\def\handletextprefix##1##2{\uppercase{##1}}\DOLABELTEXT} - -\def\RIGHTLABELTEXT% - {\def\handletextprefix##1##2{\uppercase{##2}}\DOLABELTEXT} - \let\labeltext \leftlabeltext \let\LABELTEXT \LEFTLABELTEXT -\def\labeltexts#1#2{\leftlabeltext{#1}#2\rightlabeltext{#1}} -\def\LABELTEXTS#1#2{\LEFTLABELTEXT{#1}#2\RIGHTLABELTEXT{#1}} + +\unexpanded\def\labeltexts#1#2{\leftlabeltext{#1}#2\rightlabeltext{#1}} +\unexpanded\def\LABELTEXTS#1#2{\LEFTLABELTEXT{#1}#2\RIGHTLABELTEXT{#1}} \newif\iflabeltextdone % needs to be reset elsewhere \newif\iftracinglabels % shows missing labels diff --git a/tex/context/base/lang-spe.tex b/tex/context/base/lang-spe.tex index 845040dce..bd34674b2 100644 --- a/tex/context/base/lang-spe.tex +++ b/tex/context/base/lang-spe.tex @@ -25,7 +25,12 @@ \newevery \everyresetlanguagespecifics \relax -\def\resetlanguagespecifics{\the\everyresetlanguagespecifics} +\def\resetlanguagespecifics + {\ifcase\protectionlevel + \the\everyresetlanguagespecifics + \else % to be translated + \writestatus{system}{don't change language in unprotected mode!}% + \fi} \appendtoks \resetlanguagespecifics @@ -163,19 +168,30 @@ \expanded{\doglobal\noexpand\appendtoks{#1}{\the\catcode`#1}}\to\everyresetlanguagespecifics \fi} -\def\dodeactivatetoken#1#2#3% - {\def#1{#2}\catcode`#2=#3\relax} +% \def\dodeactivatetoken#1#2#3% +% {\def#1{#2}\catcode`#2=#3\relax} + +\def\dodeactivatetoken#1#2#3% tets needed to avoid clash with \unprotect + {\def#1{#2}\ifnum\catcode`#2=\@@active\catcode`#2=#3\relax\fi} %D We cannot hook this into the installer since language %D specifics can be anything. So far, we have the following %D potentially active characters. +%D Beware, this should happen under an unprotected regime; +%D thanks to Giuseppe Oblomov Bilotta, who first noticed +%D that something was wrong. + +\protect + \deactivatelanguagespecific " \deactivatelanguagespecific / \deactivatelanguagespecific : \deactivatelanguagespecific ; \deactivatelanguagespecific ? \deactivatelanguagespecific ! + +\unprotect %D \macros %D {ordinaldaynumber, highordinalstr, ordinalstr} diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex index 95d768cc3..0a30652da 100644 --- a/tex/context/base/m-chart.tex +++ b/tex/context/base/m-chart.tex @@ -320,13 +320,13 @@ \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}} -\def\FLOWshapes% +\def\FLOWshapes {node, action, procedure, product, decision, archive, loop, wait, subprocedure, singledocument, multidocument, sub procedure, single document, multi document, up, down, left, right} -\def\FLOWlines% +\def\FLOWlines {up, down, left, right} \def\FLOWsetconnect#1% @@ -361,7 +361,7 @@ \def\@@FLOW@@offset{\@@FLOWoffset} -\def\getFLOWchart% +\def\getFLOWchart {\dodoubleempty\dogetFLOWchart} \def\dogetFLOWchart[#1][#2]% @@ -386,8 +386,8 @@ \doifsomething{\@@FLOWautofocus} {\checkFLOWautofocus}% %\message{AUTOSHAPE 3: (\@@FLOWx,\@@FLOWy)->(\@@FLOWnx,\@@FLOWny)}\wait - \let\FLOWwidth \@@FLOWnx - \let\FLOWheight\@@FLOWny + \global\let\FLOWwidth \@@FLOWnx + \global\let\FLOWheight\@@FLOWny \let\startFLOWcell\startFLOWcellA \resetFLOWlocation \processFLOWbuffer\currentFLOWnumber @@ -435,12 +435,12 @@ \dimen0=\@@FLOWbreedte \edef\FLOWshapewidth{\the\dimen0}% \dimen2=\@@FLOWdx - \advance\dimen0 by 2\dimen2 + \advance\dimen0 2\dimen2 \edef\FLOWgridwidth{\the\dimen0}% \dimen0=\@@FLOWhoogte \edef\FLOWshapeheight{\the\dimen0}% \dimen2=\@@FLOWdy - \advance\dimen0 by 2\dimen2 + \advance\dimen0 2\dimen2 \edef\FLOWgridheight{\the\dimen0}% \scratchdimen=\@@FLOSlijndikte \edef\@@FLOSlijndikte{\the\scratchdimen}% @@ -487,8 +487,8 @@ connection_dash_size := \@@FLOLstraal ; % \stopMPdrawing % \def\getFLOWlocationX##1,##2\end% -% {\ifnum0##1>\FLOWwidth \edef\FLOWwidth {##1}\fi -% \ifnum0##2>\FLOWheight\edef\FLOWheight{##2}\fi}% +% {\ifnum0##1>\FLOWwidth \xdef\FLOWwidth {##1}\fi +% \ifnum0##2>\FLOWheight\xdef\FLOWheight{##2}\fi}% % \long\def\startFLOWcellX##1\stopFLOWcell% % {\resetFLOWcell % \ignorespaces##1\unskip @@ -624,9 +624,9 @@ \expandafter\getFLOWlocationA\FLOWlocation\end \ignorespaces} -\def\getFLOWlocationA#1,#2\end% - {\ifnum0#1>\FLOWwidth \edef\FLOWwidth {#1}\fi - \ifnum0#2>\FLOWheight\edef\FLOWheight{#2}\fi} +\def\getFLOWlocationA#1,#2\end + {\ifnum0#1>\FLOWwidth \xdef\FLOWwidth {#1}\fi + \ifnum0#2>\FLOWheight\xdef\FLOWheight{#2}\fi} % Pass B % @@ -772,16 +772,16 @@ \ifdim\getvalue{\@@MPy\FLOWcomment}bp<\areaMPlly\relax\else \ifdim\getvalue{\@@MPy\FLOWcomment}bp>\areaMPury\relax\else \dimen0=\getvalue{\@@MPx\FLOWcomment}bp - \advance\dimen0 by -\@@FLOW@@offset - \advance\dimen0 by -\clipMPllx + \advance\dimen0 -\@@FLOW@@offset + \advance\dimen0 -\clipMPllx \dimen2=\clipMPury - \advance\dimen2 by -\@@FLOW@@offset - \advance\dimen2 by -\getvalue{\@@MPy\FLOWcomment}bp + \advance\dimen2 -\@@FLOW@@offset + \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}bp \setbox0=\hbox{\strut#2}% \boxoffset=.5\bodyfontsize \setbox0=\hbox {\hskip\dimen0\lower\dimen2\getvalue{FLOW#1}{\box0}}% - \wd0=\!!zeropoint\ht0=\!!zeropoint\dp0=\!!zeropoint + \wd0=\zeropoint\ht0=\zeropoint\dp0=\zeropoint \box0 \fi \fi diff --git a/tex/context/base/math-ini.tex b/tex/context/base/math-ini.tex index de2ea3ffa..eae2b41ef 100644 --- a/tex/context/base/math-ini.tex +++ b/tex/context/base/math-ini.tex @@ -347,7 +347,7 @@ {\doinputonce{\truefilename{\f!mathprefix#1}}% \setvalue{\@mc@\fontclass\@mc@}{#1}} -\def\autoenablemathcollection% +\def\autoenablemathcollection {\doifdefinedelse{\@mc@\fontclass\@mc@} {\enablemathcollection[\getvalue{\@mc@\fontclass\@mc@}]} {\enablemathcollection[\s!default]}} % ? ? ? diff --git a/tex/context/base/math-lbr.tex b/tex/context/base/math-lbr.tex index d6ecb8de5..c93f81cc2 100644 --- a/tex/context/base/math-lbr.tex +++ b/tex/context/base/math-lbr.tex @@ -135,14 +135,12 @@ \stoprawmathcollection -% Should these be related to the bodyfontsize ? - -\def\LBRbig #1{{\hbox{$\left#1\vbox to 8.20\p@{}\right.\n@space$}}} -\def\LBRBig #1{{\hbox{$\left#1\vbox to 10.80\p@{}\right.\n@space$}}} -\def\LBRbigg #1{{\hbox{$\left#1\vbox to 13.42\p@{}\right.\n@space$}}} -\def\LBRBigg #1{{\hbox{$\left#1\vbox to 16.03\p@{}\right.\n@space$}}} -\def\LBRbiggg#1{{\hbox{$\left#1\vbox to 17.72\p@{}\right.\n@space$}}} -\def\LBRBiggg#1{{\hbox{$\left#1\vbox to 21.25\p@{}\right.\n@space$}}} +\def\LBRbig {\@@dobig{8.20}} +\def\LBRBig {\@@dobig{10.80}} +\def\LBRbigg {\@@dobig{13.42}} +\def\LBRBigg {\@@dobig{16.03}} +\def\LBRbiggg{\@@dobig{17.72}} +\def\LBRBiggg{\@@dobig{21.25}} \startrawmathcollection[lbr] diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex index 9ac574889..98680895f 100644 --- a/tex/context/base/math-tex.tex +++ b/tex/context/base/math-tex.tex @@ -435,10 +435,10 @@ \stopmathcollection -\def\PLAINbig #1{{\hbox{$\left#1\vbox to 8.5\p@{}\right.\n@space$}}} -\def\PLAINBig #1{{\hbox{$\left#1\vbox to 11.5\p@{}\right.\n@space$}}} -\def\PLAINbigg#1{{\hbox{$\left#1\vbox to 14.5\p@{}\right.\n@space$}}} -\def\PLAINBigg#1{{\hbox{$\left#1\vbox to 17.5\p@{}\right.\n@space$}}} +\def\PLAINbig {\@@dobig{0.85}} +\def\PLAINBig {\@@dobig{1.15}} +\def\PLAINbigg{\@@dobig{1.45}} +\def\PLAINBigg{\@@dobig{1.75}} \startrawmathcollection [default] diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex index 4a9f619b9..30d10054c 100644 --- a/tex/context/base/meta-ini.tex +++ b/tex/context/base/meta-ini.tex @@ -399,11 +399,9 @@ %D The current data is loaded with: \def\getMPdata - {\blabelgroup - \startreadingfile - \readlocfile{\MPdatafile}{}{}% - \stopreadingfile - \elabelgroup} + {\startreadingfile + \readlocfile\MPdatafile\donothing\donothing + \stopreadingfile} %D When we collect graphics in one file, we run into %D troubles, since \METAPOST\ has a built in limit (of 4) @@ -411,13 +409,11 @@ %D better to collect all data in one file and filter it. \def\getMPdata - {\blabelgroup - \long\def\MPdata##1##2% + {\long\def\MPdata##1##2% {\ifnum##1=\currentMPgraphic\relax##2\fi}% \startreadingfile - \readlocfile{\MPgraphicfile.mpd}{}{}% - \stopreadingfile - \elabelgroup} + \readlocfile{\MPgraphicfile.mpd}\donothing\donothing + \stopreadingfile} %D We have to enable this mechanism with: @@ -600,6 +596,7 @@ LineHeight := \the\baselineskip ; BodyFontSize := \the\bodyfontsize ; % + TopSkip := \the\topskip ; StrutHeight := \strutheight ; StrutDepth := \strutdepth ; % diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex index f33fa3ee2..afc08750e 100644 --- a/tex/context/base/meta-pag.tex +++ b/tex/context/base/meta-pag.tex @@ -27,9 +27,9 @@ %D pagebody looks. \startuseMPgraphic{page data} - boolean PageStateAvailable, OnRightPage, InPageBody ; + boolean PageStateAvailable, OnRightPage, InPageBody ; PageStateAvailable := OnRightPage := true ; - InPageBody := \ifinpagebody true \else false \fi ; + InPageBody := \ifinpagebody true \else false \fi ; def LoadPageState = OnRightPage := \MPonrightpage ; RealPageNumber := \the\realpageno ; @@ -120,4 +120,55 @@ \includeMPgraphic{page data} \to \MPinitializations +%D The next feature provides information about for instance +%D column positions. This is an experimental feature, +%D introduced when we needed backgrounds in columns (fill||in +%D questions as implemented in a private module). +%D +%D See \type {mp-page.mp} for the definition of the macros: +%D +%D \startabulatie[|tl|l|p|] +%D \NC ResetTextAreas \NC no arguments \NC +%D reset areas on page \NC \NR +%D \NC RegisterTextArea \NC x, y, w, h \NC +%D adds area to the list \NC \NR +%D \NC TextAreaX,Y,W,H,XY,WH \NC x and/or y \NC +%D reports offsets and dimensions \NC \NR +%D \stoptabulatie +%D +%D The \type {TextArea*} macros can be used to determine +%D overlap. + +\newcounter\currentMPtextareadata + +\newtoks\MPsavedtextareadata +\newtoks\MPtextareadata + +\def\registerMPtextarea#1% + {\bgroup + \doglobal\increment\currentMPtextareadata + \hpos{gbd:\currentMPtextareadata}{#1}% + \edef\!!stringa{gbd:\currentMPtextareadata}% + \edef\!!stringa{RegisterTextArea(% + \MPx\!!stringa,\MPy\!!stringa,\MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}% + \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata + \egroup} + +\appendtoks + \includeMPgraphic{area data} +\to \MPinitializations + +\startuseMPgraphic{area data} + ResetTextAreas ; + \the\MPsavedtextareadata + SaveTextAreas ; + ResetTextAreas ; + \the\MPtextareadata +\stopuseMPgraphic + +\appendtoks + \global\MPsavedtextareadata\MPtextareadata + \global\MPtextareadata \emptytoks +\to \everyshipout + \protect \endinput diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index 7ed1002a1..fab93c462 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -2015,6 +2015,7 @@ trefwoord: trefwoord keyword vorigeonevenpagina: vorigeonevenpagina previousoddpage vorigeungeradeseite predchozilichastranka paginadispariprecedente paginaimparaprecedenta + alleenleesbaar: alleenleesbaar readonly nurlesbar pouzeprocteni solalettura readonly @@ -2040,6 +2041,10 @@ trefwoord: trefwoord keyword bookmark zalozka segnalibro semncarte +geencontrole: geencontrole nocheck + nocheck nocheck + nocheck nocheck + % GB TB TH : binnenmarge: binnenmarge innermargin @@ -2443,6 +2448,12 @@ trefwoord: trefwoord keyword SaveDocument: BewaarDocument SaveDocument SpeichereDokument UlozitDokument SalvaDocumento SalvareDocument + SaveNamedDocument: BewaarDocumentOpNaam SaveNamedDocument + SaveNamedDocument SaveNamedDocument + SaveNamedDocument SaveNamedDocument + OpenNamedDocument: OpenDocumentOpNaam OpenNamedDocument + OpenNamedDocument OpenNamedDocument + OpenNamedDocument OpenNamedDocument ViewerHelp: ViewerHelp ViewerHelp ViewerHilfe NapovedaProhlizece AiutoVisualizzatore AjutorVizualizator diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index 6095ad070..2f7b98ac2 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -392,7 +392,7 @@ \c!sectienummer=\@@kjsectienummer, \c!scheider=\@@kjscheider, \c!conversie=\@@kjconversie]% - \doorlabelen + \definieernummer % \doorlabelen [#1] [\c!tekst=#1, \c!plaats=\v!intekst, @@ -1720,38 +1720,6 @@ \appendtoks\the\everytopofpage \to\everystarttext \appendtoks\global\everytopofpage{}\to\everystoptext -%\def\douitstellen% -% {\the\everytopofpage -% \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is -% \global\pagetotal\zeropoint % recently added -% \global\inuitstellentrue % definitely needed -% \dorecurse{\nofpostponedblocks} % else we can loose -% {\haalbuffer[buf-\recurselevel]} % or disorder floats -% \doflushfloats % new but potential dangerous % and that is something -% \doglobal\newcounter\nofpostponedblocks % we don't want, do we? -% \global\inuitstellenfalse % Anyhow, 'uitstellen' -% \fi\fi} % is still suboptimal. - -% \def\douitstellen% -% {\the\everytopofpage -% \ifvoid\collectedpagefloats\else -% % message -% \unvbox\collectedpagefloats -% \fi -% \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is -% \bgroup -% \restoreglobalbodyfont % else problems inside split verbatim -% % message -% \global\pagetotal\zeropoint % recently added -% \global\inuitstellentrue % definitely needed -% \dorecurse{\nofpostponedblocks} % else we can loose -% {\haalbuffer[buf-\recurselevel]} % or disorder floats -% \doflushfloats % new but potential dangerous % and that is something -% \doglobal\newcounter\nofpostponedblocks % we don't want, do we? -% \global\inuitstellenfalse % Anyhow, 'uitstellen' -% \egroup -% \fi\fi} % is still suboptimal. - \def\douitstellen% {\the\everytopofpage \ifvoid\collectedpagefloats\else diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index 22530676a..535d68717 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -17,6 +17,45 @@ \unprotect +% to be moved code: + +\newif\ifclippagebox \clippageboxtrue + +\def\clippedpagebox#1#2% + {\ifclippagebox + \!!widthc\pagebackgroundoffset + \!!widtha \papierbreedte + \advance\!!widtha \!!widthc + \!!heighta\papierhoogte + \advance\!!heighta\!!widthc + \advance\!!heighta\!!widthc + \setbox#2\vbox to \papierhoogte{\vfill\box#2}% + \ht#2\papierhoogte + \wd#2\papierbreedte + \setbox#2\vbox + {\framed + [\c!offset=\!!widthc,\c!strut=\v!nee,\c!kader=\v!uit] + {\box#2}}% + \setbox#2\hbox to \papierbreedte + {\ifcase#1\relax + \hskip-\!!widthc + \lower\!!widthc\hbox + {\clip + [\c!breedte=\!!widtha,\c!hoogte=\!!heighta, + \c!hoffset=\zeropoint,\c!voffset=\zeropoint] + {\box#2}}% + \or + \lower\!!widthc\hbox + {\clip + [\c!breedte=\!!widtha,\c!hoogte=\!!heighta, + \c!hoffset=\!!widthc,\c!voffset=\zeropoint] + {\box#2}}% + \fi}% + \wd#2\papierbreedte + \ht#2\papierhoogte + \fi + \box#2\relax} + % moved code: \def\myshipout#1% @@ -419,19 +458,36 @@ \setbox\scratchbox\vsplit\arrangedpageB to \scratchdimen \fi} +% \def\handlearrangedpageTWOUP% +% {\splitoffarrangedpagesTWO +% \ifswaparranged +% \global\setbox\arrangedpageA\hbox +% {\box\arrangedpageA\box\arrangedpageB}% +% \swaparrangedfalse +% \else +% \global\setbox\arrangedpageA\hbox +% {\box\arrangedpageB\box\arrangedpageA}% +% \swaparrangedtrue +% \fi +% \global\ht\arrangedpageA\papierhoogte +% \global\setbox\arrangedpageB\box\scratchbox} + \def\handlearrangedpageTWOUP% {\splitoffarrangedpagesTWO \ifswaparranged - \global\setbox\arrangedpageA\hbox - {\box\arrangedpageA\box\arrangedpageB}% + \global\setbox\arrangedpageA=\hbox + {\clippedpagebox0\arrangedpageA + \clippedpagebox1\arrangedpageB}% \swaparrangedfalse \else - \global\setbox\arrangedpageA\hbox - {\box\arrangedpageB\box\arrangedpageA}% + \global\setbox\arrangedpageA=\hbox + {\clippedpagebox0\arrangedpageB + \clippedpagebox1\arrangedpageA}% \swaparrangedtrue \fi - \global\ht\arrangedpageA\papierhoogte - \global\setbox\arrangedpageB\box\scratchbox} + \global\ht\arrangedpageA=\papierhoogte + \global\setbox\arrangedpageB=\box\scratchbox} + \def\handlearrangedpageTWODOWN% {\splitoffarrangedpagesTWO diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex index 9dff9163a..18c69b769 100644 --- a/tex/context/base/page-set.tex +++ b/tex/context/base/page-set.tex @@ -156,17 +156,17 @@ \dorecurse\tofcolumns {\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}% \global\columnfirstcell=0 - \global\columnlastcell=\columnfirstcell - \global\columnfreecells=\columnfirstcell + \global\columnlastcell\columnfirstcell + \global\columnfreecells\columnfirstcell \egroup} \endTEX \def\doOTRSETsetgridcells#1#2#3#4#5#6% placeholder col row wid hei {data} - {\!!countd=#2\advance\!!countd#4\advance\!!countd-1 - \!!counte=#3\advance\!!counte#5\advance\!!counte-1 + {\!!countd#2\advance\!!countd#4\advance\!!countd-1 + \!!counte#3\advance\!!counte#5\advance\!!counte-1 \dostepwiserecurse{#2}{\!!countd}{1} - {\!!countf=\recurselevel + {\!!countf\recurselevel \dostepwiserecurse{#3}{\!!counte}{1} {\OTRSETsetgridcell\!!countf\recurselevel#1}}% \dostepwiserecurse{#3}{\!!counte}{1} @@ -180,11 +180,11 @@ {\doOTRSETsetgridcells{\box\voidb@x}{#1}{#2}{#3}{#4}{\box\voidb@x}} \def\OTRSETsetfreecells#1#2% col start - {\global\columnfirstcell=\ifnum#2=0 1\else#2\fi\relax + {\global\columnfirstcell\ifnum#2=0 1\else#2\fi\relax \ifnum\columnfirstcell>\columnmaxcells - \global\columnfreecells=0 - \global\columnfirstcell=1 - \global\columnlastcell=0 + \global\columnfreecells0 + \global\columnfirstcell1 + \global\columnlastcell 0 \global\somefreecolumncellsfalse %\message{no cells a}% \else @@ -196,7 +196,7 @@ {\global\advance\columnfirstcell 1 } {\exitloop}% \fi}% - \global\columnlastcell=\columnfirstcell + \global\columnlastcell\columnfirstcell \doloop {\ifnum\columnlastcell>\columnmaxcells\relax \exitloop @@ -206,16 +206,16 @@ {\global\advance\columnlastcell 1 }% \fi}% \ifnum\columnfirstcell>\columnmaxcells - \global\columnfreecells=0 - \global\columnfirstcell=1 - \global\columnlastcell=0 + \global\columnfreecells0 + \global\columnfirstcell1 + \global\columnlastcell 0 \global\somefreecolumncellsfalse %\message{no cells b}% \else \ifnum\columnlastcell>\columnmaxcells - \global\columnlastcell=\columnmaxcells + \global\columnlastcell\columnmaxcells \fi - \global\columnfreecells=\columnlastcell + \global\columnfreecells\columnlastcell \global\advance\columnfreecells -\columnfirstcell \global\advance\columnfreecells 1 \global\somefreecolumncellstrue @@ -224,7 +224,7 @@ \fi} \def\OTRSETgetmaxfreecells#1#2% col start - {\scratchcounter=0 + {\scratchcounter0 \edef\columnmaxfreecells{0}% \edef\columnfrmfreecells{0}% \dostepwiserecurse{#2}{\columnmaxcells}{1} @@ -233,7 +233,7 @@ \edef\columnmaxfreecells{\the\scratchcounter}% \let\columnfrmfreecells\recurselevel \fi - \scratchcounter=0 } + \scratchcounter0 } {\advance\scratchcounter 1 }}} \long\def\OTRSETrecurseRL#1% @@ -249,18 +249,19 @@ \def\OTRSETdomakegridbox#1#2#3% {\hbox\bgroup -% -\ifbalancecolumns - \ifnum\realpageno=\balancingpageno\relax - \!!heighta \localcolumnmaxcells\lineheight -\xdef\localcolumnmaxcells{0}% - \else - \!!heighta \teksthoogte - \fi -\else - \!!heighta \teksthoogte -\fi -% + % +\forgetall % can go once in flush + \ifbalancecolumns + \ifnum\realpageno=\balancingpageno\relax + \!!heighta \localcolumnmaxcells\lineheight + \xdef\localcolumnmaxcells{0}% + \else + \!!heighta \teksthoogte + \fi + \else + \!!heighta \teksthoogte + \fi + % % test first ! \hbox to \zetbreedte {\dostepwiserecurse{#1}{#2}{#3} @@ -270,10 +271,14 @@ [\??mc\OTRSETidentifier\number\mofcolumns]% [\c!breedte=\localcolumnwidth,\c!hoogte=\!!heighta]% \teksthoogte]% {}% +\wd\scratchbox\localcolumnwidth +\ht\scratchbox\!!heighta \ifcase\columndirection - \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox + \hskip\OTRSETgetparameter\c!afstand\recurselevel + \box\scratchbox \else - \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel + \box\scratchbox + \hskip\OTRSETgetparameter\c!afstand\recurselevel \fi}}% \hskip-\zetbreedte % main text @@ -303,6 +308,26 @@ \fi}}% \egroup} +\ifx\registerMPtextarea\undefined + \let\registerMPtextarea\firstofoneargument +\fi + +\def\OTRSETregistergridbox#1#2% + {\bgroup + \setbox\nextbox\null + \wd\nextbox\wd#2% + \ht\nextbox\ht#2% + \dp\nextbox\dp#2% + \setbox\nextbox\hbox{\lower\dp\strutbox\box\nextbox}% + \ifnum#1=1 + \setbox\nextbox\hbox{\raise\topskip\hbox{\lower\ht\strutbox\box\nextbox}}% + \dp\nextbox\dp\strutbox + \fi + \setbox\nextbox\hbox{\registerMPtextarea{\box\nextbox}}% + \smashbox\nextbox + \box\nextbox\box#2% + \egroup} + \def\OTRSETreducegridbox% {\ifnum\localcolumnmaxcells>0 \let\columnmaxcells\localcolumnmaxcells @@ -310,10 +335,10 @@ \def\OTRSETflushfinalfootnotes {\ifcase\lastcolumnlastcell \else - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\placebottomnotes}% \ifdim\ht\scratchbox>\zeropoint - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\hbox to \zeropoint{\OTRSETgetgridcell\nofcolumns\lastcolumnlastcell}% \box\scratchbox}% \ht\scratchbox\ht\strutbox @@ -336,7 +361,7 @@ \def\OTRSETdoflush {\ifcollectingcontent - \global\mofcolumns=1 + \global\mofcolumns1 \else \OTRSETdofinalflush \OTRSETdofinaloutput @@ -363,10 +388,10 @@ \OTRSETcentergridcells \bgroup % we want to keep the reduction local \OTRSETreducegridbox - \global\setbox\OTRfinalpagebox=\OTRSETmakegridbox + \global\setbox\OTRfinalpagebox\OTRSETmakegridbox \egroup % otherwise we get the wrong number of free cells %\gdef\localcolumnmaxcells{0}% here ? - \global\mofcolumns=\nofcolumns} % otherwise problems in finaloutput + \global\mofcolumns\nofcolumns} % otherwise problems in finaloutput \def\OTRSETdofinaloutput {\ifdim\ht\OTRfinalpagebox=\teksthoogte @@ -378,7 +403,7 @@ \appendtoks \OTRSETflushbalancinglist \to \everystoptext \def\OTRSETflushbalancinglist% - {\scratchcounter=0 + {\scratchcounter0 \def\docommando##1% {\advance\scratchcounter 1 \immediatewriteutilitycommand @@ -440,7 +465,7 @@ \egroup \fi \page\relax % hack. \page should be page - \OTRSETsethsize} +}% \OTRSETsethsize} % no, can be mid smaller (like tabulate) \newtoks\OTRSETeverystartofcolumn @@ -500,11 +525,12 @@ \def\OTRSEThandleflushedtext#1% {\getnoflines{\ht\scratchbox}% - \wd\scratchbox=\hsize + \wd\scratchbox=\tekstbreedte % geen \hsize kan < zijn in bv split tabulate \doOTRSETsetgridcells {\copy\placeholderboxf} {\mofcolumns}{\columnfirstcell}{1}{\noflines} - {\copy\scratchbox}% \box + %{\copy\scratchbox}% \box + {\hbox{\OTRSETregistergridbox\columnfirstcell\scratchbox}}% \global\columnlastcell=\columnfirstcell \global\advance\columnlastcell \noflines \global\lastcolumnlastcell\columnlastcell @@ -515,7 +541,7 @@ \fi \OTRSETfindnextgap %\message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait - \OTRSETsethsize +% \OTRSETsethsize % no, can be mid smaller (like tabulate) \OTRSETsetvsize} \def\OTRSETfindnextgap% @@ -1163,6 +1189,7 @@ \OTRSETgotonextpage \OTRSETgetmanualbalance % here \OTRSETassignwidths + \OTRSETsethsize \else \bgroup \fi} @@ -1638,7 +1665,7 @@ \advance\!!heighta \topskip \fi \advance\!!heighta -\lineheight % option - \setbox\scratchbox\ruledvbox + \setbox\scratchbox\vbox {\donetrue\localframed [\??mt#1#2] [\c!breedte=\!!widtha,\c!hoogte=\!!heighta] @@ -1765,8 +1792,9 @@ \ifnum\!!countc>\!!countd \!!countc\!!countd \fi \setcolumnsetspanhsize\mofcolumns\!!countc % a/b used \hsize\columnsetspanhsize - \setupframedtexts[cs:#1][\c!breedte=\columnsetspanhsize,#2] - \setbox\scratchbox\hbox \bgroup + \setupframedtexts[cs:#1][\c!breedte=\columnsetspanhsize, +\c!regelcorrectie=\v!uit,\c!dieptecorrectie=\v!uit,#2] +\setbox\scratchbox\vbox\bgroup \dostartframedtext[cs:#1][\v!geen] \vskip-\lineheight\par\strut\par \framedtextparameter{cs:#1}\c!voor @@ -1776,8 +1804,10 @@ {\par \kern-\lineheight\prevdepth\dp\strutbox\strut \framedtextparameter{cs:#1}\c!na - \kern\zeropoint - \dostopframedtext \egroup + \kern\zeropoint % needed ? + \dostopframedtext +\vskip-\strutdepth % awful hack + \egroup \chardef\columnslotspacing0 % ! ! ! \OTRSETstoreincolumnslotHERE\scratchbox \egroup} diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex index 9fd7ead2e..e47d44d61 100644 --- a/tex/context/base/page-txt.tex +++ b/tex/context/base/page-txt.tex @@ -82,6 +82,7 @@ %\getparameters[\??tk#1\v!tekst][#2]% \getparameters[\??tk#1][#2]% \fi +% \checkcurrentlayout \calculatevsizes} \def\setuptop {\dotripleempty\dosetuplayouttext[\v!boven]} @@ -702,7 +703,7 @@ %D \hoofdstuk{tweede} \dorecurse{20}{\input tufte \relax} %D \stoptypen -\def\definetext% +\def\definetext {\doseventupleempty\dodefinetext} \def\dodefinetext[#1][#2][#3][#4][#5][#6][#7]% diff --git a/tex/context/base/s-chi-00.tex b/tex/context/base/s-chi-00.tex index 9bddd057d..30df05757 100644 --- a/tex/context/base/s-chi-00.tex +++ b/tex/context/base/s-chi-00.tex @@ -1,5 +1,5 @@ %D \module -%D [ file=s-chi-01, +%D [ file=s-chi-00, %D version=1999.12.21, %D title=\CONTEXT\ Style File, %D subtitle=Basic Chinese Style, diff --git a/tex/context/base/s-mod-00.tex b/tex/context/base/s-mod-00.tex index 26720368c..67142c3a6 100644 --- a/tex/context/base/s-mod-00.tex +++ b/tex/context/base/s-mod-00.tex @@ -14,19 +14,17 @@ %D This module looks like crap, is not documented, will %D change, and used to be called modu-*.tex. -\unprotect - % todo: % % file inclusions -> hyperlinks -\newprettytrue +\mainlanguage[en] % better not here \usemodule[eenheid] -\mainlanguage[en] +\enableactivediscretionaries \newprettytrue -\enableactivediscretionaries +\unprotect % beter: % @@ -68,7 +66,8 @@ \def\stopmodule% {\pagina - \plaatsregister[\v!index] + \plaatsregister + [\v!index] [\c!balanceren=\v!ja, \c!aanduiding=\v!nee, \c!criterium=\v!tekst]} @@ -138,7 +137,7 @@ [titelpagina] [\useMPgraphic{titlepage}] -% When run at \PRAGMA, we use a slightly difgferent graphic, +% When run at \PRAGMA, we use a slightly different graphic, % so that we can recognize an original. Users are not % supposed to mimick this feature. diff --git a/tex/context/base/s-pre-16.tex b/tex/context/base/s-pre-16.tex index 935ba244f..81f21ec60 100644 --- a/tex/context/base/s-pre-16.tex +++ b/tex/context/base/s-pre-16.tex @@ -187,7 +187,7 @@ \def\TitlePage#1% {\StartTitlePage#1\StopTitlePage} -\endinput +\doifnotmode{demo}{\endinput} \starttext diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex index 4837ed70b..f7812facb 100644 --- a/tex/context/base/setupb.tex +++ b/tex/context/base/setupb.tex @@ -727,7 +727,7 @@ \command [\y!typefile] \type - [\c!opt!\c!arg!\c!arg!] + [\c!opt!\c!val!\c!arg!] \value [\c!identifier!] [] diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex index 5546ecdb2..a60a17888 100644 --- a/tex/context/base/spec-fdf.tex +++ b/tex/context/base/spec-fdf.tex @@ -298,8 +298,8 @@ {/CropBox [\left\space\bottom\space\width\space\height]}% \xdef\currentPDFpagemode {/PageMode \ifcase#6 /UseNone\or/FullScreen\or/UseOutlines\else/UseNone\fi}% -% \xdef\currentPDFviewerprefs -% {\ifcase#6\or\or\or /ViewerPreferences << /FitWindow true >>\fi}% + \xdef\currentPDFviewerprefs + {\ifcase#6\or\or\or /ViewerPreferences << /FitWindow true >>\fi}% \egroup} \global\let\currentPDFcropbox \empty % page attributes @@ -566,6 +566,8 @@ \def\PDFexecuteexit {/Named /N /Quit} \def\PDFexecuteclose {/Named /N /Close} \def\PDFexecutesave {/Named /N /Save} +\def\PDFexecutesavenamed {/Named /N /SaveAs} +\def\PDFexecuteopennamed {/Named /N /Open} \def\PDFexecutehelp {/Named /N /HelpUserGuide} \def\PDFexecuteswap {/Named /N /FullScreen} \def\PDFexecutesearch {/Named /N /Find} @@ -774,27 +776,34 @@ %D are used to set states. Personally I hate this bitty way of %D doing things. The next six bit determine the field sub type: -\def\FDFflagMultiLine {4096} % 13 -\def\FDFflagNoToggleToOff {16384} % 15 -\def\FDFflagRadio {32768} % 16 -\def\FDFflagPushButton {65536} % 17 -\def\FDFflagPopUp {131072} % 18 -\def\FDFflagEdit {262144} % 19 +\def\FDFflagMultiLine {4096} % 13 +\def\FDFflagNoToggleToOff {16384} % 15 +\def\FDFflagRadio {32768} % 16 +\def\FDFflagPushButton {65536} % 17 +\def\FDFflagPopUp {131072} % 18 +\def\FDFflagEdit {262144} % 19 + +%D A few more (pdf 1.4) flags, what the spell check one: for +%D obscure reasons for Adobe downward compatibility means +%D enabling features that harm old applications like testing. + +\def\FDFflagDoNotSpellCheck {4194304} % 23 +\def\FDFflagDoNotScroll {8388608} % 24 %D The next bits (watch how strange the bits are organized) %D take care of the states: -\def\FDFflagReadOnly {1} % 1 -\def\FDFflagRequired {2} % 2 -\def\FDFflagNoExport {4} % 3 -\def\FDFflagPassword {8192} % 14 -\def\FDFflagSort {524288} % 20 +\def\FDFflagReadOnly {1} % 1 +\def\FDFflagRequired {2} % 2 +\def\FDFflagNoExport {4} % 3 +\def\FDFflagPassword {8192} % 14 +\def\FDFflagSort {524288} % 20 %D There is a second, again bitset oriented, \type{/F} flag: -\def\FDFplusInvisible {1} % 1 -\def\FDFplusHidden {2} % 2 -\def\FDFplusPrintable {4} % 3 +\def\FDFplusInvisible {1} % 1 +\def\FDFplusHidden {2} % 2 +\def\FDFplusPrintable {4} % 3 %D \macros %D {setFDFswitches} @@ -810,6 +819,8 @@ \letvalue {\@@FDFflag\v!beschermd}=\FDFflagPassword \letvalue {\@@FDFflag\v!gesorteerd}=\FDFflagSort \letvalue {\@@FDFflag\v!nietbeschikbaar}=\FDFflagNoExport +\letvalue {\@@FDFflag\v!geencontrole}=\FDFflagDoNotSpellCheck +\letvalue {\@@FDFflag\v!vast}=\FDFflagDoNotScroll \letvalue {\@@FDFplus\v!verborgen}=\FDFplusHidden \letvalue {\@@FDFplus\v!printbaar}=\FDFplusPrintable @@ -1241,11 +1252,13 @@ \setFDFattributes[#6]% \setFDFalignment[#8]% \setFDFactions[#9]% +\expanded{\escapePSstring#4}\to\FDFtext \ifcase\currentFDFmode \doPDFannotationobject class FDF name #1 width #2 height #3 data {/Subtype /Widget /T (#1) /FT /Tx /MaxLen \ifcase0#5 1000 \else#5 \fi - /DV (#4) /V (#4) % value added +% /DV (#4) /V (#4) % value added +/DV (\FDFtext) /V (\FDFtext) % value added /Ff \FDFflag\space /F \FDFplus\space /DA (\FDFattributes) @@ -1259,7 +1272,8 @@ {/T (#1) /FT /Tx /MaxLen \ifcase0#5 1000 \else#5 \fi /Kids [\FDFkids] - /DV (#4) /V (#4) % value added +% /DV (#4) /V (#4) % value added +/DV (\FDFtext) /V (\FDFtext) % value added /Ff \FDFflag\space /F \FDFplus\space /DA (\FDFattributes) diff --git a/tex/context/base/spec-mis.tex b/tex/context/base/spec-mis.tex index b05832085..65aa20116 100644 --- a/tex/context/base/spec-mis.tex +++ b/tex/context/base/spec-mis.tex @@ -132,4 +132,54 @@ {\chardef\submitoutputformat=3} {\chardef\submitoutputformat=1}}} +%D \macros +%D {escapePSstring} +%D +%D \starttypen +%D \escapePSstring(t\e\1st)))))\to\crap \crap +%D \stoptypen + +% testcase: webschrift met lege regels en unbalanced () + +\bgroup + +\catcode`\*=\@@escape +\catcode`\\=\@@letter + +*long*gdef*escapedPSstring#1% + {*aftergroup*string + *ifnum`#1=12 + *aftergroup*n% + *else*ifnum`#1=13 + *aftergroup*n% + *else*if#1(% + *aftergroup*(% + *else*if#1)% + *aftergroup*)% + *else*if#1\% + *aftergroup*\% + *else + *aftergroup#1% + *fi*fi*fi*fi*fi} + +*egroup + +\long\def\escapePSstring#1\to#2% + {\convertargument#1\to#2% + \bgroup + \ifx#2\empty \else + \setverbosecscharacters + \aftergroup\edef + \aftergroup#2% + \aftergroup{% + \expandafter\handletokens#2\with\escapedPSstring + \aftergroup}% + \fi + \egroup} + +\long\def\preservePSpar#1\to#2% + {\bgroup + \def\par{\rawcharacter{12}}% + \expanded{\egroup\noexpand\def\noexpand#2{#1}}} + \protect \endinput diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex index dcc46ac56..807c3c469 100644 --- a/tex/context/base/spec-tpd.tex +++ b/tex/context/base/spec-tpd.tex @@ -82,6 +82,12 @@ \newcount\pdflastximagepages \pdflastximagepages=1 \fi +%D And: + +\ifx\pdfpageresources\undefined + \newtoks\pdfpageresources +\fi + %D In order to get high quality \METAPOST\ inclusion, we set %D the number of digits to~5 (prevents rounding errors). diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex index d9e0e393b..e15833b60 100644 --- a/tex/context/base/supp-box.tex +++ b/tex/context/base/supp-box.tex @@ -569,20 +569,22 @@ %D and depth before being lapped into the margin. The %D previous examples ignore this side effect, but beware! -\newif\ifsomeshapeleft -\newif\ifreshapingbox - -\def\shapesignal {.12345678pt} +\newif \ifsomeshapeleft +\newif \ifreshapingbox \newbox \shapebox \newcount \shapepenalty \newdimen \shapekern \newskip \shapeskip -\newbox\newshapebox -\newbox\oldshapebox +\newbox \newshapebox +\newbox \oldshapebox + +\newcount \shapecounter + +\newevery \everyshapebox \relax -\newcount\shapecounter +\def\shapesignal{.12345678pt} \def\reshapebox#1% {\doreshapebox @@ -606,9 +608,9 @@ \fi} \def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip - {\ifdim\lastskip=\zeropoint\relax - \ifdim\lastkern=\zeropoint\relax - \ifcase\lastpenalty % =\zerocount + {\ifcase\lastskip % \ifdim\lastskip=\zeropoint\relax + \ifcase\lastkern % \ifdim\lastkern=\zeropoint\relax + \ifcase\lastpenalty % \ifnum\lastpenalty=\zerocount \setbox\shapebox\lastbox \ifvoid\shapebox \unskip\unpenalty\unkern @@ -643,19 +645,13 @@ \advance\shapecounter \plusone \fi} -%\def\beginofshapebox% -% {\setbox\oldshapebox=\normalvbox -% \bgroup -% \reshapingboxtrue -% \normalhbox to \shapesignal{\hss}} - \def\beginofshapebox% {\setbox\oldshapebox\normalvbox \bgroup \reshapingboxtrue + \the\everyshapebox \normalhbox to \shapesignal{\strut\hss}% plus \strut - \prevdepth\dp\strutbox % hm - }%\nointerlineskip} % suppress parskip + \prevdepth\dp\strutbox} % never \nointerlineskip \def\endofshapebox% {\endgraf @@ -787,35 +783,35 @@ \def\dohyphenateword#1#2#3% {\bgroup - \setbox0=\normalhbox + \setbox\scratchbox\normalhbox {\mindermeldingen - \widowpenalty=0 - \clubpenalty=0 - \setbox0=\normalvbox + \widowpenalty\zerocount + \clubpenalty\zerocount + \setbox0\normalvbox {\hsize\zeropoint \ #3}% \ifnum#1>0 \dorecurse{#1} - {\setbox2=\normalhbox - {\splittopskip=\openstrutheight + {\setbox2\normalhbox + {\splittopskip\openstrutheight \vsplit0 to \baselineskip}}% #2% \fi \loop - \setbox2=\normalhbox - {\splittopskip=\openstrutheight + \setbox2\normalhbox + {\splittopskip\openstrutheight \vsplit0 to \baselineskip}% \normalhbox {\unhbox2 - \setbox2=\lastbox + \setbox2\lastbox \normalvbox {\unvbox2 - \setbox2=\lastbox + \setbox2\lastbox \normalhbox{\unhbox2}}}% \ifdim\ht0>\zeropoint \repeat}% - \ht0=\ht\strutbox - \dp0=\dp\strutbox - \box0 + \ht\scratchbox\ht\strutbox + \dp\scratchbox\dp\strutbox + \box\scratchbox \egroup} \def\hyphenatedword% @@ -867,20 +863,20 @@ % \fi}} \def\dodoboundtext#1% - {\setbox2=\normalhbox{#1}% - \advance\dimen0 -\wd2 - \ifdim\dimen0>\zeropoint\relax#1\fi}% + {\setbox0\normalhbox{#1}% + \advance\scratchdimen -\wd0 + \ifdim\scratchdimen>\zeropoint\relax#1\fi}% \def\doboundtext#1#2#3% {\normalhbox - {\setbox0=\normalhbox{#1}% - \dimen0=#2\relax - \ifdim\wd0>\dimen0 - \setbox0=\normalhbox{#3}% - \advance\dimen0 -\wd0 + {\setbox\scratchbox\normalhbox{#1}% + \scratchdimen#2\relax + \ifdim\wd\scratchbox>\scratchdimen + \setbox\scratchbox\normalhbox{#3}% + \advance\scratchdimen -\wd\scratchbox \handletokens#1\with\dodoboundtext \fi - \box0}} + \box\scratchbox}} %D \macros %D {limitatetext} @@ -1165,7 +1161,7 @@ #2{\unhbox0}% == #2{#1} % was \unhcopy0 \else \isolatedwordstrue - \setbox0=\normalhbox + \setbox0\normalhbox {\ignorespaces \loop \setbox4\normalhbox diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex index 14cbd7684..3e471d651 100644 --- a/tex/context/base/supp-fil.tex +++ b/tex/context/base/supp-fil.tex @@ -533,11 +533,18 @@ \ifx\\\undefined \let\\\relax \fi +%D This changing catcodes is a direct result from the fact +%D that we support some long standing conventions with +%D regards to active characters (german ", polish /, +%D french : and ;). + \def\startreadingfile% beter een every {\doglobal\increment\readingfilelevel \setxvalue{\string\readingfilelevel::\readingfilelevel}% {\catcode`/ =\the\catcode`/% \catcode`" =\the\catcode`"% +\catcode`: =\the\catcode`:% +\catcode`; =\the\catcode`;% \catcode`< =\the\catcode`<% \catcode`> =\the\catcode`>% \catcode`\noexpand\\=\the\catcode`\\% @@ -546,6 +553,8 @@ \catcode`\noexpand\%=\the\catcode`\%}% \catcode`/ =\@@other \catcode`" =\@@other +\catcode`: =\@@other +\catcode`; =\@@other \catcode`< =\@@other \catcode`> =\@@other \catcode`\\=\@@escape diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex index 07f904b38..4630bdbac 100644 --- a/tex/context/base/supp-lan.tex +++ b/tex/context/base/supp-lan.tex @@ -458,7 +458,7 @@ \prewordbreak\discretionary{\textmodediscretionary} {\textmodediscretionary}{\textmodediscretionary}\prewordbreak \else\ifx(\next - \ifdim\lastskip>\!!zeropoint\relax + \ifdim\lastskip>\zeropoint\relax (\prewordbreak \else \prewordbreak\discretionary{}{(-}{(}\prewordbreak @@ -487,9 +487,9 @@ \nextnextnext} \def\checkbeforediscretionary% - {\setbox0=\lastbox - \ifdim\wd0=\!!zeropoint - \let\postwordbreak=\prewordbreak + {\setbox0\lastbox + \ifdim\wd0=\zeropoint + \let\postwordbreak\prewordbreak \fi \box0\relax} @@ -618,7 +618,7 @@ \prewordbreak\discretionary{\textmodediscretionary} {\textmodediscretionary}{\textmodediscretionary}\prewordbreak \else\ifnum\uccode`(=\nextuccode - \ifdim\lastskip>\!!zeropoint\relax + \ifdim\lastskip>\zeropoint\relax (\prewordbreak \else \prewordbreak\discretionary{}{(-}{(}\prewordbreak @@ -707,7 +707,7 @@ \prewordbreak\discretionary{\textmodediscretionary} {\textmodediscretionary}{\textmodediscretionary}\prewordbreak \else\convertargument(\to\next\ifx\next\discretionarytoken - \ifdim\lastskip>\!!zeropoint\relax + \ifdim\lastskip>\zeropoint\relax (\prewordbreak \else \prewordbreak\discretionary{}{(-}{(}\prewordbreak diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex index e12dba5f4..b4d5a00c5 100644 --- a/tex/context/base/supp-pdf.tex +++ b/tex/context/base/supp-pdf.tex @@ -112,11 +112,11 @@ \setbox\scratchbox=\hbox {\pdfrefximage\pdflastximage}% \hsize=\wd\scratchbox - \advance\hsize by -#3 - \advance\hsize by -#4 + \advance\hsize -#3 + \advance\hsize -#4 \vsize=\ht\scratchbox - \advance\vsize by -#5 - \advance\vsize by -#6 + \advance\vsize -#5 + \advance\vsize -#6 \setbox\scratchbox=\vbox to \vsize {\vskip-#5\hbox to \hsize{\hskip-#3\box\scratchbox\hss}}% \pdfxform\scratchbox @@ -1279,44 +1279,46 @@ % \edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime % \edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime -\beginETEX +%D We cannot use \type {\beginETEX} here since in plain we +%D get \type {\outer} problems, sigh. - \newdimen\MPcriteriumA \MPcriteriumA=512pt - \newdimen\MPcriteriumB \MPcriteriumB= 2pt +% \beginTEX -\endETEX +\def\MPcriteriumA {512pt} % scale +\def\MPcriteriumB {2pt} % scale -%D We don't waste dimen registers when uting normal \TEX: - -\beginTEX - - \def\MPcriteriumA{512pt} % position - \def\MPcriteriumB {2pt} % scale +% \endTEX +% -\endTEX +% \ifx\MPcriteriumA\undefined +% +% \newdimen\MPcriteriumA \MPcriteriumA=512pt +% \newdimen\MPcriteriumB \MPcriteriumB= 2pt +% +% \fi \def\doMPconcat#1#2#3#4% {\dimen12=#1pt % p_x \dimen14=#3pt % p_y % -\chardef\MPfactor0 -\ifdim\dimen4<\MPcriteriumB\ifdim\dimen4>-\MPcriteriumB - \ifdim\dimen6<\MPcriteriumB\ifdim\dimen6>-\MPcriteriumB - \ifdim\dimen8<\MPcriteriumB\ifdim\dimen8>-\MPcriteriumB - \ifdim\dimen10<\MPcriteriumB\ifdim\dimen10>-\MPcriteriumB - \chardef\MPfactor1 - \fi\fi - \fi\fi - \fi\fi -\fi\fi -\ifcase\MPfactor0 - \chardef\MPfactor1 - \ifdim\dimen12<\MPcriteriumA\ifdim\dimen12>-\MPcriteriumA - \ifdim\dimen14<\MPcriteriumA\ifdim\dimen14>-\MPcriteriumA - \chardef\MPfactor16 - \fi\fi - \fi\fi -\fi + \chardef\MPfactor0 + \ifdim\dimen4<\MPcriteriumB\ifdim\dimen4>-\MPcriteriumB + \ifdim\dimen6<\MPcriteriumB\ifdim\dimen6>-\MPcriteriumB + \ifdim\dimen8<\MPcriteriumB\ifdim\dimen8>-\MPcriteriumB + \ifdim\dimen10<\MPcriteriumB\ifdim\dimen10>-\MPcriteriumB + \chardef\MPfactor1 + \fi\fi + \fi\fi + \fi\fi + \fi\fi + \ifcase\MPfactor0 + \chardef\MPfactor1 + \ifdim\dimen12<\MPcriteriumA\ifdim\dimen12>-\MPcriteriumA + \ifdim\dimen14<\MPcriteriumA\ifdim\dimen14>-\MPcriteriumA + \chardef\MPfactor16 + \fi\fi + \fi\fi + \fi % \multiply\dimen12 \MPfactor \multiply\dimen14 \MPfactor diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index 0f3b7a6ff..f95bdcfa2 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -224,8 +224,18 @@ \fi \advance\protectionlevel -1 } -\def\reportunprotection{\message{<unprotect \the\protectionlevel>}} -\def\reportprotection {\message{<protect \the\protectionlevel>}} +\def\reportunprotection {\message{<unprotect \protectionstate>}} +\def\reportprotection {\message{<protect \protectionstate>}} +\def\reportprotectionstate{\message{<protectionstate \protectionstate>}} + +\def\protectionstate + {\the\protectionlevel + \ifcase\protectionthreshold + :\space + @=\the\catcode`@\space\space + !=\the\catcode`!\space\space + ?=\the\catcode`?% + \fi} \ifx\everyeof\undefined @@ -233,8 +243,8 @@ \else - \def\checkprotection% - {\everyeof{\writestatus{protection}{level: \the\protectionlevel}}} + \def\checkprotection + {\everyeof{\writestatus{protection}{state: \protectionstate}}} \fi @@ -470,7 +480,7 @@ %D {\next}. \long\def\doifnextcharelse#1#2#3% #1 should not be {} ! - {\let\charactertoken=#1% + {\let\charactertoken=#1% = needed here \def\!!stringa{#2}% \def\!!stringb{#3}% \futurelet\nexttoken\inspectnextcharacter} diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex index eb92a95b0..5fd8eaaa9 100644 --- a/tex/context/base/syst-new.tex +++ b/tex/context/base/syst-new.tex @@ -272,12 +272,22 @@ \newcount\modcounter -\def\DoMod #1by#2to#3% +%\def\DoMod #1by#2to#3% +% {\modcounter#1\divide\modcounter#2\multiply\modcounter#2% +% #3#1\advance#3 -\modcounter} +% +%\def\DoDiv #1by#2to#3% +% {#3#1\divide#3 #2\relax} + +\def\dosetmodulo#1#2#3% {\modcounter#1\divide\modcounter#2\multiply\modcounter#2% - #3#1\advance#3 -\modcounter} + #3#1\advance#3-\modcounter} -\def\DoDiv #1by#2to#3% +\def\dosetdivision#1#2#3% {#3#1\divide#3 #2\relax} + +\def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} +\def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} \def\dounprotected#1\par% {#1\protect} diff --git a/tex/context/base/type-exa.tex b/tex/context/base/type-exa.tex index 0f256ee43..0ca857c17 100644 --- a/tex/context/base/type-exa.tex +++ b/tex/context/base/type-exa.tex @@ -50,7 +50,7 @@ \stoptypescript -\starttypescript [lucida] [texnansi] +\starttypescript [lucida] [texnansi,ec,8r] \definetypeface [lucida] [rm] [serif] [lucida] [default] [encoding=\typescripttwo] \definetypeface [lucida] [ss] [sans] [lucida] [default] [encoding=\typescripttwo] diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex index 6d35d282a..40ca335b8 100644 --- a/tex/context/base/xtag-ext.tex +++ b/tex/context/base/xtag-ext.tex @@ -147,15 +147,47 @@ \gdef\doifelseXMLelement#1% {\doifdefinedelse{\@@XMLsave:#1}} +\gdef\doifelseXMLelementcontent#1% + {\ifcsname\@@XMLsave:#1\endcsname + \bgroup + \@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to\ascii + \setbox\scratchbox\hbox{\ignorespaces\ascii\unskip\unskip\unskip}% + \ifdim\wd\scratchbox>\zeropoint + \egroup\@EAEAEA\firstoftwoarguments + \else + \egroup\@EAEAEA\secondoftwoarguments + \fi + \else + \@EA\secondoftwoarguments + \fi} + +\gdef\doifelseXMLelementequals#1#2% + {\ifcsname\@@XMLsave:#1\endcsname + \bgroup + \@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to\asciia + \convertargument#2\to\asciib + \ifx\asciia\asciib + \egroup\@EAEAEA\firstoftwoarguments + \else + \egroup\@EAEAEA\secondoftwoarguments + \fi + \else + \@EA\secondoftwoarguments + \fi} + +\gdef\convertXMLelement#1\to#2% + {\ifcsname\@@XMLsave:#1\endcsname + \@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to#2% + \else + \let#2\ascii + \fi} + \gdef\flushXMLelement#1% - {\csname\@@XMLsave:#1\endcsname} + {\csname + \@@XMLsave:\ifcsname\@@XMLsave:#1\endcsname#1\else\@@XMLsave\fi + \endcsname} -%\gdef\flushXMLelement#1% -% {\csname -% \@@XMLsave:\ifcsname\@@XMLsave:#1\endcsname#1\else\@@XMLsave\fi -% \endcsname} -% -%\letvalue{\@@XMLsave:\@@XMLsave}\empty +\global\letvalue{\@@XMLsave:\@@XMLsave}\empty \gdef\showXMLelement#1% {\showvalue{\@@XMLsave:#1}} @@ -175,6 +207,23 @@ \scantokens\@EA\@EA\@EA{\csname\@@XMLsave:#1\endcsname}% \endgroup} +\gdef\reduceXMLescapeentities + {\setXMLentity{amp}{\string&}% + \setXMLentity{lt}{\string<}% + \setXMLentity{gt}{\string>}% + \setXMLentity{quot}{\string'}% + \setXMLentity{dquot}{\string"}} + +\gdef\reduceXMLelement#1\to#2% + {\ifcsname\@@XMLsave:#1\endcsname + \bgroup + \reduceXMLescapetokens + \reduceXMLescapeentities + \expanded{\egroup\noexpand\def\noexpand#2{\csname\@@XMLsave:#1\endcsname}}% + \else + \let#2\empty + \fi} + \egroup \def\potentialXMLentity#1% diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index 3b051f477..b6d3c6bf6 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -251,6 +251,19 @@ .the.everyenableXML E +.gdef.reduceXMLescapetokens* + B.def#B.string#E* + .def$B.string$E* + .def%B.string%E* + .def\B.string\E* + .def^B.string^E* + .def_B.string_E* + .def{B.string{E* + .def}B.string}E* + .def|B.string|E* + *def~B.string~E* + E + * The following macro can be invokes when reading from * an auxiliary file. @@ -859,11 +872,11 @@ \def\simpleXMLencoding{raw} -\def\simplifyXMLentities% +\def\simplifyXMLentities {\fastenableencoding\simpleXMLencoding \XMLsimpleentitiestrue} -\def\defineXMLentity% +\def\defineXMLentity {\dodoubleempty\dodefineXMLentity} \def\dodefineXMLentity[#1][#2]#3% @@ -880,6 +893,9 @@ {\unspaceargument#1\to\ascii % #1 can be {[} or so \long\setvalue{\@@XMLentity:\@EA\firstofoneargument\ascii}{#2}} +\def\setXMLentity#1% fast one + {\long\@EA\def\csname\@@XMLentity:#1\endcsname} + %D May this wile become dodo (more in tune with rest); %D beware: also remapped in xtag-map. diff --git a/tex/context/base/xtag-mmc.tex b/tex/context/base/xtag-mmc.tex index f3c46a0c8..0ca08f44d 100644 --- a/tex/context/base/xtag-mmc.tex +++ b/tex/context/base/xtag-mmc.tex @@ -132,7 +132,7 @@ complex-cartesian=>\let\next\MMLccartesian, \next{}{#1}} \def\MMLcCIdefault#1#2% #1=dummy - {#2\!% \getXMLentity{NegThinSpace}% + {#2%\!% \getXMLentity{NegThinSpace}% looks bad in A(x) \doifnextcharelse\xmlr {\encapsulatenextXMLRelements{\left(}{\MMLccomma}{\right)}} {}} @@ -410,18 +410,32 @@ complex-cartesian=>\let\next\MMLccartesian, \remapXMLsequence [piece] [CPA] \MMLcPIECE \remapXMLsequence [otherwise] [CPA] \MMLcOTHERWISE +\setupMMLappearance[piece][\c!scheider=] + \def\MMLcPIECEWISE#1#2% {\cases{#2}} -\def\MMLcPIECE#1#2% +%\def\MMLcPIECE#1#2% \@@MMLpiecescheider +% {\withnexttwoXMLRelements +% {\@EA\XMLRtoks\@EA{\firstXMLRelement\@col@amp@}% +% \@EA\appendtoks\@EA\mathematics\@EA{\secondXMLRelement}\to\XMLRtoks +% \the\XMLRtoks\crcr}% +% #2}% +% +%\def\MMLcOTHERWISE#1#2% +% {#2\@col@amp@\mathematics{\getXMLentity{otherwise}}\crcr} + +\def\MMLcPIECEseparator{\doif\@@MMLpiecescheider\v!ja,} + +\def\MMLcPIECE#1#2% {\withnexttwoXMLRelements - {\@EA\XMLRtoks\@EA{\firstXMLRelement\@col@amp@}% + {\@EA\XMLRtoks\@EA{\firstXMLRelement\MMLcPIECEseparator\@col@amp@}% \@EA\appendtoks\@EA\mathematics\@EA{\secondXMLRelement}\to\XMLRtoks \the\XMLRtoks\crcr}% - #2}% + #2} \def\MMLcOTHERWISE#1#2% - {#2\@col@amp@\mathematics{\getXMLentity{otherwise}}\crcr} + {#2\MMLcPIECEseparator\@col@amp@\mathematics{\getXMLentity{otherwise}}\crcr} %%% arithmic, algebra and logic @@ -711,6 +725,14 @@ complex-cartesian=>\let\next\MMLccartesian, \def\MMLcAPPROX #1#2{\MMLcrelation\approx} \def\MMLcFACTOROF #1#2{\MMLcrelation\mid} +%%% introduced when making an example for Thorsten Bahne: + +\remapXMLsingular [becomes] [CPA] \MMLcBECOMES + +\def\MMLcBECOMES#1#2{\MMLcrelation{:=}} + +\addtocommalist{becomes/}\MMLcmainresetlist + %%% calculus and vector calculus \setupMMLappearance[int][\c!plaats=\v!boven] |