diff options
30 files changed, 1201 insertions, 742 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 701378c09..d45e7e5fe 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -155,35 +155,6 @@ function string.topattern(str,lowercase,strict) end end - --- The following functions might end up in another namespace. - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - - -function string.striplong(str) -- strips all leading spaces - str = gsub(str,"^%s*","") - str = gsub(str,"[\n\r]+ *","\n") - return str -end - -- obsolete names: string.quote = string.quoted @@ -204,6 +175,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns @@ -213,10 +186,16 @@ local Ct, C, Cs, Cc, Cf, Cg = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cf, lpeg.C local utfcharacters = string.utfcharacters local utfgmatch = unicode and unicode.utf8.gmatch +local anything = P(1) +local endofstring = P(-1) + +patterns.anything = anything +patterns.endofstring = endofstring + local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") local utf8next = R("\128\191") -local escaped = P("\\") * P(1) +local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') @@ -227,7 +206,7 @@ patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -local validutf8char = utf8char^0 * P(-1) * Cc(true) + Cc(false) +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) patterns.utf8 = utf8char patterns.utf8char = utf8char @@ -252,6 +231,7 @@ patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase patterns.space = P(" ") patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) patterns.newline = crlf + cr + lf @@ -270,7 +250,7 @@ patterns.unsingle = (squote/"") * ((escaped + (1-squote))^0) * (squote/"") patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble patterns.unspacer = ((patterns.spacer^1)/"")^0 -local unquoted = Cs(patterns.unquoted * P(-1)) -- not C +local unquoted = Cs(patterns.unquoted * endofstring) -- not C function string.unquoted(str) return match(unquoted,str) or str @@ -306,7 +286,7 @@ local function splitat(separator,single) separator = P(separator) local other = C((1 - separator)^0) if single then - local any = P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else @@ -366,7 +346,6 @@ function string.checkedsplit(str,separator) end - local f1 = string.byte local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 - 12416 end @@ -444,7 +423,7 @@ function lpeg.secondofsplit(separator) -- nil if not split local splitter = splitters_s[separator] if not splitter then separator = P(separator) - splitter = (1 - separator)^0 * separator * C(P(1)^0) + splitter = (1 - separator)^0 * separator * C(anything^0) splitters_s[separator] = splitter end return splitter @@ -516,8 +495,8 @@ local simple_escapes = { -- also defines in l-string ["*"] = ".*", } -local p = Cs((S("-.+*%()[]") / patterns_escapes + P(1))^0) -local s = Cs((S("-.+*%()[]") / simple_escapes + P(1))^0) +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) function string.escapedpattern(str,simple) if simple then @@ -614,6 +593,18 @@ end +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + end -- of closure @@ -4199,7 +4190,7 @@ if not modules then modules = { } end modules ['util.deb'] = { local debug = require "debug" local getinfo = debug.getinfo -local type, next = type, next +local type, next, tostring = type, next, tostring local format, find = string.format, string.find local is_boolean = string.is_boolean @@ -4288,6 +4279,19 @@ end +local is_node = node and node.is_node + +function inspect(i) + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + print(node.sequenced(i)) + else + print(tostring(i)) + end +end + end -- of closure diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 701378c09..d45e7e5fe 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -155,35 +155,6 @@ function string.topattern(str,lowercase,strict) end end - --- The following functions might end up in another namespace. - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - - -function string.striplong(str) -- strips all leading spaces - str = gsub(str,"^%s*","") - str = gsub(str,"[\n\r]+ *","\n") - return str -end - -- obsolete names: string.quote = string.quoted @@ -204,6 +175,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns @@ -213,10 +186,16 @@ local Ct, C, Cs, Cc, Cf, Cg = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cf, lpeg.C local utfcharacters = string.utfcharacters local utfgmatch = unicode and unicode.utf8.gmatch +local anything = P(1) +local endofstring = P(-1) + +patterns.anything = anything +patterns.endofstring = endofstring + local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") local utf8next = R("\128\191") -local escaped = P("\\") * P(1) +local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') @@ -227,7 +206,7 @@ patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -local validutf8char = utf8char^0 * P(-1) * Cc(true) + Cc(false) +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) patterns.utf8 = utf8char patterns.utf8char = utf8char @@ -252,6 +231,7 @@ patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase patterns.space = P(" ") patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) patterns.newline = crlf + cr + lf @@ -270,7 +250,7 @@ patterns.unsingle = (squote/"") * ((escaped + (1-squote))^0) * (squote/"") patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble patterns.unspacer = ((patterns.spacer^1)/"")^0 -local unquoted = Cs(patterns.unquoted * P(-1)) -- not C +local unquoted = Cs(patterns.unquoted * endofstring) -- not C function string.unquoted(str) return match(unquoted,str) or str @@ -306,7 +286,7 @@ local function splitat(separator,single) separator = P(separator) local other = C((1 - separator)^0) if single then - local any = P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else @@ -366,7 +346,6 @@ function string.checkedsplit(str,separator) end - local f1 = string.byte local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 - 12416 end @@ -444,7 +423,7 @@ function lpeg.secondofsplit(separator) -- nil if not split local splitter = splitters_s[separator] if not splitter then separator = P(separator) - splitter = (1 - separator)^0 * separator * C(P(1)^0) + splitter = (1 - separator)^0 * separator * C(anything^0) splitters_s[separator] = splitter end return splitter @@ -516,8 +495,8 @@ local simple_escapes = { -- also defines in l-string ["*"] = ".*", } -local p = Cs((S("-.+*%()[]") / patterns_escapes + P(1))^0) -local s = Cs((S("-.+*%()[]") / simple_escapes + P(1))^0) +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) function string.escapedpattern(str,simple) if simple then @@ -614,6 +593,18 @@ end +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + end -- of closure @@ -4199,7 +4190,7 @@ if not modules then modules = { } end modules ['util.deb'] = { local debug = require "debug" local getinfo = debug.getinfo -local type, next = type, next +local type, next, tostring = type, next, tostring local format, find = string.format, string.find local is_boolean = string.is_boolean @@ -4288,6 +4279,19 @@ end +local is_node = node and node.is_node + +function inspect(i) + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + print(node.sequenced(i)) + else + print(tostring(i)) + end +end + end -- of closure diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 701378c09..d45e7e5fe 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -155,35 +155,6 @@ function string.topattern(str,lowercase,strict) end end - --- The following functions might end up in another namespace. - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - - -function string.striplong(str) -- strips all leading spaces - str = gsub(str,"^%s*","") - str = gsub(str,"[\n\r]+ *","\n") - return str -end - -- obsolete names: string.quote = string.quoted @@ -204,6 +175,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns @@ -213,10 +186,16 @@ local Ct, C, Cs, Cc, Cf, Cg = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cf, lpeg.C local utfcharacters = string.utfcharacters local utfgmatch = unicode and unicode.utf8.gmatch +local anything = P(1) +local endofstring = P(-1) + +patterns.anything = anything +patterns.endofstring = endofstring + local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") local utf8next = R("\128\191") -local escaped = P("\\") * P(1) +local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') @@ -227,7 +206,7 @@ patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -local validutf8char = utf8char^0 * P(-1) * Cc(true) + Cc(false) +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) patterns.utf8 = utf8char patterns.utf8char = utf8char @@ -252,6 +231,7 @@ patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase patterns.space = P(" ") patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) patterns.newline = crlf + cr + lf @@ -270,7 +250,7 @@ patterns.unsingle = (squote/"") * ((escaped + (1-squote))^0) * (squote/"") patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble patterns.unspacer = ((patterns.spacer^1)/"")^0 -local unquoted = Cs(patterns.unquoted * P(-1)) -- not C +local unquoted = Cs(patterns.unquoted * endofstring) -- not C function string.unquoted(str) return match(unquoted,str) or str @@ -306,7 +286,7 @@ local function splitat(separator,single) separator = P(separator) local other = C((1 - separator)^0) if single then - local any = P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else @@ -366,7 +346,6 @@ function string.checkedsplit(str,separator) end - local f1 = string.byte local function f2(s) local c1, c2 = f1(s,1,2) return c1 * 64 + c2 - 12416 end @@ -444,7 +423,7 @@ function lpeg.secondofsplit(separator) -- nil if not split local splitter = splitters_s[separator] if not splitter then separator = P(separator) - splitter = (1 - separator)^0 * separator * C(P(1)^0) + splitter = (1 - separator)^0 * separator * C(anything^0) splitters_s[separator] = splitter end return splitter @@ -516,8 +495,8 @@ local simple_escapes = { -- also defines in l-string ["*"] = ".*", } -local p = Cs((S("-.+*%()[]") / patterns_escapes + P(1))^0) -local s = Cs((S("-.+*%()[]") / simple_escapes + P(1))^0) +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) function string.escapedpattern(str,simple) if simple then @@ -614,6 +593,18 @@ end +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + end -- of closure @@ -4199,7 +4190,7 @@ if not modules then modules = { } end modules ['util.deb'] = { local debug = require "debug" local getinfo = debug.getinfo -local type, next = type, next +local type, next, tostring = type, next, tostring local format, find = string.format, string.find local is_boolean = string.is_boolean @@ -4288,6 +4279,19 @@ end +local is_node = node and node.is_node + +function inspect(i) + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + print(node.sequenced(i)) + else + print(tostring(i)) + end +end + end -- of closure diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 892f35946..7185fbc29 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -891,6 +891,7 @@ local function collectresults(head,list,p) if id == glyph_code then local at = has_attribute(n,a_tagged) if at then + -- we could add tonunicodes for ligatures local components = n.components if components then collectresults(components,nil) diff --git a/tex/context/base/bibl-tra.lua b/tex/context/base/bibl-tra.lua index 87300aa74..3e16e050d 100644 --- a/tex/context/base/bibl-tra.lua +++ b/tex/context/base/bibl-tra.lua @@ -27,7 +27,7 @@ local sections = structures.sections local list, done, alldone, used, registered, ordered = { }, { }, { }, { }, { }, { } local mode = 0 -local template = string.striplong([[ +local template = utilities.strings.striplong([[ \citation{*} \bibstyle{cont-%s} \bibdata{%s} diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index 7c916f60e..8d86cd761 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -34,6 +34,7 @@ local variables = interfaces.variables local lpegmatch = lpeg.match local settings_to_array = utilities.parsers.settings_to_array local allocate = utilities.storage.allocate +local tabtospace = utilities.strings.tabtospace buffers = { data = allocate(), @@ -572,7 +573,7 @@ end function hooks.line(str) if visualizers.enabletab then - str = string.tabtospace(str,visualizers.tablength) + str = tabtospace(str,visualizers.tablength) else str = gsub(str,"\t"," ") end diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index 1e17218c8..6430830f7 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -91,9 +91,6 @@ {\dosetfontattribute \??cm\c!style \dosetcolorattribute\??cm\c!color} -\def\dochemicaltext#1% - {\dosetchemicaltext\strut#1} % maybe also \setstrut - \edef\chemicaltoplocation{t} \edef\chemicalbotlocation{b} @@ -316,9 +313,24 @@ \unexpanded\def\chemicaltopright #1{\chemicalright{\chemicallefttop {#1}{}}} \unexpanded\def\chemicalbottomright #1{\chemicalright{\chemicalleftbottom {#1}{}}} -\unexpanded\def\chemicalcentered #1{\setbox\scratchbox\hbox{C}\hbox to \wd\scratchbox{\setstrut\strut\hss#1\hss}} -\unexpanded\def\chemicalleftcentered #1{\setbox\scratchbox\hbox{C}\hbox to \wd\scratchbox{\setstrut\strut #1\hss}} -\unexpanded\def\chemicalrightcentered#1{\setbox\scratchbox\hbox{C}\hbox to \wd\scratchbox{\setstrut\strut\hss#1}} +% \unexpanded\def\chemicalcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1\hss}} +% \unexpanded\def\chemicalleftcentered #1{\hbox to \fontcharwd\font`C{\setstrut\strut #1\hss}} +% \unexpanded\def\chemicalrightcentered#1{\hbox to \fontcharwd\font`C{\setstrut\strut\hss#1}} + +% \let\chemicalsmashedmiddle\chemicalcentered +% \let\chemicalsmashedleft \chemicalleftcentered +% \let\chemicalsmashedright \chemicalrightcentered + +\unexpanded\def\chemicalalignedtext#1#2#3% + {\dontleavehmode + \begingroup + \dosetchemicaltext + \hbox to \fontcharwd\font`C{\setstrut\strut#1\molecule{#3}#2}% + \endgroup} + +\unexpanded\def\chemicalcentered {\chemicalalignedtext\hss \hss } +\unexpanded\def\chemicalleftcentered {\chemicalalignedtext\relax\hss } +\unexpanded\def\chemicalrightcentered{\chemicalalignedtext\hss \relax} \let\chemicalsmashedmiddle\chemicalcentered \let\chemicalsmashedleft \chemicalleftcentered @@ -391,6 +403,7 @@ {\the\everychemical \everychemical\emptytoks \quad \vcenter\bgroup + \dosetchemicaltext \ifthirdargument \ifsecondargument \halign{&\hss##\hss\cr#2\cr\molecule{#1}\cr#3\cr}% @@ -404,7 +417,7 @@ \quad} \def\inlinechemical#1% - {\dontleavehmode\hbox{\ctxlua{chemicals.inline(\!!bs#1\!!es)}}} + {\dontleavehmode\hbox{\dosetchemicaltext\ctxlua{chemicals.inline(\!!bs#1\!!es)}}} \def\chemicalbondrule{\hbox{\vrule\!!height.75ex\!!depth-\dimexpr.75ex-\linewidth\relax\!!width1em\relax}} @@ -458,15 +471,15 @@ \nointerlineskip \ifconditional\formulachemicalhastop \ifconditional\formulachemicalhasbot - \halign{&\hss##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% \else - \halign{&\hss##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr}% \fi \else \ifconditional\formulachemicalhasbot - \halign{&\hss##\hss\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% \else - \halign{&\hss##\hss\cr\the\formulachemicalmid\cr}% + \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicalmid\cr}% \fi \fi \egroup} @@ -474,7 +487,7 @@ \unexpanded\def\formulachemical {\relax\dotriplegroupempty\doformulachemical} -\def\doformulachemical#1#2#3% +\def\doformulachemical#1#2#3% we could do hboxes and measure {\ifthirdargument \doifelsenothing{#2}\noformulachemicaltop{\doformulachemicaltop{#2}}% \doifelsenothing{#3}\noformulachemicalbot{\doformulachemicalbot{#3}}% diff --git a/tex/context/base/cldf-ver.lua b/tex/context/base/cldf-ver.lua index 390ffa04e..12b5479b7 100644 --- a/tex/context/base/cldf-ver.lua +++ b/tex/context/base/cldf-ver.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['cldf-ver'] = { } local concat, tohandle = table.concat, table.tohandle +local splitlines = string.splitlines local tostring, type = tostring, type local context = context @@ -18,7 +19,7 @@ end local function t_tocontext(...) context.starttyping { "typing" } -- else [1] is intercepted context.pushcatcodes("verbatim") - tohandle(flush,...) + tohandle(flush,...) -- ok? context.stoptyping() context.popcatcodes() end @@ -50,3 +51,21 @@ function tocontext(first,...) b_tocontext(first,...) end end + +function context.tobuffer(name,str) + context.startbuffer { name } + context.pushcatcodes("verbatim") + local lines = type(str) == "string" and splitlines(str) or str + for i=1,#lines do + context(lines[i] .. " ") + end + context.stopbuffer() + context.popcatcodes() +end + +function context.tolines(str) + local lines = type(str) == "string" and splitlines(str) or str + for i=1,#lines do + context(lines[i] .. " ") + end +end diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 612ecf693..be89194ef 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.11.18 19:47} +\newcontextversion{2010.11.19 22:50} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 9af572909..65b0be7aa 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.11.18 19:47} +\edef\contextversion{2010.11.19 22:50} %D For those who want to use this: diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv index 02fb19c49..989a13c75 100644 --- a/tex/context/base/core-def.mkiv +++ b/tex/context/base/core-def.mkiv @@ -29,6 +29,7 @@ \ifdefined\firststagepreloadfonts \else \let\firststagepreloadfonts \relax \fi \ifdefined\secondstagepreloadfonts \else \let\secondstagepreloadfonts\relax \fi \ifdefined\thirdstagepreloadfonts \else \let\thirdstagepreloadfonts \relax \fi +\ifdefined\fourthstagepreloadfonts \else \let\fourthstagepreloadfonts\relax \fi \appendtoks \showcontextbanner \to \everyjob \appendtoks \initializenewlinechar \to \everyjob @@ -61,7 +62,7 @@ \prependtoks \lefttoright \to \everybeforeoutput \appendtoks \secondstagepreloadfonts \to \everystarttext -\appendtoks \thirdstagepreloadfonts \to \everystoptext +\appendtoks \fourthstagepreloadfonts \to \everystoptext % temporary here: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index a633fe259..bd20f2d6f 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -803,7 +803,7 @@ local nounicode = byte("?") local function nametoslot(name,all) -- maybe some day rawdata local tfmdata = fontdata[currentfont()] local shared = tfmdata and tfmdata.shared - local fntdata = shared and shared.otfdata or shared.afmdata + local fntdata = shared and (shared.otfdata or shared.afmdata) if fntdata then local unicode = fntdata.luatex.unicodes[name] if not unicode then diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 75f59217c..b362b35a0 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -1481,18 +1481,18 @@ \getparameters[\??ft#2#1][#3]% %\@@endfontdef % new code, see remark - \ifloadingfonts - % only runtime - \else\ifcsname\@size@#1\endcsname - % only once - \else - % prevent loop (hence \empty) - \letvalueempty{\@size@#1}% - \pushmacro\fontclass % new per 26102009 - \edef\fontclass{#2}% % new per 26102009 - \defineunknownfont{#1}% - \popmacro\fontclass % new per 26102009 - \fi\fi + \ifproductionrun + \ifcsname\@size@#1\endcsname + % only once + \else + % prevent loop (hence \empty) + \letvalueempty{\@size@#1}% + \pushmacro\fontclass % new per 26102009 + \edef\fontclass{#2}% % new per 26102009 + \defineunknownfont{#1}% + \popmacro\fontclass % new per 26102009 + \fi + \fi % so far \setvalue{\@size@#1}{\docompletefontswitch[#1]}} @@ -1941,7 +1941,7 @@ \def\doswitchpoints[#1]% {\normalexpanded{\dodoswitchpoints{#1}}} -\unexpanded \def\dodoswitchpoints#1% +\unexpanded\def\dodoswitchpoints#1% {\ifcsname\@size@#1\endcsname \else \defineunknownfont{#1}% \fi% @@ -1956,7 +1956,7 @@ \showmessage\m!fonts4{#1}% \fi} -\unexpanded \def\doswitchstyle[#1]% +\unexpanded\def\doswitchstyle[#1]% {\ifcsname\@style@#1\endcsname \csname\@style@#1\endcsname \edef\fontstyle{#1}% @@ -2005,11 +2005,8 @@ %D we start typesetting. %D %D Therefore we have to signal the font switching macros that -%D we are preloading fonts. As long as the next boolean is, -%D true, no loading is done. - -\newif\ifloadingfonts \loadingfontstrue - +%D we are preloading fonts. +%D %D \macros %D {preloadfonts} %D @@ -2017,9 +2014,6 @@ %D sequence of a session. After the loading job is done, the %D macro relaxes itself and reset the signal. -% \appendtoks -% \to \everysetupdocument - \fontdimen1\nullfont 0\scaledpoint \fontdimen2\nullfont 256377\scaledpoint \fontdimen3\nullfont 128188\scaledpoint @@ -2033,42 +2027,42 @@ \ctxlua{fonts.definers.resetnullfont()}% in luatex 0.70 this will also do the previous \globallet\resetnullfont\relax} -\newconditional\fontsareloaded +% \newconditional\fontsareloaded \def\preloaddefaultfonts - {\usetypescript[modern]% + {\resetpreloadfonts + \usetypescript[modern]% \setuptypeface[modern]% + %\setuptypeface[\s!default]% \showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}} \def\resetpreloadfonts {\global\let\firststagepreloadfonts \relax \global\let\secondstagepreloadfonts\relax \global\let\thirdstagepreloadfonts \relax + \global\let\fourthstagepreloadfonts\relax \resetnullfont} \def\firststagepreloadfonts % see core-def.mkiv - {\global\loadingfontsfalse - \ifconditional\fontsareloaded - \resetpreloadfonts - \else - \doifmodeelse {*nofonts} - {\writestatus\m!fonts{latin modern fonts are not preloaded}} - {\writestatus\m!fonts{preloading latin modern fonts (first stage)}% - \preloaddefaultfonts - \resetpreloadfonts}% - \fi} + {\doifmodeelse{*nofonts} + {%\resetpreloadfonts + \writestatus\m!fonts{latin modern fonts are not preloaded}} + {\preloaddefaultfonts + \writestatus\m!fonts{preloading latin modern fonts (first stage)}}} \def\secondstagepreloadfonts % see core-def.mkiv - {\global\loadingfontsfalse - \ifconditional\fontsareloaded - % nothing - \else - \writestatus\m!fonts{preloading latin modern fonts (second stage)}% + {\writestatus\m!fonts{preloading latin modern fonts (second stage)}% + \preloaddefaultfonts} + +\def\thirdstagepreloadfonts + {\ifx\fontclass\empty + \writestatus\m!fonts{preloading latin modern fonts (third stage)}% \preloaddefaultfonts - \fi - \resetpreloadfonts} + \else + \resetpreloadfonts + \fi} -\def\thirdstagepreloadfonts % see core-def.mkiv +\def\fourthstagepreloadfonts {\begingroup %ifzeropt\fontcharwd\font\number`!\relax \setbox\scratchbox\hbox{context}% @@ -2078,15 +2072,9 @@ \writestatus\m!fonts{!! loaded (maybe due to a missing \string\starttext).}% \writeline \fi + \resetpreloadfonts \endgroup} -% maybe add this to \everystarttext -% -% \ifconditional\fontsareloaded\else -% \usetypescript[modern]% -% \setuptypeface[modern]% -% \fi - %D Here comes the main font switching macros. These macros %D handle changes in size as well as returning to the global %D bodyfont size. @@ -2095,8 +2083,8 @@ {\doifelse{#2}\v!global {\restoreglobalbodyfont} {\processcommacommand[#2]{\dodosetfont{#1}}% ##1 get also passed - \ifloadingfonts\else - \global\settrue\fontsareloaded + \ifproductionrun + \thirdstagepreloadfonts \doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \ifx\defaultfontclass\empty @@ -2108,11 +2096,6 @@ \def\dodosetfont#1#2% #1 = set/switch state | check fo rempty, else space {\doifsomething{#2}{\dododosetfont{#1}{#2}{\showmessage\m!fonts4{#2}}}} -% % % this can be retrofitted in mkii code % % % - -% \def\normalizebodyfontsize#1\to#2% -% {\@EA\@EA\@EA\donormalizedbodyfontsize\@EA\WITHOUTPT\the\dimexpr#1+\ifcase\fontdigits.5\or.05\or.005\fi\points\relax000\to#2} - \def\dododosetfont#1#2#3% #1 = set/switch state ! ! ! !could also be used for mkii {\doifnumberelse{#2}\dodododosetfont\redododosetfont{#1}{#2}{#3}} @@ -2157,8 +2140,6 @@ #3\dosetsubstitutefont{#1}{#2}% \fi} -% % % - %D When users specify for instance a 13 point bodyfont while no %D such bodyfont is defined, the system automatically tries to %D find a best fit, that is the nearest smaller defined @@ -2689,7 +2670,7 @@ \globalbodyfontsize\localbodyfontsize \normalizebodyfontsize\globalbodyfontsize\to\normalizedglobalbodyfontsize \let\globalfontstyle\fontstyle - \ifloadingfonts\else + \ifproductionrun \the\everybodyfont \the\everyglobalbodyfont \saveinterlinespace diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 4c5e668e1..1ccb69303 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -421,7 +421,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid) end end -- if trace_scaling then - -- report_define("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or k,description.index,description.name or '-',description.class or '-') + -- report_define("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-') -- end if tounicode then local tu = tounicode[index] -- nb: index! diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 00b55d622..df59373ae 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns @@ -17,10 +19,16 @@ local Ct, C, Cs, Cc, Cf, Cg = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cf, lpeg.C local utfcharacters = string.utfcharacters local utfgmatch = unicode and unicode.utf8.gmatch +local anything = P(1) +local endofstring = P(-1) + +patterns.anything = anything +patterns.endofstring = endofstring + local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") local utf8next = R("\128\191") -local escaped = P("\\") * P(1) +local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') @@ -31,7 +39,7 @@ patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -local validutf8char = utf8char^0 * P(-1) * Cc(true) + Cc(false) +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) patterns.utf8 = utf8char patterns.utf8char = utf8char @@ -56,6 +64,7 @@ patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase patterns.space = P(" ") patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) patterns.newline = crlf + cr + lf @@ -74,7 +83,7 @@ patterns.unsingle = (squote/"") * ((escaped + (1-squote))^0) * (squote/"") patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble patterns.unspacer = ((patterns.spacer^1)/"")^0 -local unquoted = Cs(patterns.unquoted * P(-1)) -- not C +local unquoted = Cs(patterns.unquoted * endofstring) -- not C function string.unquoted(str) return match(unquoted,str) or str @@ -114,7 +123,7 @@ local function splitat(separator,single) separator = P(separator) local other = C((1 - separator)^0) if single then - local any = P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else @@ -178,18 +187,6 @@ function string.checkedsplit(str,separator) return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - --~ from roberto's site: local f1 = string.byte @@ -274,7 +271,7 @@ function lpeg.secondofsplit(separator) -- nil if not split local splitter = splitters_s[separator] if not splitter then separator = P(separator) - splitter = (1 - separator)^0 * separator * C(P(1)^0) + splitter = (1 - separator)^0 * separator * C(anything^0) splitters_s[separator] = splitter end return splitter @@ -297,7 +294,7 @@ end --~ -- slower: --~ --~ function lpeg.counter(pattern) ---~ local n, pattern = 0, (lpeg.P(pattern)/function() n = n + 1 end + lpeg.P(1))^0 +--~ local n, pattern = 0, (lpeg.P(pattern)/function() n = n + 1 end + lpeg.anything)^0 --~ return function(str) n = 0 ; lpegmatch(pattern,str) ; return n end --~ end @@ -360,8 +357,8 @@ local simple_escapes = { -- also defines in l-string ["*"] = ".*", } -local p = Cs((S("-.+*%()[]") / patterns_escapes + P(1))^0) -local s = Cs((S("-.+*%()[]") / simple_escapes + P(1))^0) +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) function string.escapedpattern(str,simple) if simple then @@ -466,3 +463,15 @@ end --~ print(lpeg.count("äáàa",lpeg.UR("aá"))) --~ print(lpeg.count("äáàa",lpeg.UR("àá"))) --~ print(lpeg.count("äáàa",lpeg.UR(0x0000,0xFFFF))) + +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end diff --git a/tex/context/base/l-string.lua b/tex/context/base/l-string.lua index 1e55f6bac..7a45b98bf 100644 --- a/tex/context/base/l-string.lua +++ b/tex/context/base/l-string.lua @@ -116,52 +116,6 @@ function string.topattern(str,lowercase,strict) end end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - --- The following functions might end up in another namespace. - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - ---~ local template = string.striplong([[ ---~ aaaa ---~ bb ---~ cccccc ---~ ]]) - -function string.striplong(str) -- strips all leading spaces - str = gsub(str,"^%s*","") - str = gsub(str,"[\n\r]+ *","\n") - return str -end - -- obsolete names: string.quote = string.quoted diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index f2e3be8ec..6d25a9c42 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -415,6 +415,7 @@ local pages = references.pages function specials.page(var,actions) -- better resolve in strc-ref local file = var.f +--~ table.print(var) if file then file = references.checkedfile(file) return link(nil,file,nil,var.operation,actions) diff --git a/tex/context/base/luat-lib.mkiv b/tex/context/base/luat-lib.mkiv index 81d371cc4..2f73fae3d 100644 --- a/tex/context/base/luat-lib.mkiv +++ b/tex/context/base/luat-lib.mkiv @@ -13,6 +13,7 @@ \writestatus{loading}{ConTeXt Lua Macros / Libraries} +\registerctxluafile{util-str}{1.001} \registerctxluafile{util-tab}{1.001} \registerctxluafile{util-pck}{1.001} \registerctxluafile{util-seq}{1.001} diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex index a06d195ba..6a899736b 100644 --- a/tex/context/base/m-units.tex +++ b/tex/context/base/m-units.tex @@ -367,15 +367,22 @@ \def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}} \def\Milli {\dimensionprefix{m}} \def\Centi {\dimensionprefix{c}} -\def\Deci {\dimensionprefix{d}} -\def\Hecto {\dimensionprefix{h}} -\def\Kilo {\dimensionprefix{k}} -\def\Mega {\dimensionprefix{M}} -\def\Giga {\dimensionprefix{G}} -\def\Terra {\dimensionprefix{T}} % for old times sake -\def\Tera {\dimensionprefix{T}} -\def\Peta {\dimensionprefix{P}} -\def\Exa {\dimensionprefix{E}} +\def\Deci {\dimensionprefix{d}} % 10^01 +\def\Hecto {\dimensionprefix{h}} % 10^02 +\def\Kilo {\dimensionprefix{k}} % 10^03 +\def\Mega {\dimensionprefix{M}} % 10^06 +\def\Giga {\dimensionprefix{G}} % 10^09 +\def\Tera {\dimensionprefix{T}} % 10^12 +\def\Peta {\dimensionprefix{P}} % 10^15 +\def\Exa {\dimensionprefix{E}} % 10^18 + +%def\Terra {\dimensionprefix{T}} % for old times sake + +\def\Kibi {\dimensionprefix{ki}} % 2^10 +\def\Mebi {\dimensionprefix{Mi}} % 2^20 +\def\Gibi {\dimensionprefix{Gi}} % 2^30 +\def\Tebi {\dimensionprefix{Ti}} % 2^40 +\def\Pebi {\dimensionprefix{Pi}} % 2^50 %D and binary prefixes: diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 54971d6a5..628914b6d 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -64,7 +64,7 @@ \def#6##1##2{\csname#4{#1##1}{##2}\endcsname}% \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}} % always root -\def\installparameterhandler#1#2% +\unexpanded\def\installparameterhandler#1#2% {%\message{\detokenize{#1}/\detokenize{#2}}% \normalexpanded {\doinstallparameterhandler @@ -81,7 +81,7 @@ \def#4##1##2{\ifcsname##1##2\endcsname##1\else\expandafter#5\csname##1\s!parent\endcsname{##2}\fi}% \def#5##1##2{\ifx##1\relax\else#4{##1}{##2}\fi}} -\def\installparameterhashhandler#1#2% +\unexpanded\def\installparameterhashhandler#1#2% {\normalexpanded {\doinstallparameterhashhandler {\noexpand#1}% \??aa @@ -97,7 +97,7 @@ \ifx\fontattributehash \empty\else\dosetfontattribute \fontattributehash {##1}\fi \ifx\colorattributehash\empty\else\dosetcolorattribute\colorattributehash{##2}\fi}} -\def\installattributehandler#1#2% +\unexpanded\def\installattributehandler#1#2% {\normalexpanded {\doinstallattributehandler {\noexpand#1}% \??aa @@ -105,20 +105,20 @@ \expandafter\noexpand\csname #2parameterhash\endcsname}} \unexpanded\def\doinstalldefinehandler#1#2#3#4#5#6#7% - {\unexpanded\def#2{\dodoubleempty#5}% + {\unexpanded\def#2{\dotripleempty#5}% \newtoks#6% \newtoks#7% - \def#5[##1][##2]% + \def#5[##1][##2][##3]% {\edef#4{##1}% \the#6% predefine \ifsecondargument - \getparameters[#1#4][\s!parent=#1,##2]% - \else - \getparameters[#1#4][\s!parent=#3]% + \doifassignmentelse{##2} + {\getparameters[#1#4][\s!parent=#3,##2]} + {\getparameters[#1#4][\s!parent=#1##2,##3]}% \fi \the#7}} -\def\installdefinehandler#1#2#3% +\unexpanded\def\installdefinehandler#1#2#3% {\normalexpanded {\doinstalldefinehandler {\noexpand#1}% \??aa @@ -135,7 +135,7 @@ \def#4[##1][##2]% {\ifsecondargument \def\docommand####1% we will have a simple one as well - {\edef#3{##1}% + {\edef#3{####1}% \getparameters[#1#3][##2]% \the#5}% \processcommalist[##1]\docommand @@ -145,7 +145,7 @@ \the#5% \fi}} -\def\installsetuphandler#1#2% +\unexpanded\def\installsetuphandler#1#2% {\normalexpanded {\doinstallsetuphandler {\noexpand#1}% \??aa @@ -161,7 +161,7 @@ \installsetuphandler {#1}{#2}% \installattributehandler {#1}{#2}} -\def\installnamespace#1% +\unexpanded\def\installnamespace#1% {\setvalue{????#1}{@@@@#1}} % \enabletrackers[interfaces.namespaces,context.flush] @@ -199,7 +199,8 @@ % % \stoptext -\def\definenamespace{\dodoubleargument\dodefinenamespace} +\unexpanded\def\definenamespace + {\dodoubleargument\dodefinenamespace} \def\dodefinenamespace[#1][#2]% namespace settings {\ctxlua{interfaces.namespaces.define(\!!bs#1\!!es,\!!bs#2\!!es)}} diff --git a/tex/context/base/mult-cld.lua b/tex/context/base/mult-cld.lua index 2a2af77ae..6476eaff6 100644 --- a/tex/context/base/mult-cld.lua +++ b/tex/context/base/mult-cld.lua @@ -140,6 +140,7 @@ local function writer(command,first,...) flush(currentcatcodes,"{",ti,"}") else flush(currentcatcodes,"{") + -- maybe if string and \n found then auto split flush(contentcatcodes,ti) flush(currentcatcodes,"}") end diff --git a/tex/context/base/node-acc.lua b/tex/context/base/node-acc.lua index c131a0002..537405921 100644 --- a/tex/context/base/node-acc.lua +++ b/tex/context/base/node-acc.lua @@ -15,6 +15,7 @@ local traverse_nodes = node.traverse local traverse_id = node.traverse_id local has_attribute = node.has_attribute local copy_node = node.copy +local free_nodelist = node.flush_list local glue_code = nodecodes.glue local glyph_code = nodecodes.glyph @@ -30,6 +31,12 @@ local function injectspaces(head) -- if at then if p and p.id == glyph_code then local g = copy_node(p) + local c = g.components + if c then -- it happens that we copied a ligature + free_nodelist(c) + g.components = nil + g.subtype = 256 + end local s = copy_node(n.spec) g.char, n.spec = 32, s p.next, g.prev = g, p diff --git a/tex/context/base/s-abr-04.tex b/tex/context/base/s-abr-04.tex index 5f1188b3b..98e76c86f 100644 --- a/tex/context/base/s-abr-04.tex +++ b/tex/context/base/s-abr-04.tex @@ -1,8 +1,8 @@ %D \module -%D [ file=s-abr-02, +%D [ file=s-abr-01, %D version=1996.01.01, %D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviations 2, +%D subtitle=General Abbreviations 1, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] @@ -11,12 +11,311 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\usemodule[abr-01] - \unprotect -\setupsorting[logo][\c!style=] +% \setupsorting[logo][\c!style=\v!capital] + +% \setupcapitals[\c!title=\v!no] + +\protect + +\logo [MKI] {MkI} +\logo [MKII] {MkII} +\logo [MKIII] {MkIII} +\logo [MKIV] {MkIV} + +%logo [FGA] {fga} +%logo [FGBBS] {fgbbs} +\logo [ACROBAT] {Acro\-bat} +\logo [AFM] {afm} +\logo [API] {api} +\logo [ALEPH] {Aleph} % {\mathematics{\aleph}} +\logo [ALGOL] {ALGOL} +\logo [AMS] {ams} +\logo [AMSLATEX] {AmS\LATEX} +\logo [AMSTEX] {AmS\TeX} +\logo [ANSI] {ansi} +\logo [ARABTEX] {Arab\TeX} +\logo [ASCII] {ascii} +\logo [ASCIITEX] {ascii\TeX} +\logo [BACHOTEX] {Bacho\TeX} +\logo [BIBTEX] {bib\TeX} +\logo [BLUESKY] {BlueSky} +\logo [BMP] {bmp} +\logo [BSD] {bsd} +\logo [CCODE] {c} +\logo [CALCMATH] {CalcMath} +\logo [CD] {cd} +\logo [CPU] {cpu} +\logo [CDROM] {cdrom} +\logo [CID] {cid} +\logo [CJK] {cjk} +\logo [CMR] {cmr} +\logo [CMYK] {cmyk} +\logo [CODHOST] {CodHost} +\logo [CONTEXT] {Con{\TeX}t} +\logo [CSS] {css} +\logo [CTAN] {ctan} +\logo [CTXTOOLS] {ctxtools} +\logo [CWEB] {cweb} +\logo [DANTE] {Dante} +\logo [DISTILLER] {distiller} +\logo [DRATEX] {Dra\TeX} +\logo [DSC] {dsc} +\logo [DTD] {dtd} +\logo [DTK] {dtk} +\logo [DTP] {dtp} +\logo [DVD] {dvd} +\logo [DVI] {dvi} +\logo [DVIPDFM] {dvipdfm} +\logo [DVIPDFMX] {dvipdfmx} +\logo [DVIPOS] {dvipos} +\logo [DVIPS] {dvips} +\logo [DVIPSONE] {dvipsone} +\logo [DVISCR] {dviscr} +\logo [DVIWINDO] {dviwindo} +\logo [EC] {ec} +\logo [EIFFEL] {Eiffel} +\logo [EMACS] {emacs} +\logo [EMTEX] {em\TeX} +\logo [ENCODING] {enc} +\logo [ENCTEX] {enc\TeX} +\logo [EPS] {eps} +\logo [ETEX] {\eTeX} +\logo [EUROBACHOTEX] {EuroBacho\TeX} +\logo [EUROMATH] {EuroMath} +\logo [EUROTEX] {Euro\TeX} +\logo [EXAMPLE] {eXaMpLe} +\logo [EXAMPLED] {exampled} +\logo [EXAMPLEQ] {exampleq} +\logo [EXAMPLER] {exampler} +\logo [EXAMPLET] {examplet} +\logo [EXAMPLEX] {examplex} +\logo [EXIMPLE] {eXiMpLe} +\logo [FAQ] {faq} +\logo [FDF] {fdf} +\logo [FONTFORGE] {FontForge} +\logo [FOXET] {foXet} +\logo [FPTEX] {fp\TeX} +\logo [FREEBSD] {FreeBSD} +\logo [FTP] {ftp} +\logo [GHOSTSCRIPT]{Ghost\-script} +\logo [GHOSTVIEW] {Ghost\-view} +\logo [GIF] {gif} +\logo [GNU] {gnu} +\logo [GNUPLOT] {gnuplot} +\logo [GS] {Ghost\-Script} +\logo [GUST] {Gust} +\logo [GWTEX] {gw\TeX} +\logo [HSB] {hsb} +\logo [HTML] {html} +\logo [HTTP] {http} +\logo [HZ] {hz} +\logo [IBM] {ibm} +\logo [IMAGEMAGICK]{ImageMagick} +\logo [INITEX] {ini\TeX} +\logo [INRSTEX] {inrs\TeX} +\logo [IO] {io} +\logo [IRCNET] {IRCnet} +\logo [ISO] {iso} +\logo [JAVA] {Java} +\logo [JAVASCRIPT] {Java\-Script} +\logo [JPEG] {jpeg} +\logo [JPG] {jpg} +\logo [KPATHSEA] {kpathsea} +\logo [KPSE] {kpse} +\logo [KPSEWHICH] {kpsewhich} +\logo [MKTEXLSR] {mktexlsr} +\logo [LAMSTEX] {LamS\TeX} +\logo [LATEX] {La\TeX} +\logo [LATEXTE] {La\TeX2e} +\logo [LATEXTN] {La\TeX2.09} +\logo [LINUX] {linux} +\logo [LISP] {Lisp} +\logo [LPEG] {lpeg} +\logo [LUA] {Lua} +\logo [LUAJIT] {LuaJIT} +\logo [LUATEX] {Lua\TeX} +\logo [LUATOOLS] {luatools} +\logo [MACOSX] {MacOSX} +\logo [MACROTEX] {Macro\TeX} +\logo [MAKEMPY] {MakeMPY} +\logo [MAPPING] {map} +\logo [MAPS] {Maps} +\logo [MATHML] {MathML} +\logo [METAFONT] {MetaFont} +\logo [METAPOST] {MetaPost} +\logo [METATEX] {Meta\TeX} +\logo [MIKTEX] {Mik\TeX} +\logo [MLTEX] {ml\TeX} +\logo [METATYPE] {MetaType1} +\logo [MODULA] {Modula} +\logo [MOV] {mov} +\logo [MPS] {mps} +\logo [MPTOPDF] {mptopdf} +\logo [MPLIB] {MPlib} +\logo [MSDOS] {msdos} +\logo [MSWINDOWS] {MS~Windows} +\logo [MTXRUN] {mtxrun} +\logo [MTXTOOLS] {mtxtools} +\logo [NETPBM] {NetPBM} +\logo [NTG] {ntg} +\logo [NTS] {nts} +\logo [OFM] {ofm} +\logo [OMEGA] {Omega} +\logo [OPENMATH] {OpenMath} +\logo [OPENTYPE] {OpenType} +\logo [OPI] {opi} +\logo [OTF] {otf} +\logo [OTP] {otp} +\logo [OVF] {ovf} +\logo [PASCAL] {Pascal} +\logo [PCTEX] {pc\TeX} +\logo [PDF] {pdf} +\logo [PDFETEX] {pdfe\TeX} +\logo [PDFTEX] {pdf\TeX} +\logo [PDFTOOLS] {pdftools} +\logo [PDFTOPS] {pdftops} +\logo [PERL] {Perl} +\logo [PERLTK] {Perl/Tk} +\logo [PICTEX] {\PiCTeX} +\logo [PK] {pk} +\logo [PLAIN] {Plain} +\logo [PNG] {png} +\logo [POSIX] {posix} +\logo [POSTSCRIPT] {Post\-Script} +\logo [PPCHTEX] {\PPCHTeX} +\logo [PRAGMA] {Pragma ADE} +\logo [PRESS] {press} +\logo [PRIFIL] {prifil} +\logo [PS] {Post\-Script} +\logo [PSCHECK] {pscheck} +\logo [PSTOEDIT] {pstoedit} +\logo [PSTOPAGE] {pstopage} +\logo [PSTOPDF] {pstopdf} +\logo [PSTRICKS] {pstricks} +\logo [RAM] {ram} +\logo [READER] {Acro\-bat Reader} +\logo [RELAXNG] {Relax\kern.125emNG} +\logo [RGB] {rgb} +\logo [RLXTOOLS] {rlxtools} +\logo [RUBY] {Ruby} +\logo [SCITE] {SciTE} +\logo [SGML] {sgml} +\logo [SI] {si} +\logo [SQL] {sql} +\logo [TABLE] {\TaBlE} +\logo [TCPIP] {tcp/ip} +\logo [TDS] {tds} % no sc te +\logo [TETEX] {te\TeX} % no sc te +\logo [TEX] {\TeX} +\logo [TEXADRES] {\TeX adress} +\logo [TEXBASE] {\TeX base} +\logo [TEXEDIT] {\TeX edit} +\logo [TEXEXEC] {\TeX exec} +\logo [TEXFONT] {\TeX font} +\logo [TEXFORM] {\TeX form} +\logo [TEXLIVE] {\TeX Live} +\logo [TEXLUA] {\TeX Lua} +\logo [TEXMF] {texmf} +\logo [TEXMFSTART] {texmfstart} +\logo [TEXNL] {tex-nl} +\logo [TEXSHOW] {\TeX show} +\logo [TEXSPELL] {\TeX spell} +\logo [TEXGYRE] {\TeX\ Gyre} +\logo [TEXSYNC] {texsync} +\logo [TEXTMATE] {TextMate} +\logo [TEXTOOLS] {\TeX tools} +\logo [TEXUTIL] {\TeX util} +\logo [TEXWORK] {\TeX work} +\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT} +\logo [TFM] {tfm} +\logo [TIF] {tif} +\logo [TIFF] {tiff} +\logo [TIFFINFO] {tiffinfo} +\logo [TIFFTAGS] {tifftags} +\logo [TMFTOOLS] {tmftools} +\logo [TPIC] {tpic} +\logo [TPM] {tpm} +\logo [TRUETYPE] {TrueType} +\logo [TTF] {ttf} +\logo [TUG] {tug} +\logo [TUGBOAT] {Tug\-Boat} +\logo [TUGNEWS] {Tug\-News} +\logo [TYPEONE] {Type1} +\logo [UCS] {ucs} +\logo [UNICODE] {Uni\-code} +\logo [UNIX] {Unix} +\logo [URI] {uri} +\logo [URL] {url} +\logo [USA] {usa} +\logo [USENET] {usenet} +\logo [UTF] {utf} +\logo [UTF] {utf} +\logo [VF] {vf} +\logo [WDT] {wdt} +\logo [WEB] {web} +\logo [WEBC] {web2c} +\logo [WIKI] {Wiki} +\logo [WINDOWS] {Windows} +\logo [WINNT] {WinNT} +\logo [WINNX] {Win9x} +\logo [WWW] {www} +\logo [WYSIWYG] {wysiwyg} +\logo [XDVI] {Xdvi} +\logo [XETEX] {\XeTeX} +\logo [XFDF] {xfdf} +\logo [XHTML] {xhtml} +\logo [XINDY] {Xindy} +\logo [XML] {xml} +\logo [XPATH] {xpath} +\logo [XMLTOOLS] {xmltools} +\logo [XPDFETEX] {xpdfe\TeX} +\logo [XSL] {xsl} +\logo [XSLFO] {xsl-fo} +\logo [XSLT] {xslt} +\logo [XSLTPROC] {xsltproc} +\logo [XYPIC] {XYPIC} % wrong logo +\logo [YandY] {y\&y} +\logo [ZIP] {zip} + +\def\METAFUN {\MetaFun} + +\logo [METAFUN] {\MetaFun} + +\def\SystemSpecialA#1{$\langle\it#1\rangle$} +\def\SystemSpecialB#1{{\tttf<#1>}} + +\def\CATCODE {\SystemSpecialA{catcode}} +\def\CATCODES {\SystemSpecialA{catcodes}} +\def\DIMENSION {\SystemSpecialA{dimension}} +\def\DIMENSIONS {\SystemSpecialA{dimensions}} +\def\COUNTER {\SystemSpecialA{counter}} +\def\COUNTERS {\SystemSpecialA{counters}} +\def\HBOX {\SystemSpecialA{hbox}} +\def\HBOXES {\SystemSpecialA{hboxes}} +\def\VBOX {\SystemSpecialA{vbox}} +\def\VBOXES {\SystemSpecialA{vboxes}} +\def\BOX {\SystemSpecialA{box}} +\def\BOXES {\SystemSpecialA{boxes}} +\def\TOKENLIST {\SystemSpecialA{token list}} +\def\TOKENLISTS {\SystemSpecialA{token lists}} +\def\NEWLINE {\SystemSpecialA{newline}} +\def\SKIP {\SystemSpecialA{skip}} +\def\SKIPS {\SystemSpecialA{skips}} +\def\MUSKIP {\SystemSpecialA{muskip}} +\def\MUSKIPS {\SystemSpecialA{muskips}} +\def\MARK {\SystemSpecialA{mark}} +\def\MARKS {\SystemSpecialA{marks}} + +\def\SPACE {\SystemSpecialB{space}} +\def\EOF {\SystemSpecialB{eof}} +\def\TAB {\SystemSpecialB{tab}} +\def\NEWPAGE {\SystemSpecialB{newpage}} +\def\NEWLINE {\SystemSpecialB{newline}} + +\def\THANH {H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh} -\setupcapitals[\c!title=\v!no] +\def\THANH {H\`an Th\ecircumflexacute\ Th\`anh} -\protect \endinput +\endinput diff --git a/tex/context/base/s-map-10.mkiv b/tex/context/base/s-map-10.mkiv index 03d74fe36..2c0888121 100644 --- a/tex/context/base/s-map-10.mkiv +++ b/tex/context/base/s-map-10.mkiv @@ -1,242 +1,366 @@ -%D \module -%D [file=s-map-se, -%D version=2005.02.03, -%D title=\CONTEXT\ Style File, -%D subtitle=\MAPS\ basis stijl, -%D author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, -%D date=\currentdate, -%D copyright={NTG / MAPS}] - -% This module re-implements the MAPS style for use with the Context macro -% package. The original MAPS layout was designed and implemented in -% LaTeX by Taco Hoekwater and Siep Kroonenberg. -% -% This variant is cleaned up for \MKIV. Some more cleanup is possible. -% -% Three layouts: -% +%\module [ +% file=s-map-se, +% version=2005.02.03, +% title=\CONTEXT\ Style File, +% subtitle=\MAPS\ basis stijl, +% author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, +% date=\currentdate, +% copyright={NTG / MAPS}% +%] + +% This module re-implements the MAPS style for use with the Context +% macro package. The original MAPS layout was designed and +% implemented in LaTeX by Taco Hoekwater and Siep Kroonenberg. + +% This style will be cleaned up as soon as we have time for it. + +% - three layouts: % 1. two columns % 2. one column, with wide outer margins (option onecolumn) % 3. one column, with wide left margin (option asym) -% +% - font sizes deviate from TeX's usual geometric progression +% - use of sans-serif for headers and various details +% - option realfonts uses Bitstream Charter, Euler Math and Latin Modern. +% This is used for final typesetting. +% The default font setup, intended for authors, uses Computer +% Modern. + % A mode nosubsub defines only two levels of sectioning. If you % don't need more and use the two-column layout, then this option % will probably improve the looks of your paper. -% -% The default is twocolumns. -\doifmode {asym} {\enablemode[onecolumn]} % implies onecolumn +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% pdftex support + +\newif\ifMapsInColumns +\doifmode{asym}{\enablemode[onecolumn]} % implies onecolumn +\doifnotmode{onecolumn}{\MapsInColumnstrue} + +\enablemode[realfonts] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% fonts + +%%%%%%%%% first, font sizes +\definebodyfontenvironment [7pt][% LaTeX: scriptsize + interlinespace=8pt, + big=8pt, + small=6pt% +] + +\definebodyfontenvironment [8pt][% LaTeX: footnotesize + interlinespace=9pt, + big=9pt, + small=7pt, + x=6pt% +] + +\definebodyfontenvironment [9pt][% LaTeX: small + interlinespace=10pt, + big=10pt, + small=8pt,% + x=7pt,% + script=6pt% +] + +\definebodyfontenvironment [10pt][% LaTeX: normalsize + interlinespace=11pt, + big=11pt, + a=11pt, + small=9pt,% + x=8pt,% + script=7pt% +] + +\definebodyfontenvironment [11pt][% LaTeX: large + interlinespace=11pt, + big=11pt, + small=10pt,% + x=9pt,% + script=8pt% +] + +\definebodyfontenvironment [14pt][% + interlinespace=14pt, + big=24pt, + small=11pt, + x=10pt% +] + +\definebodyfontenvironment [24pt][% + interlinespace=24pt, + big=24pt, + small=14pt, + x=11pt% +] + +\definebodyfontenvironment [22pt][% + interlinespace=24pt, + big=22pt, + small=14pt, + x=14pt% +] + +\definebodyfontenvironment [30pt][% + interlinespace=30pt, + big=30pt, + small=26pt, + x=26pt% +] + +%%% font families + +\usetypescriptfile[type-libertine] + +\usetypescriptfile[type-inconsolata] + +\startmode[mkii] +\starttypescript [maps] [ec] +\definetypeface [maps] [mm] [math] [euler] [default] [encoding=default,rscale=0.9] +\usemathcollection[euler] +\definetypeface [maps] [tt] [mono] [inconsolata] [default] [encoding=ec,rscale=0.92] +\definetypeface [maps] [ss] [sans] [default] [default] [encoding=ec,rscale=0.95] +\definetypeface [maps] [rm] [serif] [libertine] [default] [encoding=ec] +\stoptypescript +\usetypescript[maps] [ec] +\stopmode + +\startmode[mkiv] +\starttypescript [maps] +\definetypeface [maps] [mm] [math] [euler] [default] [rscale=0.9] +\definetypeface [maps] [tt] [mono] [inconsolata] [default] [rscale=0.92] +\definetypeface [maps] [ss] [sans] [modern] [default] [rscale=0.95] +\definetypeface [maps] [rm] [serif] [libertine] [default] +\stoptypescript +\usetypescript[maps] +\stopmode + +\setupbodyfont[maps,10pt,rm] -\definebodyfontenvironment [7pt] [interlinespace=8pt, big=8pt, small=6pt] -\definebodyfontenvironment [8pt] [interlinespace=9pt, big=9pt, small=7pt, x=6pt] -\definebodyfontenvironment [9pt] [interlinespace=10pt,big=10pt,small=8pt, x=7pt,script=6pt] -\definebodyfontenvironment [10pt][interlinespace=11pt,big=11pt,small=9pt, x=8pt,script=7pt,a=11pt] -\definebodyfontenvironment [11pt][interlinespace=11pt,big=11pt,small=10pt,x=9pt,script=8pt] -\definebodyfontenvironment [14pt][interlinespace=14pt,big=24pt,small=11pt,x=10pt] -\definebodyfontenvironment [24pt][interlinespace=24pt,big=24pt,small=14pt,x=11pt] -\definebodyfontenvironment [22pt][interlinespace=24pt,big=22pt,small=14pt,x=14pt] -\definebodyfontenvironment [30pt][interlinespace=30pt,big=30pt,small=26pt,x=26pt] +% activate protruding +\setupinterlinespace[line=11pt] -\definefontfeature [default] [default] [protrusion=pure] +\setupfontsynonym[handling=pure] -\definetypeface [maps] [rm] [serif] [libertine] [default] -\definetypeface [maps] [ss] [sans] [default] [default] [rscale=0.95] -\definetypeface [maps] [tt] [mono] [inconsolata] [default] [rscale=0.92] -\definetypeface [maps] [mm] [math] [euler] [default] [rscale=0.9] +\setupalign[hanging] -\setupbodyfont[maps,10pt,rm] +% \usetypescript[map][texnansi] -\setupinterlinespace - [line=11pt] +% \setupbodyfont [map,10pt] -\setupalign - [hanging] +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% additional general typographic details -\setupindenting - [yes,next,11pt] +\setupindenting [yes,next,11pt] % indenting after enumerations etc. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% 3 versions of layout with matching headers + +% I would like to move the entire layout slightly toward the spine, +% but Context seems to provide no good handle for that. +% So instead, I'll use a two-column layout centered on the page and +% matching single-column layouts. % It is easy to do the shift toward the spine when assembling the % volume with LaTeX pdfpages. -% eh ... why not use backspace ? +\definepapersize [maps][% + width=595.3bp, % 21cm + height=756bp% 10.5in +] -\definepapersize [maps] - [width=595.3bp, % 21cm - height=756bp] % 10.5in +\setuppapersize [maps][maps] -\setuppapersize - [maps] - [maps] % oversized +% parameters: +% margin -> latex marginparwith -\setuplayout - [topspace=40pt, +\setuplayout[% + topspace=40pt, height=688pt, header=33pt, margin=106pt, leftmargindistance=11pt, - rightmargindistance=11pt] + rightmargindistance=11pt% +] + -\setupblank - [5.5pt] +\setupblank[5.5pt] -\setuppagenumbering - [location=] +\setuppagenumbering [location=] \definetyping [widetyping] \setupheader [style=\ss] \setupfooter [style=\ss] -\def\AuHead{\MapsRunningAuthor} -\def\TiHead{\ifnum\pageno=\MapsPage\relax\MapsRunningAuthor\else\MapsRunningTitle\fi} - -\setupheads - [sectionnumber=no, - align=flushleft] - -\def\hfonti {\ssbfa} -\def\hfontii {\ssbf} -\def\hfontiii{\rm\it} - -\def\runin#1#2{#2.} - -\doifmodeelse {nosubsub} { - - \setuphead [section] - [style=\hfontii, - before={\blank[line]}, - after=] - - \setuphead [subsection] - [style=\hfontiii, - before={\blank[halfline]}% - command=\runin, - alternative=text, - distance=6pt] - -} { - - \setuphead [section] - [style=\hfonti, - before={\blank[line]}, - after={\blank[halfline]}] - - \setuphead [subsection] - [style=\hfontii, - before={\blank[halfline]}, - after=] - - \setuphead [subsubsection] - [style=\hfontiii, - before={\blank[halfline]}, - command=\runin, - alternative=text, - distance=6pt] - +\def\AuHead{% + %\ifnum\pageno=\MapsPage \hbox{}\else + \MapsRunningAuthor%\fi } +\def\TiHead{% + \ifnum\pageno=\MapsPage \relax \MapsRunningAuthor %\hbox{} + \else \MapsRunningTitle\fi} -\doifmodeelse {nosubsub} { - - \setuphead [subject] - [style=\hfontii, - before={\blank[halfline]}, - after=] - - \setuphead [subsubject] - [style=\hfontiii, - command=\runin, - alternative=text, - before={\blank[halfline]}] -} { +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% sectioning - \setuphead [subject] - [style=\hfonti, - before={\blank}, - after={\blank[halfline]}] +\setupheads[sectionnumber=no, align=right] - \setuphead [subsubject] - [style=\hfontii, - before={\blank[halfline]}, - after=] - - \setuphead [subsubsubject] - [style=\hfontiii, - command=\runin, - alternative=text, - before={\blank[halfline]}] - -} - -\setupfloats - [location=center, - before=\ss] % brrr +\def\hfonti{\ssbfa} +\def\hfontii{\ssbf} +\def\hfontiii{\rm\it} +\def\runin#1#2{#2.} -\setupcaptions - [headstyle=\ss, - style=\ssx, - stopper=., - distance=6pt, +\doifmodeelse{nosubsub}{% +\setuphead [section][% + style=\hfontii, + before={\blank[line]}, + after={}% +] +\setuphead [subsection][% + style=\hfontiii, + command=\runin, + alternative=text, + distance=6pt, + before={\blank[halfline]}% +]}{% +\setuphead [section][% + style=\hfonti, + before={\blank[line]}, + after={\blank[halfline]}% +] +\setuphead [subsection][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsection][% + style=\hfontiii, + command=\runin, + distance=6pt, + alternative=text, + before={\blank[halfline]}% +]} + +\doifmodeelse{nosubsub}{% +\setuphead [subject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]}{% +\setuphead [subject][% + style=\hfonti, + before={\blank}, + after={\blank[halfline]}% +] +\setuphead [subsubject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% floats + +\setupfloats [location=center, before={\ss}] +\setupcaptions [headstyle={\ss},style={\ssx}, + stopper=.,distance=6pt, inbetween={\blank[halfline]}] -% \def\ChkBox -% {\definedfont[file:stmary10]{\char "40}} % doesnt work - -\def\ChkBox - {\hbox - {\boxrulewidth=.4pt - \raise.2ex\ruledvbox{\phantom{\vrule width .85ex height .85ex}}}} - +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% various document elements + +%\startnotmode[realfonts] +\def\ChkBox{% + \hbox {\boxrulewidth=.4pt \raise.2ex\ruledvbox + {\phantom{\vrule width .85ex height .85ex% +}}}} + +\startmode[mkii] +\pdfmapline{stmary10 stmary10 <stmary10.pfb} +\def\ChkBox{\definedfont[stmary10]{\char "40}} +\stopmode + +\startmode[mkiv] +\def\ChkBox{\definedfont[file:stmary10]{\char "40}} % doesnt work +\def\ChkBox{% + \hbox {\boxrulewidth=.4pt \raise.2ex\ruledvbox + {\phantom{\vrule width .85ex height .85ex% +}}}} +\stopmode +%\stopnotmode +%\startmode[realfonts] +%\def\ChkBox{\raise.12ex\hbox{\ws \char50}} +%\stopmode \definesymbol [1][\ChkBox] \setupitemize[1][packed] -\setupitemize [each] - [indentnext=no, +\setupitemize [each][% + indentnext=no, align=right, width=1em, - distance=0pt] + distance=0pt% +] -% an outer form of itemize that does not indent the paragraph. +% an outer form of itemize that does not indent +% the paragraph. -% \startitemize[width=1sp,#1] -% \let\doitem\item -% \def\item{\doitem[]\hbox{}\kern12pt\rightskip=0pt}% +\definecomplexorsimpleempty\startouteritemize +\def\complexstartouteritemize[#1]{\begingroup + \startitemize[width=1sp,#1] + \let\doitem\item + \def\item{\doitem[]\hbox{}\kern12pt\rightskip=0pt}% +} -\defineitemgroup - [outeritemize] +\def\stopouteritemize{\stopitemize\endgroup} -\setupitemgroup - [outeritemize] - [width=1sp, - distance=12pt] -\setupenumerations - [indentnext=no] +\setupenumerations [indentnext=no] -\setupdescriptions - [indentnext=no] +\setupdescriptions [indentnext=no] -% \unexpanded\def\smalltyping % ? ? ? ? -% {\switchtobodyfont[tt]% -% \parindent=0pt} +\unexpanded\def\smalltyping{% + \switchtobodyfont[tt]% +% \setuplocalinterlinespace[line=11pt]% + \parindent=0pt +} % typing: % - prettyverbatim is NOT the default % - smaller size -\setuptyping - [% style=\smalltyping, - option=none, - indentnext=no] +\unexpanded\def + \XeTeX{X\lower.5ex\hbox{\kern-.1em\mirror{E}}\kern-.1667em\TeX} + +\setuptyping [% + style={\smalltyping}, + option=none, + indentnext=no% +] -\def\footnum#1{#1.} +\def\footnum#1{#1.} \setupfootnotes [location=none, width=\textwidth, +% bodyfont={rm,9pt}, before=, - numbercommand=\footnum] + numbercommand=, + command=\footnum] \setupfootnotedefinition [location=serried, @@ -250,31 +374,26 @@ after=\blank] \def\startIntroEntry#1% - {\startlinecorrection - \bgroup - \setupalign[right] - \setuptolerance[verytolerant] - \setupindenting[no] - \noindent - \switchtobodyfont[9pt]% - \setuplocalinterlinespace[line=10pt]% - \parfillskip 0pt plus 1fill - \rightskip6pt plus 1fill - \ss - \bgroup - \bf - #1% - \par - \egroup - \ignorespaces} + {\startlinecorrection + \bgroup + \setupalign[right] + \setuptolerance[verytolerant] + \setupindenting[no] + \noindent + \switchtobodyfont[9pt]% + \setuplocalinterlinespace[line=10pt]% + %\hyphenpenalty10000 + \parfillskip 0pt plus 1fill + \rightskip6pt plus 1fill + \ss + \bgroup\bf #1\par\egroup + \ignorespaces } \def\stopIntroEntry - {\par - \egroup - \stoplinecorrection - \blank[line]} + {\par\egroup \stoplinecorrection + \blank[line] } -\unexpanded\def\defineIntroEntry[#1][#2][#3]% +\def\defineIntroEntry[#1][#2][#3]% {\setvalue{start#1}{\startIntroEntry{#2}}% \setvalue {stop#1}{\stopIntroEntry#3}} @@ -282,182 +401,173 @@ \defineIntroEntry[Abstract][Abstract][] % article parameters (other fields and defaults) -% -% we can use setups instead (with a set key) - \def\MapsBibData[#1]% {\getparameters [Maps] - [SubTitle=, - RunningAuthor=, - RunningTitle=, - Email=, - Address=, - Page=1, - Title=, - Author=, - Period=VOORJAAR, - Number=40, - Year=2010, - #1]% - \doifinstringelse{oorjaar}{\MapsPeriod}{\def\MapsPeriod{VOORJAAR}}{}% - \doifinstringelse{pring} {\MapsPeriod}{\def\MapsPeriod{VOORJAAR}}{}% - \doifinstringelse{ajaar} {\MapsPeriod}{\def\MapsPeriod{NAJAAR}} {}% - \doifinstringelse{utumn} {\MapsPeriod}{\def\MapsPeriod{NAJAAR}} {}% - \doifnothing\MapsRunningAuthor - {\global\let\MapsRunningAuthor\MapsAuthor}% - \doifnothing\MapsRunningTitle - {\global\let\MapsRunningTitle\MapsTitle}} - -\def\dostartArticle[#1]% - {\MapsBibData[#1] - \pageno=\MapsPage - \count0=\MapsPage - \setuppagenumber[number=\MapsPage] - \startbaselinecorrection - \bgroup - \hsize = 457pt - \let\\\crlf - \blank[29pt,force] - \switchtobodyfont[ss,30pt] - \setupalign[right] - \bgroup - \noindent - \MapsTitle - \par - \blank[6pt] - \egroup - \ifx\MapsSubTitle\empty \else - \bgroup - \switchtobodyfont[ss,22pt]\noindent - \advance \rightskip 0pt plus 2em - \MapsSubTitle - \par - \egroup - \fi - \doifmodeelse{newstyle}{\blank[22pt]}{\blank[30pt]} - \egroup - \setupalign[width] - \switchtobodyfont[rm,10pt] - \doifmode{newstyle}{\noindent\MapsAuthor\blank[line]} - \stopbaselinecorrection - \doifnotmode {onecolumn} { - \startcolumns - \hyphenpenalty1000 - } { - \clubpenalty10000 - \widowpenalty10000 - } - \fi} + [SubTitle=, + RunningAuthor=, + RunningTitle=, + Email=, + Address=, + Page=1, + Title=, + Author=, + Period=VOORJAAR, + Number=40, + Year=2010, + #1]% + \doifinstringelse{oorjaar}{\MapsPeriod}{\def\MapsPeriod{VOORJAAR}}{}% + \doifinstringelse{pring}{\MapsPeriod}{\def\MapsPeriod{VOORJAAR}}{}% + \doifinstringelse{ajaar}{\MapsPeriod}{\def\MapsPeriod{NAJAAR}}{}% + \doifinstringelse{utumn}{\MapsPeriod}{\def\MapsPeriod{NAJAAR}}{}% + \doifnothing\MapsRunningAuthor + {\global\let\MapsRunningAuthor\MapsAuthor}% + \doifnothing\MapsRunningTitle + {\global\let\MapsRunningTitle\MapsTitle}}% + +\def\dostartArticle[#1]{% + \MapsBibData[#1] + \pageno=\MapsPage + \count0=\MapsPage + \setuppagenumber[number=\MapsPage] + \startbaselinecorrection + \bgroup + \hsize = 457pt + \let\\\crlf + \blank[29pt,force] + \switchtobodyfont[ss,30pt] + \setupalign[right] + {\noindent\MapsTitle\par\blank[6pt]} + \ifx\MapsSubTitle\empty \else + { \switchtobodyfont[ss,22pt]\noindent + \advance \rightskip 0pt plus 2em + \MapsSubTitle\par} + \fi + \doifmodeelse{newstyle} + {\blank[22pt]} + {\blank[30pt]} + \egroup + \setupalign[width] + \switchtobodyfont[rm,10pt] + \doifmode{newstyle} + {\noindent\MapsAuthor\blank[line]} + \stopbaselinecorrection + \ifMapsInColumns + \startcolumns\hyphenpenalty1000 + \else + \clubpenalty10000 + \widowpenalty10000 + \fi +} -\definecolumnset - [mapsset] - [n=2, - grid=on] +\definecolumnset[mapsset][n=2,grid=on] -\def\startArticle - {\dosingleempty\dostartArticle} +\def\startArticle{\dosingleempty\dostartArticle} -\def\signArticle - {\blank - \let\\\crlf - \noindent - \switchtobodyfont[ss,9pt]% - \MapsAuthor - \doifsomething{\MapsAddress}{\crlf\MapsAddress}% - \doifsomething{\MapsEmail} {\crlf\MapsEmail}% - \switchtobodyfont[10pt]% - \def\signArticle{}} - -\def\stopArticle - {\par - \signArticle - \doifnotmode {onecolumn} { - \stopcolumns - } - \page} +\def\signArticle{% + \blank\let\\\crlf + \noindent\switchtobodyfont[ss,9pt]% + \MapsAuthor + \doifsomething{\MapsAddress}{\\\MapsAddress}% + \doifsomething{\MapsEmail}{\\\MapsEmail}% + \switchtobodyfont[10pt]% + \def\signArticle{}% +} + +\def\stopArticle{% + \par\signArticle + \ifMapsInColumns \stopcolumns \fi + \page +} \installpagebreakhandler{last}{} -\doifmodeelse {onecolumn} { +%%% `logos' %%%%%%%%%%%%%%%%%%%%%%%%%% - \setuplayout[width=340pt] +% don't do this for the proceedings because it is a TUGboat also +%\def\LATEX{\LaTeX} +%\def\TEX{\TeX} - \doifmodeelse {asym} {% one col, asymmetric +\unexpanded\def\LaTeX % requested by erik frambach + {{\setbox\scratchbox\hbox{L}% + \scratchdimen\ht\scratchbox + \setbox\scratchbox\hbox{\switchtobodyfont[script]A}% + L\kern-.55\wd\scratchbox + \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% + \kern-.2\wd\scratchbox\TeX}} - \setuplayout[backspace=187.3pt]% - \setuptyping [widetyping][oddmargin=-117pt] - \setuppagenumbering [alternative={singlesided,doublesided}] - \setupheadertexts - [{\hbox{}\hskip-117pt\TiHead}] - [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-30pt\hbox{}}] - [{\hbox{}\hskip-147pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] - [\AuHead] - \setupfootertexts - } { % one col, symmetric +\def\CONTEXT{Con{\TeX}t} +\def\ConTeXt{Con{\TeX}t} +\def\METAFONT{Metafont} +\def\METAPOST{MetaPost} +\def\POSTSCRIPT{PostScript} - \setuplayout[backspace=70.3pt] - \setuppagenumbering [alternative=doublesided] - \setuptyping[blank=halfline] - \setupheadertexts - [\TiHead] - [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-147pt\hbox{}}] - [{\hbox{}\hskip-147pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] - [\AuHead] - \setupfootertexts +\def\acro#1{{\switchtobodyfont[9pt]#1}} - } -} { % two col +%%%%%%%%%%% - \setuplayout[width=457pt] - \setupcolumns[n=2,tolerance=verytolerant,distance=11pt] - \setuplayout[backspace=70.3pt,grid=yes] +\doifmodeelse{onecolumn}{% + \setuplayout[width=340pt] + \doifmodeelse{asym}{% one col, asymmetric + \setuplayout[backspace=187.3pt]% + \setuptyping [widetyping][oddmargin=-117pt] + \setuppagenumbering [alternative={singlesided,doublesided}] + \setupheadertexts + [{\hbox{}\hskip-117pt\TiHead}] + [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-30pt\hbox{}}] + [{\hbox{}\hskip-147pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] + [\AuHead] + \setupfootertexts + }{% one col, symmetric + \setuplayout[backspace=70.3pt] \setuppagenumbering [alternative=doublesided] \setuptyping[blank=halfline] \setupheadertexts - [\TiHead] - [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-30pt\hbox{}}] - [{\hbox{}\hskip-30pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] - [\AuHead] + [\TiHead] + [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-147pt\hbox{}}] + [{\hbox{}\hskip-147pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] + [\AuHead] \setupfootertexts - +}}{% two col + \setuplayout[width=457pt] + \setupcolumns[n=2,tolerance=verytolerant,distance=11pt] + \setuplayout[backspace=70.3pt,grid=yes] + \setuppagenumbering [alternative=doublesided] + \setuptyping[blank=halfline] + \setupheadertexts + [\TiHead] + [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-30pt\hbox{}}] + [{\hbox{}\hskip-30pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] + [\AuHead] + \setupfootertexts } \def\fulltextwidth{457pt} -\unexpanded\def\startdescription - {\blank - \startnarrower[left] - \def\sym##1{\par\noindent\hbox{\bf\kern-16pt\relax##1}\hskip12pt\relax}} +%\MapsBibData +% [] -\unexpanded\def\stopdescription - {\stopnarrower - \blank - \noindentation} +%\abovedisplayskip = 12pt +%\abovedisplayshortskip = 6pt -\frenchspacing +\newdimen\iabovedisplayskip +\newdimen\iabovedisplayshortskip +%\let\abovedisplayskip\iabovedisplayskip +%\let\abovedisplayshortskip\iabovedisplayshortskip -\setuptolerance - [tolerant] +%\protect -% tb compatible - -\unexpanded\def\ConTeXt {Con{\TeX}t} -\unexpanded\def\CONTEXT {\ConTeXt} -\unexpanded\def\METAFONT {Metafont} -\unexpanded\def\METAPOST {MetaPost} -\unexpanded\def\POSTSCRIPT{PostScript} -\unexpanded\def\XeTeX {X\lower.5ex\hbox{\kern-.1em\mirror{E}}\kern-.1667em\TeX} - -\unexpanded\def\LaTeX - {{\setbox\scratchbox\hbox{L}% - \scratchdimen\ht\scratchbox - \setbox\scratchbox\hbox{\switchtobodyfont[script]A}% - L\kern-.55\wd\scratchbox - \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% - \kern-.2\wd\scratchbox\TeX}} +\def\startdescription + {\blank + \bgroup + \def\sym##1{\par\noindent\hbox{\bf\kern -16pt ##1}\hskip 12pt} + \startnarrower[left] + } +\def\stopdescription + {\par \stopnarrower \egroup \blank \noindentation } -\unexpanded\def\acro#1{{\switchtobodyfont[9pt]#1}} +\frenchspacing +\setuptolerance[tolerant] \endinput diff --git a/tex/context/base/strc-not.lua b/tex/context/base/strc-not.lua index a5e9f1ad0..222623a59 100644 --- a/tex/context/base/strc-not.lua +++ b/tex/context/base/strc-not.lua @@ -265,17 +265,19 @@ function notes.getsymbolpage(tag,n) local nd = get(tag,n) local p = nd and nd.references.symbolpage or 0 if trace_notes then - report_notes("note %s of '%s' has page %s",n,tag,p) + report_notes("page number of note symbol %s of '%s' is %s",n,tag,p) end context(p) end function notes.getnumberpage(tag,n) local li = internal(tag,n) - li = li and li.pagenumber - li = li and li.numbers - li = li and li[1] - context(li or 0) + li = li and li.references + li = li and li.realpage or 0 + if trace_notes then + report_notes("page number of note number %s of '%s' is %s",n,tag,li) + end + context(li) end function notes.flush(tag,whatkind,how) -- store and postpone diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv index 0fefc9f9f..d3755a5b3 100644 --- a/tex/context/base/type-ini.mkiv +++ b/tex/context/base/type-ini.mkiv @@ -416,20 +416,6 @@ {\popmacro\relativefontsize \popmacro\fontclass} -% \def\dodefinetypeface[#1][#2][#3][#4][#5][#6]% -% {\dododefinetypeface[#1][#2]% -% \iffifthargument % sixth is optional, we need to expand since in #6 there can be a \typescripttwo -% \iftracetypescripts\writestatus\m!fonts{define: [#1] [#2] [#3] [#4]}\fi -% \dostarttypefacedefining{#1}{#2}{#6}% -% \usetypescript[#3][#4][\t!name,\t!default]% -% \usetypescript[#3][#5][\t!size]% -% \dostoptypefacedefining -% \else\iffourthargument -% \definetypeface[#1][#2][#3][#4][\s!default]% -% \else\ifthirdargument -% \getparameters[\??tf#1#2][#3]% -% \fi\fi\fi} - \def\dofastdefinetypeface#1#2#3#4#5% {\dododefinetypeface[#1][#2]% \dostarttypefacedefining{#1}{#2}{#5}% diff --git a/tex/context/base/type-otf.mkiv b/tex/context/base/type-otf.mkiv index 2cea1ba49..1423f4f6f 100644 --- a/tex/context/base/type-otf.mkiv +++ b/tex/context/base/type-otf.mkiv @@ -75,7 +75,7 @@ %D any more. Filename changes will be catched in luatex (fallbacks) but not in %D other tex's. - \starttypescript [serif] [modern,latin-modern,computer-modern] + \starttypescript [serif] [modern,latin-modern,computer-modern,default] \definefontsynonym [LMRoman5-Regular] [\s!file:lmroman5-regular] [\s!features=\s!default] \definefontsynonym [LMRoman6-Regular] [\s!file:lmroman6-regular] [\s!features=\s!default] \definefontsynonym [LMRoman7-Regular] [\s!file:lmroman7-regular] [\s!features=\s!default] @@ -113,7 +113,7 @@ \definefontsynonym [LMRoman10-Unslanted] [\s!file:lmromanunsl10-regular] [\s!features=\s!default] \stoptypescript - \starttypescript [sans] [modern,latin-modern,computer-modern] + \starttypescript [sans] [modern,latin-modern,computer-modern,default] \definefontsynonym [LMSans8-Regular] [\s!file:lmsans8-regular] [\s!features=\s!default] \definefontsynonym [LMSans9-Regular] [\s!file:lmsans9-regular] [\s!features=\s!default] \definefontsynonym [LMSans10-Regular] [\s!file:lmsans10-regular] [\s!features=\s!default] @@ -136,7 +136,7 @@ \definefontsynonym [LMSansQuotation8-BoldOblique] [\s!file:lmsansquot8-boldoblique] [\s!features=\s!default] \stoptypescript - \starttypescript [mono] [modern,modern-variable,modern-condensed,latin-modern,latin-modern-variable,latin-modern-condensed,computer-modern] + \starttypescript [mono] [modern,modern-variable,modern-condensed,latin-modern,latin-modern-variable,latin-modern-condensed,computer-modern,default] \definefontsynonym [LMTypewriter8-Regular] [\s!file:lmmono8-regular] [\s!features=\s!none] \definefontsynonym [LMTypewriter9-Regular] [\s!file:lmmono9-regular] [\s!features=\s!none] \definefontsynonym [LMTypewriter10-Regular] [\s!file:lmmono10-regular] [\s!features=\s!none] @@ -162,7 +162,7 @@ \definefontsynonym [LMTypewriterVarWd10-DarkOblique] [\s!file:lmmonoproplt10-boldoblique] [\s!features=\s!default] \stoptypescript - \starttypescript [math] [modern,latin-modern,computer-modern] + \starttypescript [math] [modern,latin-modern,computer-modern,default] \definefontsynonym[LMMathRoman5-Regular] [LMMath5-Regular@lmroman5-math] \definefontsynonym[LMMathRoman6-Regular] [LMMath6-Regular@lmroman6-math] \definefontsynonym[LMMathRoman7-Regular] [LMMath7-Regular@lmroman7-math] @@ -189,7 +189,7 @@ \loadfontgoodies[lm-math] \stoptypescript - \starttypescript [serif] [modern,latin-modern,computer-modern] [name] + \starttypescript [serif] [modern,latin-modern,computer-modern,default] [name] \definefontsynonym [Serif] [LMRoman-Regular] \definefontsynonym [SerifBold] [LMRoman-Bold] \definefontsynonym [SerifItalic] [LMRoman-Italic] @@ -200,7 +200,7 @@ \definefontsynonym [SerifCapsSlanted] [LMRoman-CapsOblique] \stoptypescript - \starttypescript [sans] [modern,latin-modern,computer-modern] [name] + \starttypescript [sans] [modern,latin-modern,computer-modern,default] [name] \definefontsynonym [Sans] [LMSans-Regular] \definefontsynonym [SansBold] [LMSans-Bold] \definefontsynonym [SansItalic] [LMSans-Oblique] @@ -211,7 +211,7 @@ \definefontsynonym [SansCapsSlanted] [LMSans-Oblique] \stoptypescript - \starttypescript [mono] [modern,latin-modern,computer-modern] [name] + \starttypescript [mono] [modern,latin-modern,computer-modern,default] [name] \definefontsynonym [Mono] [LMTypewriter-Regular] \definefontsynonym [MonoBold] [LMTypewriter-Dark] \definefontsynonym [MonoItalic] [LMTypewriter-Italic] @@ -223,14 +223,14 @@ \definefontsynonym [MonoVariable] [LMTypewriterVarWd-Regular] \stoptypescript - \starttypescript [math] [modern,latin-modern,computer-modern] [name] + \starttypescript [math] [modern,latin-modern,computer-modern,default] [name] \definefontsynonym [MathRoman] [LMMathRoman-Regular] %definefontsynonym [MathExtension] [LMMathExtension-Regular] %definefontsynonym [MathItalic] [LMMathItalic-Italic] %definefontsynonym [MathSymbol] [LMMathSymbols-Italic] \stoptypescript - \starttypescript [serif] [modern-variable,latin-modern-variable] [name] + \starttypescript [serif] [modern-variable,latin-modern-variable,default] [name] \definefontsynonym [Serif] [LMTypewriterVarWd-Regular] \definefontsynonym [SerifBold] [LMTypewriterVarWd-Oblique] \definefontsynonym [SerifItalic] [LMTypewriterVarWd-Oblique] @@ -241,7 +241,7 @@ \definefontsynonym [SerifCapsSlanted] [LMTypewriterVarWd-Oblique] \stoptypescript - \starttypescript [mono] [modern-condensed,latin-modern-condensed,modern-light-condensed,latin-modern-light-condensed] [name] + \starttypescript [mono] [modern-condensed,latin-modern-condensed,modern-light-condensed,latin-modern-light-condensed,default] [name] \definefontsynonym [Mono] [LMTypewriter-LightCondensed] \definefontsynonym [MonoBold] [LMTypewriter-LightCondensed] \definefontsynonym [MonoItalic] [LMTypewriter-LightCondensedOblique] @@ -252,7 +252,7 @@ \definefontsynonym [MonoCapsSlanted] [LMTypewriter-LightCondensed] \stoptypescript - \starttypescript [mono] [modern-light,latin-modern-light] [name] + \starttypescript [mono] [modern-light,latin-modern-light,default] [name] \definefontsynonym [Mono] [LMTypewriter-Light] \definefontsynonym [MonoBold] [LMTypewriter-Light] \definefontsynonym [MonoItalic] [LMTypewriter-LightOblique] @@ -265,7 +265,7 @@ % Later we will map the real fonts, here we just map synonyms. - \starttypescript [serif] [modern,latin-modern,computer-modern] + \starttypescript [serif] [modern,latin-modern,computer-modern,default] \definefontsynonym [LMRoman-DemiOblique] [LMRoman10-DemiOblique] \definefontsynonym [LMRoman-Bold] [LMRoman10-Bold] \definefontsynonym [LMRoman-BoldItalic] [LMRoman10-BoldItalic] @@ -277,7 +277,7 @@ \definefontsynonym [LMRoman-Oblique] [LMRoman10-Oblique] \stoptypescript - \starttypescript [sans] [modern,latin-modern,computer-modern] + \starttypescript [sans] [modern,latin-modern,computer-modern,default] \definefontsynonym [LMSans-Regular] [LMSans10-Regular] \definefontsynonym [LMSans-BoldOblique] [LMSans10-BoldOblique] \definefontsynonym [LMSans-Bold] [LMSans10-Bold] @@ -286,7 +286,7 @@ \definefontsynonym [LMSans-Oblique] [LMSans10-Oblique] \stoptypescript - \starttypescript [mono] [modern,latin-modern,modern-variable,latin-modern-variable,modern-condensed,latin-modern-condensed] + \starttypescript [mono] [modern,latin-modern,modern-variable,latin-modern-variable,modern-condensed,latin-modern-condensed,default] \definefontsynonym [LMTypewriter-CapsRegular] [LMTypewriter10-CapsRegular] \definefontsynonym [LMTypewriter-CapsOblique] [LMTypewriter10-CapsOblique] \definefontsynonym [LMTypewriter-Light] [LMTypewriter10-Light] @@ -306,7 +306,7 @@ \definefontsynonym [LMTypewriterVarWd-DarkOblique] [LMTypewriterVarWd10-DarkOblique] \stoptypescript - \starttypescript [serif] [modern,latin-modern,computer-modern] + \starttypescript [serif] [modern,latin-modern,computer-modern,default] \definefontsynonym [ComputerModern] [LMRoman-Regular] \definefontsynonym [ComputerModern-Italic] [LMRoman-Italic] \definefontsynonym [ComputerModern-Slanted] [LMRoman-Oblique] @@ -317,7 +317,7 @@ \definefontsynonym [ComputerModern-CapsSlanted] [LMRoman-CapsOblique] \stoptypescript - \starttypescript [sans] [modern,latin-modern,computer-modern] + \starttypescript [sans] [modern,latin-modern,computer-modern,default] \definefontsynonym [ComputerModernSans] [LMSans-Regular] \definefontsynonym [ComputerModernSans-Italic] [LMSans-Oblique] \definefontsynonym [ComputerModernSans-Slanted] [LMSans-Oblique] @@ -328,7 +328,7 @@ \definefontsynonym [ComputerModernSans-CapsSlanted] [LMSans-Oblique]% [LMSans-CapsOblique] \stoptypescript - \starttypescript [mono] [modern,latin-modern,computer-modern] + \starttypescript [mono] [modern,latin-modern,computer-modern,default] \definefontsynonym [ComputerModernMono] [LMTypewriter-Regular] \definefontsynonym [ComputerModernMono-Italic] [LMTypewriter-Italic] \definefontsynonym [ComputerModernMono-Slanted] [LMTypewriter-Oblique] @@ -340,7 +340,7 @@ \definefontsynonym [ComputerModernMono-Variable] [LMTypewriterVarWd-Regular] \stoptypescript - \starttypescript [mono] [modern-light,latin-modern-light] + \starttypescript [mono] [modern-light,latin-modern-light,default] \definefontsynonym [ComputerModernMono] [LMTypewriter-Light] \definefontsynonym [ComputerModernMono-Italic] [LMTypewriter-LightOblique] \definefontsynonym [ComputerModernMono-Slanted] [LMTypewriter-LightOblique] @@ -352,7 +352,7 @@ \definefontsynonym [ComputerModernMono-Variable] [LMTypewriterVarWd-Light] \stoptypescript - \starttypescript [serif] [modern-variable,latin-modern-variable] + \starttypescript [serif] [modern-variable,latin-modern-variable,default] \definefontsynonym [ComputerModernVariable] [LMTypewriterVarWd-Regular] \definefontsynonym [ComputerModernVariable-Italic] [LMTypewriterVarWd-Oblique] \definefontsynonym [ComputerModernVariable-Slanted] [LMTypewriterVarWd-Oblique] @@ -363,7 +363,7 @@ \definefontsynonym [ComputerModernVariable-CapsSlanted] [LMTypewriterVarWd-Oblique] \stoptypescript - \starttypescript [serif] [modern-variable-light,latin-modern-variable-light] + \starttypescript [serif] [modern-variable-light,latin-modern-variable-light,default] \definefontsynonym [ComputerModernVariable] [LMTypewriterVarWd-Light] \definefontsynonym [ComputerModernVariable-Italic] [LMTypewriterVarWd-LightOblique] \definefontsynonym [ComputerModernVariable-Slanted] [LMTypewriterVarWd-LightOblique] @@ -374,7 +374,7 @@ \definefontsynonym [ComputerModernVariable-CapsSlanted] [LMTypewriterVarWd-LightOblique] \stoptypescript - \starttypescript [math] [modern,latin-modern] + \starttypescript [math] [modern,latin-modern,default] % isn't this obsolete now? \definefontsynonym [LMMathRoman-Regular] [LMMathRoman10-Regular] \definefontsynonym [LMMathRoman-Bold] [LMMathRoman10-Bold] @@ -385,7 +385,7 @@ %definefontsynonym [LMMathItalic-BoldItalic] [LMMathItalic10-BoldItalic] \stoptypescript - \starttypescript [modern] + \starttypescript [modern,default] \definetypeface [modern] [rm] [serif] [modern] [computer-modern] \definetypeface [modern] [ss] [sans] [modern] [computer-modern] \definetypeface [modern] [tt] [mono] [modern] [computer-modern] diff --git a/tex/context/base/util-deb.lua b/tex/context/base/util-deb.lua index 8a0efde45..d61ac0f02 100644 --- a/tex/context/base/util-deb.lua +++ b/tex/context/base/util-deb.lua @@ -13,7 +13,7 @@ if not modules then modules = { } end modules ['util.deb'] = { local debug = require "debug" local getinfo = debug.getinfo -local type, next = type, next +local type, next, tostring = type, next, tostring local format, find = string.format, string.find local is_boolean = string.is_boolean @@ -142,3 +142,16 @@ end --~ debugger.showstats() --~ print("") --~ debugger.showstats(print,3) + +local is_node = node and node.is_node + +function inspect(i) + local ti = type(i) + if ti == "table" then + table.print(i,"table") + elseif is_node and is_node(i) then + print(node.sequenced(i)) + else + print(tostring(i)) + end +end diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua new file mode 100644 index 000000000..18caa27bd --- /dev/null +++ b/tex/context/base/util-str.lua @@ -0,0 +1,77 @@ +if not modules then modules = { } end modules ['util-str'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +utilities = utilities or {} +utilities.strings = utilities.strings or { } +local strings = utilities.strings + +local find, gsub = string.find, string.gsub +local patterns, Cs, lpegmatch = lpeg.patterns, lpeg.Cs, lpeg.match + +-- str = " \n \ntest \n test\ntest " +-- print("["..string.gsub(string.collapsecrlf(str),"\n","+").."]") + +local rubish = patterns.spaceortab^0 * patterns.newline +local anyrubish = patterns.spaceortab + patterns.newline +local anything = patterns.anything +local stripped = (patterns.spaceortab^1 / "") * patterns.newline +local leading = rubish^0 / "" +local trailing = (anyrubish^1 * patterns.endofstring) / "" +local redundant = rubish^3 / "\n" + +local pattern = Cs(leading * (trailing + redundant + stripped + anything)^0) + +function strings.collapsecrlf(str) + return lpegmatch(pattern,str) +end + +--~ local t = { +--~ "1234567123456712345671234567", +--~ "a\tb\tc", +--~ "aa\tbb\tcc", +--~ "aaa\tbbb\tccc", +--~ "aaaa\tbbbb\tcccc", +--~ "aaaaa\tbbbbb\tccccc", +--~ "aaaaaa\tbbbbbb\tcccccc", +--~ } +--~ for k,v do +--~ print(string.tabtospace(t[k])) +--~ end + +-- The following functions might end up in another namespace. + +function strings.tabtospace(str,tab) + -- we don't handle embedded newlines + while true do + local s = find(str,"\t") + if s then + if not tab then tab = 7 end -- only when found + local d = tab-(s-1) % tab + if d > 0 then + str = gsub(str,"\t",rep(" ",d),1) + else + str = gsub(str,"\t","",1) + end + else + break + end + end + return str +end + +--~ local template = string.striplong([[ +--~ aaaa +--~ bb +--~ cccccc +--~ ]]) + +function strings.striplong(str) -- strips all leading spaces + str = gsub(str,"^%s*","") + str = gsub(str,"[\n\r]+ *","\n") + return str +end diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index a7056a39d..83a11409e 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/18/10 19:47:18 +-- merge date : 11/19/10 22:50:14 do -- begin closure to overcome local limits and interference @@ -122,52 +122,6 @@ function string.topattern(str,lowercase,strict) end end ---~ local t = { ---~ "1234567123456712345671234567", ---~ "a\tb\tc", ---~ "aa\tbb\tcc", ---~ "aaa\tbbb\tccc", ---~ "aaaa\tbbbb\tcccc", ---~ "aaaaa\tbbbbb\tccccc", ---~ "aaaaaa\tbbbbbb\tcccccc", ---~ } ---~ for k,v do ---~ print(string.tabtospace(t[k])) ---~ end - --- The following functions might end up in another namespace. - -function string.tabtospace(str,tab) - -- we don't handle embedded newlines - while true do - local s = find(str,"\t") - if s then - if not tab then tab = 7 end -- only when found - local d = tab-(s-1) % tab - if d > 0 then - str = gsub(str,"\t",rep(" ",d),1) - else - str = gsub(str,"\t","",1) - end - else - break - end - end - return str -end - ---~ local template = string.striplong([[ ---~ aaaa ---~ bb ---~ cccccc ---~ ]]) - -function string.striplong(str) -- strips all leading spaces - str = gsub(str,"^%s*","") - str = gsub(str,"[\n\r]+ *","\n") - return str -end - -- obsolete names: string.quote = string.quoted @@ -187,6 +141,8 @@ if not modules then modules = { } end modules ['l-lpeg'] = { local lpeg = require("lpeg") +local type = type + lpeg.patterns = lpeg.patterns or { } -- so that we can share local patterns = lpeg.patterns @@ -196,10 +152,16 @@ local Ct, C, Cs, Cc, Cf, Cg = lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cf, lpeg.C local utfcharacters = string.utfcharacters local utfgmatch = unicode and unicode.utf8.gmatch +local anything = P(1) +local endofstring = P(-1) + +patterns.anything = anything +patterns.endofstring = endofstring + local digit, sign = R('09'), S('+-') local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") local utf8next = R("\128\191") -local escaped = P("\\") * P(1) +local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') @@ -210,7 +172,7 @@ patterns.utf8four = R("\240\244") * utf8next * utf8next * utf8next patterns.utfbom = P('\000\000\254\255') + P('\255\254\000\000') + P('\255\254') + P('\254\255') + P('\239\187\191') local utf8char = patterns.utf8one + patterns.utf8two + patterns.utf8three + patterns.utf8four -local validutf8char = utf8char^0 * P(-1) * Cc(true) + Cc(false) +local validutf8char = utf8char^0 * endofstring * Cc(true) + Cc(false) patterns.utf8 = utf8char patterns.utf8char = utf8char @@ -235,6 +197,7 @@ patterns.uppercase = R("AZ") patterns.letter = patterns.lowercase + patterns.uppercase patterns.space = P(" ") patterns.tab = P("\t") +patterns.spaceortab = patterns.space + patterns.tab patterns.eol = S("\n\r") patterns.spacer = S(" \t\f\v") -- + string.char(0xc2, 0xa0) if we want utf (cf mail roberto) patterns.newline = crlf + cr + lf @@ -253,7 +216,7 @@ patterns.unsingle = (squote/"") * ((escaped + (1-squote))^0) * (squote/"") patterns.unquoted = patterns.undouble + patterns.unsingle -- more often undouble patterns.unspacer = ((patterns.spacer^1)/"")^0 -local unquoted = Cs(patterns.unquoted * P(-1)) -- not C +local unquoted = Cs(patterns.unquoted * endofstring) -- not C function string.unquoted(str) return match(unquoted,str) or str @@ -293,7 +256,7 @@ local function splitat(separator,single) separator = P(separator) local other = C((1 - separator)^0) if single then - local any = P(1) + local any = anything splitter = other * (separator * C(any^0) + "") -- ? splitters_s[separator] = splitter else @@ -357,18 +320,6 @@ function string.checkedsplit(str,separator) return match(c,str) end ---~ function lpeg.append(list,pp) ---~ local p = pp ---~ for l=1,#list do ---~ if p then ---~ p = p + P(list[l]) ---~ else ---~ p = P(list[l]) ---~ end ---~ end ---~ return p ---~ end - --~ from roberto's site: local f1 = string.byte @@ -453,7 +404,7 @@ function lpeg.secondofsplit(separator) -- nil if not split local splitter = splitters_s[separator] if not splitter then separator = P(separator) - splitter = (1 - separator)^0 * separator * C(P(1)^0) + splitter = (1 - separator)^0 * separator * C(anything^0) splitters_s[separator] = splitter end return splitter @@ -476,7 +427,7 @@ end --~ -- slower: --~ --~ function lpeg.counter(pattern) ---~ local n, pattern = 0, (lpeg.P(pattern)/function() n = n + 1 end + lpeg.P(1))^0 +--~ local n, pattern = 0, (lpeg.P(pattern)/function() n = n + 1 end + lpeg.anything)^0 --~ return function(str) n = 0 ; lpegmatch(pattern,str) ; return n end --~ end @@ -539,8 +490,8 @@ local simple_escapes = { -- also defines in l-string ["*"] = ".*", } -local p = Cs((S("-.+*%()[]") / patterns_escapes + P(1))^0) -local s = Cs((S("-.+*%()[]") / simple_escapes + P(1))^0) +local p = Cs((S("-.+*%()[]") / patterns_escapes + anything)^0) +local s = Cs((S("-.+*%()[]") / simple_escapes + anything)^0) function string.escapedpattern(str,simple) if simple then @@ -646,6 +597,18 @@ end --~ print(lpeg.count("äáàa",lpeg.UR("àá"))) --~ print(lpeg.count("äáàa",lpeg.UR(0x0000,0xFFFF))) +function lpeg.oneof(list,...) -- lpeg.oneof("elseif","else","if","then") + if type(list) ~= "table" then + list = { list, ... } + end + -- sort(list) -- longest match first + local p = P(list[1]) + for l=2,#list do + p = p + P(list[l]) + end + return p +end + end -- closure do -- begin closure to overcome local limits and interference @@ -3813,7 +3776,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid) end end -- if trace_scaling then - -- report_define("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or k,description.index,description.name or '-',description.class or '-') + -- report_define("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-') -- end if tounicode then local tu = tounicode[index] -- nb: index! |