[NTG-context] Re: Tracker for hyphens at the end of lines
On 8/9/2023 12:10 PM, denis.ma...@unibe.ch wrote: Keith, you can also check hyphenations using a script: -- check-hyphens.lua --[[ analyze hyphenations based on a ConTeXt log file enable hyphenation tracking in the ConTeXt file with \enabletrackers[hyphenation.applied] then run this script with lua check-hyphens.lua input_file whitelist.ending for the input_file we assume .log, so no need to add this for the whitelist a file ending has to be supplied the whitelist is optional ]] -- local lines = string.splitlines(io.loaddata("oeps.tex")or "") or { } -- local pprint = require('pprint') function main (input_file, whitelist_file) local lines = lines_from(input_file .. ".log") local whitelist = {} if whitelist_file == nil then whitelist = {} else whitelist = lines_from(whitelist_file) end --pprint (lines) --pprint (whitelist) local filteredWordlist = filterHyphenationsWordlist (cleanLines (getHyphenationLines(lines)), whitelist) -- pprint(filteredWordlist) saveResultsToFile(filteredWordlist, 'check-hyphens.log') end -- see if the file exists -- http://lua-users.org/wiki/FileInputOutput -- see if the file exists function file_exists(file) local f = io.open(file, "rb") if f then f:close() end return f ~= nil end -- get all lines from a file, returns an empty -- list/table if the file does not exist function lines_from(file) if not file_exists(file) then return {} end local lines = {} for line in io.lines(file) do lines[#lines + 1] = line end return lines end -- String testing function starts_with(str, start) return str:sub(1, #start) == start end -- get relevant lines function getHyphenationLines(lines) local lines_with_hyphenations = {} for k,v in pairs(lines) do if (starts_with(v, "hyphenated") and not string.find(v, "start hyphenated words") and not string.find(v, "stop hyphenated words")) then table.insert(lines_with_hyphenations, v) end end return lines_with_hyphenations end -- String cleaning -- wrapper functions function cleanLines (xs) local cleanedLines = {} for k,v in pairs(xs) do table.insert(cleanedLines, cleanLine(v)) end return cleanedLines end function cleanLine (x) return removeTrailingPunctuation(getWord(x)) end -- 1. Start reading at colon function getWord(x) -- wir lesen aber Zeichen 26 return string.sub(x,26) end -- 2. Remove trailing punctuation function removeTrailingPunctuation (x) if string.find(x, ',') then return x:sub(1, -2) else return x end end -- test if word is in second list function inList (x, list) for k,v in ipairs(list) do if v == x then return true end end return nil end -- Filter hyphenated words based on second list (whitelist) function filterHyphenationsWordlist (xs, list) local result = {} for k,v in ipairs(xs) do if not inList(v, list) then table.insert (result, v) end end return result end function saveResultsToFile(results, output_file) -- Opens a file in write mode output_file = io.open("check_hyphens.log", "w") -- sets the default output file as output_file io.output(output_file) -- iterate oiver for k,v in ipairs(results) do io.write(v..'\n') end -- closes the open file io.close(output_file) end -- Run main(arg[1], arg[2]) Ok, a little lua lesson, if you don't mind. xxx.tex \enabletrackers[hyphenation.applied] \starttext \input tufte \stoptext xxx.tmp re-fine xxx.lua local function check(logname,whitename) if not logname then return end local data = io.loaddata(logname) or "" if data == "" then return end local blob = string.match(data,"start hyphenated words(.-)stop hyphenated words") if not blob then return end local white = table.tohash(string.splitlines(whitename and io.loaddata(whitename) or "")) for n, s in string.gmatch(blob,"(%d+) *: (%S+)") do if white[s] then -- were good else print(n,s) end end end check(environment.files[1],environment.files[2]) -- print("TEST 1") -- check("xxx.log") -- print("TEST 2") -- check("xxx.log","xxx.tmp") --- >mtxrun --script xxx xxx.log 1 dis-tinguish 1 harmo-nize 1 re-fine >mtxrun --script xxx xxx.log xxx.tmp 1 dis-tinguish 1 harmo-nize That said, i wonder if we should add the filename, just in case on
[NTG-context] Re: Tracker for hyphens at the end of lines
Keith, you can also check hyphenations using a script: -- check-hyphens.lua --[[ analyze hyphenations based on a ConTeXt log file enable hyphenation tracking in the ConTeXt file with \enabletrackers[hyphenation.applied] then run this script with lua check-hyphens.lua input_file whitelist.ending for the input_file we assume .log, so no need to add this for the whitelist a file ending has to be supplied the whitelist is optional ]] -- local lines = string.splitlines(io.loaddata("oeps.tex")or "") or { } -- local pprint = require('pprint') function main (input_file, whitelist_file) local lines = lines_from(input_file .. ".log") local whitelist = {} if whitelist_file == nil then whitelist = {} else whitelist = lines_from(whitelist_file) end --pprint (lines) --pprint (whitelist) local filteredWordlist = filterHyphenationsWordlist (cleanLines (getHyphenationLines(lines)), whitelist) -- pprint(filteredWordlist) saveResultsToFile(filteredWordlist, 'check-hyphens.log') end -- see if the file exists -- http://lua-users.org/wiki/FileInputOutput -- see if the file exists function file_exists(file) local f = io.open(file, "rb") if f then f:close() end return f ~= nil end -- get all lines from a file, returns an empty -- list/table if the file does not exist function lines_from(file) if not file_exists(file) then return {} end local lines = {} for line in io.lines(file) do lines[#lines + 1] = line end return lines end -- String testing function starts_with(str, start) return str:sub(1, #start) == start end -- get relevant lines function getHyphenationLines(lines) local lines_with_hyphenations = {} for k,v in pairs(lines) do if (starts_with(v, "hyphenated") and not string.find(v, "start hyphenated words") and not string.find(v, "stop hyphenated words")) then table.insert(lines_with_hyphenations, v) end end return lines_with_hyphenations end -- String cleaning -- wrapper functions function cleanLines (xs) local cleanedLines = {} for k,v in pairs(xs) do table.insert(cleanedLines, cleanLine(v)) end return cleanedLines end function cleanLine (x) return removeTrailingPunctuation(getWord(x)) end -- 1. Start reading at colon function getWord(x) -- wir lesen aber Zeichen 26 return string.sub(x,26) end -- 2. Remove trailing punctuation function removeTrailingPunctuation (x) if string.find(x, ',') then return x:sub(1, -2) else return x end end -- test if word is in second list function inList (x, list) for k,v in ipairs(list) do if v == x then return true end end return nil end -- Filter hyphenated words based on second list (whitelist) function filterHyphenationsWordlist (xs, list) local result = {} for k,v in ipairs(xs) do if not inList(v, list) then table.insert (result, v) end end return result end function saveResultsToFile(results, output_file) -- Opens a file in write mode output_file = io.open("check_hyphens.log", "w") -- sets the default output file as output_file io.output(output_file) -- iterate oiver for k,v in ipairs(results) do io.write(v..'\n') end -- closes the open file io.close(output_file) end -- Run main(arg[1], arg[2]) > -Ursprüngliche Nachricht- > Von: Keith McKay > Gesendet: Dienstag, 1. August 2023 20:22 > An: mailing list for ConTeXt users > Betreff: [NTG-context] Re: Tracker for hyphens at the end of lines > > Thanks Hans! > > I'm never disappointed, always amazed with ConTeXt! > > This is just what I was looking for. > > Best Wishes > > Keith McKay > > On 01/08/2023 18:10, Hans Hagen via ntg-context wrote: > > On 8/1/2023 4:54 PM, Keith McKay wrote: > >> Hi colleagues, > >> > >> Is there a tracker for highlighting hyphens at the end of lines > >> similar the way underfull and overfull boxes can be displayed with a > >> coloured bar at the end of the offending line? > >> > >> I have looked at the wiki page "Reviewing hyphenation" and it has a > >> solution for mkii from 2009 which, I would think, won't be suitable > >> for present day ConTeXt. I have tried searching for hyphens using > >> Skim and Adobe Acrobate viewers but although they find hyphenation in > >> line they don't recognise hyphens at the edge of lines. > >> > >> Any help would be appreciated. > > I suppose you would be disappointed it there was no tracker ... &g
Re: [NTG-context] define math function with \, inside
Hi Mikael, On Mon, May 01, 2023 at 05:48:40PM +0200, Mikael Sundqvist via ntg-context wrote: > [...] > This works here (but maybe there should be a simpler way): > > \definemathfunction > [argmax] > [mathlimits=auto] > > \setupmathlabeltext > [en] > [argmax=arg\sixperemspace max] > [...] That was exactly what I was looking for. It is working perfectly. Thanks a lot! With this knowledge finding additional information in the wiki is much easier: :) 1. https://wiki.contextgarden.net/Command/_setuplabeltext 2. https://wiki.contextgarden.net/Command/_labeltext Stefan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] define math function with \, inside
Hi, On Mon, May 1, 2023 at 5:27 PM Stefan Haller via ntg-context wrote: > > Hi all, > > I wanted to define a custom math function (similar to log etc.) for > argmax. However, I wanted to have a small space between "arg" and "max" > and limits should work properly. I am using a up-to-date LMTX installation. > > Without the first constraint it's easy: > > > % old way: > > \definemathcommand[argmax][limop]{\mfunction[argmax]} > > % new way, discoverd by looking into math-def.mkxl > > \definemathfunction[argmax] > > However, both methods do not work if I want to have "arg\,max" printed > (error about \endcsname missing). With mkiv the first method works and > can also be found in the wiki[1]. > > What's the current way to define such a custom math function? > > Thanks! > Stefan > > [1]: https://wiki.contextgarden.net/Math/functions This works here (but maybe there should be a simpler way): \definemathfunction [argmax] [mathlimits=auto] \setupmathlabeltext [en] [argmax=arg\sixperemspace max] \startTEXpage[offset=1ts] \im{ \argmax_{a\in A} f(a) } \blank[big] \dm{ \argmax_{a\in A} f(a) } \stopTEXpage /Mikael ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] define math function with \, inside
Hi all, I wanted to define a custom math function (similar to log etc.) for argmax. However, I wanted to have a small space between "arg" and "max" and limits should work properly. I am using a up-to-date LMTX installation. Without the first constraint it's easy: > % old way: > \definemathcommand[argmax][limop]{\mfunction[argmax]} > % new way, discoverd by looking into math-def.mkxl > \definemathfunction[argmax] However, both methods do not work if I want to have "arg\,max" printed (error about \endcsname missing). With mkiv the first method works and can also be found in the wiki[1]. What's the current way to define such a custom math function? Thanks! Stefan [1]: https://wiki.contextgarden.net/Math/functions ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked
Max & Hans: I installed the stand-alone ConTeXt installation just today. It seems like I have my $PATH set correctly now. I have been editing ConTeXt and running it within TeXstudio. I had set up a "user command" to execute arara on LaTeX and ConTeXt files when I did NOT have the "standalone" version installed. It still works correctly. Today, I created a separate "user command" within TeXstudio, and it points to "/usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun" This command generates the same log output as the example at https://gitlab.com/islandoftex/images/texlive/-/issues/30. If I understand this correctly, my OLD user command within TeXstudio is still finding the TeXlive version of ConTeXt, and that TeXlive version does have the symlinks mentioned by Max (and BTW, I did NOT create those, they are part of the default TeXlive installation process!). This is because my OLD "arara" command has the path to the March 13 version of TeXlive 2023 version (installed from ISO image, with some updates using tlmgr already installed). Lynx On 2023-04-27 21:00, Max Chernoff via ntg-context wrote: > Hi Hans, > > With the LuaMetaTeX-based ConTeXt wrapper, it's not generally possible > to run ConTeXt from a symlinked binary in another directory. This shows > up if someone makes symlinks in "/usr/bin" so that they can avoid adding > anything to their $PATH. > > If you make run a symlink to the LuaMetaTeX-based ConTeXt wrapper, it > looks for texmfcnf.lua relative to the symlink location, not the symlink > target. With the old LuaTeX/kpse-based wrapper, the script would look > for texmfcnf.lua relative to the symlink target. > > I know that my description above is terrible, so here's a demo: > > $ bin=$(mtxrun --expand-var TEXMFOS | head -1)/* > $ cd $(mktemp -d) > $ ln -s $bin/luatex $bin/luametatex $bin/context $bin/context.lua $bin/mtxrun > $bin/mtxrun.lua . > $ ./context --nofile > $ ./context --luatex --nofile > > Running the above commands used to work with the old LuaTeX/kpse-based > wrapper, but it doesn't work any more. I was able to ""fix"" this by > adding the lines > > if os.selfpath then > environment.ownbin = lfs.symlinktarget(os.selfpath .. io.fileseparator .. > os.selfname) > environment.ownpath = environment.ownbin:match("^.*" .. io.fileseparator) > else > environment.ownpath = kpse.new("luatex"):var_value("SELFAUTOLOC") > environment.ownbin = environment.ownpath .. io.fileseparator .. (arg[-2] or > arg[-1] or arg[0] or "luatex"):match("[^" .. io.fileseparator .. "]*$") > end > > to mtxrun.lua, right below the line > > package.loaded["data-ini"] = package.loaded["data-ini"] or true > > but this is obviously not a very good fix. > > There are some threads with more details at: > > https://tug.org/pipermail/tex-live/2023-March/049028.html > https://gitlab.com/islandoftex/images/texlive/-/issues/30 > > Those links only discuss TL, but I get the same issue if I make a symlink > to the standalone ConTeXt files. > > Thanks, > -- Max > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > __ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] LuaMetaTeX doesn't find files when symlinked
Hi Hans, With the LuaMetaTeX-based ConTeXt wrapper, it's not generally possible to run ConTeXt from a symlinked binary in another directory. This shows up if someone makes symlinks in "/usr/bin" so that they can avoid adding anything to their $PATH. If you make run a symlink to the LuaMetaTeX-based ConTeXt wrapper, it looks for texmfcnf.lua relative to the symlink location, not the symlink target. With the old LuaTeX/kpse-based wrapper, the script would look for texmfcnf.lua relative to the symlink target. I know that my description above is terrible, so here's a demo: $ bin=$(mtxrun --expand-var TEXMFOS | head -1)/* $ cd $(mktemp -d) $ ln -s $bin/luatex $bin/luametatex $bin/context $bin/context.lua $bin/mtxrun $bin/mtxrun.lua . $ ./context --nofile $ ./context --luatex --nofile Running the above commands used to work with the old LuaTeX/kpse-based wrapper, but it doesn't work any more. I was able to ""fix"" this by adding the lines if os.selfpath then environment.ownbin = lfs.symlinktarget(os.selfpath .. io.fileseparator .. os.selfname) environment.ownpath = environment.ownbin:match("^.*" .. io.fileseparator) else environment.ownpath = kpse.new("luatex"):var_value("SELFAUTOLOC") environment.ownbin = environment.ownpath .. io.fileseparator .. (arg[-2] or arg[-1] or arg[0] or "luatex"):match("[^" .. io.fileseparator .. "]*$") end to mtxrun.lua, right below the line package.loaded["data-ini"] = package.loaded["data-ini"] or true but this is obviously not a very good fix. There are some threads with more details at: https://tug.org/pipermail/tex-live/2023-March/049028.html https://gitlab.com/islandoftex/images/texlive/-/issues/30 Those links only discuss TL, but I get the same issue if I make a symlink to the standalone ConTeXt files. Thanks, -- Max ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] Feynman Diagrams
if not, write to the Free Software %% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %% %% \CheckSum{924} %% \CharacterTable %% {Upper-case\A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits\0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar\$ Percent \% Ampersand \& %% Acute accent \' Left paren\( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals\= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex\^ Underscore\_ %% Grave accent \` Left brace\{ Vertical bar \| %% Right brace \} Tilde \~} %% def subgraph (expr x, y, wd, ht) = begingroup save c, ne, nw, sw, se; pair c, ne, nw, sw, se; sw = (x,y); se = sw + (wd,0); nw = sw + (0,ht); ne = sw + (wd,ht); c = .5[sw,ne]; enddef; def endsubgraph = endgroup enddef; if known cmbase: errhelp "feynmf will only work with plain Metafont, as described in the book."; errmessage "feynmf: CMBASE detected. Please use the PLAIN base."; forever: errmessage "No use in trying! You'd better eXit now ..."; errorstopmode; endfor fi vardef parse_RCS (suffix RCS) (expr s) = save n, c; numeric n, RCS[]; string c; RCS[0] := 0; for n = 1 upto length (s): c := substring (n-1,n) of s; exitif ((RCS[0] > 0) and (c = " ")); if ((c = "0") or (c = "1") or (c = "2") or (c = "3") or (c = "4") or (c = "5") or (c = "6") or (c = "7") or (c = "8") or (c = "9")): if RCS[0] = 0: RCS[0] := 1; RCS[RCS[0]] := 0; fi RCS[RCS[0]] := 10 * RCS[RCS[0]] + scantokens (c); elseif c = ".": RCS[0] := RCS[0] + 1; RCS[RCS[0]] := 0; else: fi endfor enddef; vardef require_RCS_revision expr s = save n, TeX_rev, mf_rev; numeric n; parse_RCS (TeX_rev, s); parse_RCS (mf_rev, "$Revision: 1.30 $"); for n = 1 upto min (2, TeX_rev[0], mf_rev[0]): if TeX_rev[n] > mf_rev[n]: errhelp "Your version of `feynmf.sty' is higher that of your `feynmf.mf'."; errmessage "feynmf: Metafont macros out of date"; elseif TeX_rev[n] < mf_rev[n]: errhelp "Your version of `feynmf.mf' is higher that of your `feynmf.sty'."; errmessage "feynmf: LaTeX style out of date"; fi exitif (TeX_rev[n] <> mf_rev[n]); endfor enddef; vardef cullit = \ enddef; color foreground; foreground = black; vardef beginchar (expr c, wd, ht, dp) = LaTeX_file := ""; beginfig(c); w:=wd; h:=ht; enddef; string LaTeX_file; vardef endchar = setbounds currentpicture to (0,0)--(w,0)--(w,h)--(0,h)--cycle; if LaTeX_file <> "": write EOF to LaTeX_file; LaTeX_file := ""; fi endfig enddef; bp# := bp; cc# := cc; cm# := cm; dd# := dd; in# := in; mm# := mm; pc# := pc; pt# := pt; vardef define_blacker_pixels(text t) = forsuffixes $=t: $:=$.#; endfor enddef; picture unitpixel; unitpixel = nullpicture; addto unitpixel contour unitsquare; def t_ = \ enddef; boolean feynmfwizard; feynmfwizard := false; thin# := 1pt#; % dimension of the lines thick# := 2thin#; arrow_len# := 4mm#; arrow_ang := 15; curly_len# := 3mm#; dash_len# := 3mm#; % 'photon' lines dot_len# := 2mm#; % 'photon' lines wiggly_len# := 4mm#; % 'photon' lines wiggly_slope := 60; zigzag_len# := 2mm#; zigzag_width# := 2thick#; decor_size# := 5mm#; dot_size# := 2thick#; define_blacker_pixels (thick, thin, dash_len, dot_len, wiggly_len, curly_len, zigzag_len, zigzag_width, arrow_len, decor_size, dot_size); def shrink expr s = begingroup if shrinkables <> "": save tmp_; forsuffixes $ = scantokens shrinkables: if known $.#: tmp_ := $.#; save $; $.# := s * tmp_; define_blacker_pixels ($); else: tmp_ := $; save $; $ := s * tmp_; fi endfor fi enddef; def endshrink = endgroup enddef; string shrinkables; shrinkables := ""; vardef addto_shrinkables (text l) = forsuffixes $ = l: shrinkables := shrinkables & "," & str $; endfor enddef; shrinkables := "thick,thin"; addto_shrinkables (dash_len, dot_len); addto_shrinkables (wi
Re: [NTG-context] Page break with placement of a figure at the bottom of the page
Hi Pablo and Bruce, Please try to figure out what is not working. I'm sorry but I forgot in my previous post files. Fabrice Le sam. 12 nov. 2022 à 12:28, Pablo Rodriguez via ntg-context < ntg-context@ntg.nl> a écrit : > On 11/11/22 21:58, Bruce Horrocks via ntg-context wrote: > >> On 10 Nov 2022, at 17:06, Fabrice Couvreur via ntg-context wrote: > >> > >> Hi, > >> Sorry to come back to you, but it seems to me that there is enough > space here. > >> Fabrice > > > > For some reason your PNG images came through in extremely low > > resolution. Without having the ConTeXt source it's hard to say for sure > > what's happening - for example, I would have expected the text on the > > second page to be at the bottom of the first even if there wasn't room > > for the image - because that was what was happening in your first > example. > > Hi Fabrice and Bruce, > > I agree that the source would be helpful to say what may be hard for > ConTeXt. > > In any case, ConTeXt has a hard time with pagebreaks when you combine > elements that need both horizontal and vertical calculation, such as in: > > \starttext > \dorecurse{64} > {\input knuth\footnote{\input zapf} > > \startitemize[a, columns, eight, packed] > \dorecurse{64}{\item\currentitemnumber} > \stopitemize} > \stoptext > > There is a similar issue with paragraph notes. > > Pablo > > ___ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > > ___ > \startenvironment[premiere-modules] \usesymbols[mvs] \usecolors[xwi] \usemodule[tikz] \usemodule[pgfplots] \usepgfplotslibrary[fillbetween] \pgfplotsset{compat=newest} \usetikzlibrary[arrows] \usetikzlibrary[automata] \usetikzlibrary[calc] \usetikzlibrary[backgrounds] \usetikzlibrary[intersections] \usetikzlibrary[patterns] \usetikzlibrary[bending] \usetikzlibrary[arrows.meta] \usetikzlibrary[shapes.geometric] \usetikzlibrary[plotmarks] \usetikzlibrary[shapes] \usetikzlibrary[trees] \usetikzlibrary[animations] \usetikzlibrary[quotes] \usetikzlibrary[mindmap] \usetikzlibrary[matrix,decorations.pathreplacing,fit,positioning] \stopenvironment\startenvironment[premiere-macros] \unexpanded\def\R{\math{\mathbb{R}}\autoinsertnextspace} \protected\def\N{\doifnextcharelse{*}\MyNstarred\MyNnormal} \def\MyNstarred*{\m{\mathbb{N}^*}\autoinsertnextspace} \def\MyNnormal {\m{\mathbb{N} }\autoinsertnextspace} \define[1]\cscript {\start\switchtobodyfont[stixtwo]\m{{\mathscript{#1}}}\stop} %\protected\def\card#1{\m{\mfunction{Card}\thinspace(#1)}} \define[1]\card {\m{\mathtexttf{Card}\thinspace(#1)}\autoinsertnextspace} \define[1]\norm {\math{\left\Vert#1\right\Vert}} \define\esp{\math{\mathcal{E}}\autoinsertnextspace} \define\espv{\math{\vec{\mathcal{E}}}\autoinsertnextspace} \define\repere {\m{\left(O\,;\vec{i}, \vec{j}\right)}\autoinsertnextspace} \define\base {\m{\left(\vec{i}, \vec{j}, \vec{k}\right)}\autoinsertnextspace} \protected\def\vector#1{% \starttikzpicture[baseline=(arg.base),>=stealth,thick] \node[inner xsep=0pt] (arg) {\m{#1}}; \draw[->,shorten >=-2pt] (arg.north west) -- (arg.north east); \stoptikzpicture% } \definemathmatrix [pmatrix][matrix:parentheses][simplecommand=MATRIX] \unexpanded\def\intervalff#1#2{\math{\left[#1\nonscript\,;#2\right]}} \unexpanded\def\intervaloo#1#2{\math{\left]#1\nonscript\,;#2\right[}} \unexpanded\def\intervalfo#1#2{\math{\left[#1\nonscript\,;#2\right[}} \unexpanded\def\intervalof#1#2{\math{\left]#1\nonscript\,;#2\right]}} \define[1]\vabs{\math{\left\vert#1\right\vert}} \define\u{\math{\left(u_n\right)}\autoinsertnextspace} \define\v{\math{\left(v_n\right)}\autoinsertnextspace} \define\w{\math{\left(w_n\right)}\autoinsertnextspace} \unexpanded\def\euros#1{#1\,\symbol[europe][EUR]} \protected\def\point#1#2#3{\math{#1\left(#2\,;#3\right)}} \protected\def\coord#1#2{\math{\left(#1\,;#2\right)}} \define[2]\prod{\m{\vector{#1}\cdot\vector{#2}}} \protected\def\e#1{\math{{\rm e}^{#1}}\autoinsertnextspace} \stopenvironment\startenvironment[tikz-style] \pgfplotsset{ /pgfplots/layers/Bowpark/.define layer set={ axis background,axis grid,main,axis ticks,axis lines,axis tick labels, axis descriptions,axis fore
Re: [NTG-context] Size of all subscripts
On 8/22/2022 4:59 PM, Fabrice Couvreur via ntg-context wrote: Hello How to reduce the size of all subscripts in math mode ? Thanks Fabrice \usemodule[tikz] \protected\def\vector#1{% \starttikzpicture[baseline=(arg.base),>=stealth] \node[inner xsep=0pt] (arg) {\m{#1}}; \draw[thick,->,shorten >=-1pt] (arg.north west) -- (arg.north east); \stoptikzpicture% } \starttext \m{z_{\vector{U}}} \stoptext \protected\def\vector#1{% \starttikzpicture[baseline=(arg.base),>=stealth] \node[inner xsep=0pt] (arg) {\m{#1}}; \draw[thick,->,shorten >=-1pt] (arg.north west) -- (arg.north east); \stoptikzpicture } \starttext \m{x + z_{\vector{U}} + x} \m{x + \mathord{\vector{U}}^^z + x} \m{x + \overrightarrow{U}^^z + x} \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Size of all subscripts
Hello How to reduce the size of all subscripts in math mode ? Thanks Fabrice \usemodule[tikz] \protected\def\vector#1{% \starttikzpicture[baseline=(arg.base),>=stealth] \node[inner xsep=0pt] (arg) {\m{#1}}; \draw[thick,->,shorten >=-1pt] (arg.north west) -- (arg.north east); \stoptikzpicture% } \starttext \m{z_{\vector{U}}} \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] font fallbacks
Hi, I have used more than one fallback, but each fallback is for a different character range Denis Von: ntg-context im Auftrag von Henning Hraban Ramm via ntg-context Gesendet: Montag, 1. August 2022 19:42:51 An: Henning Hraban Ramm via ntg-context Cc: Henning Hraban Ramm Betreff: Re: [NTG-context] font fallbacks Nobody? I couldn’t find an example of more than one fallback, so I guess that’s not supported? Hraban Am 30.07.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context: > Hi, > I thought I could use more than one fallback font, but as soon as I list > fallbacks, they stop working. > > In my example, I’d like to take all missing glyphs from Segoe UI > Symbols, and what’s still missing (emojis) from EmojiOneColor, > preferably without specifying the exact range. > > Additionally, I want to replace the tilde ~ of LM Modern: > > """ > \definefontfallback[seguiFB] >[file:seguisym.ttf] >[0x0-0xF] >[check=yes,force=no] > > \definefontfallback[emoneFB] >[name:EmojiOneColor] >[0x0-0xF] >[check=yes,force=no] > > % replace tilde in LM > \definefontfallback[tildeFB] >[file:seguisym.ttf] >[0x0007E-0x0007E] >[force=yes] > > > \starttypescript [start] >\definetypeface [start] [rm] [serif] [cambria] > [default][fallbacks={seguiFB,emoneFB}] >\definetypeface [start] [ss] [sans] [modern] > [default][fallbacks={seguiFB,emoneFB}] >\definetypeface [start] [tt] [mono] [modern] > [default][fallbacks={seguiFB,tildeFB,emoneFB}] >\definetypeface [start] [mm] [math] [modern] > [default][fallbacks={seguiFB,emoneFB}] > \stoptypescript > > > \setupbodyfont[start,rm,12pt] > > \starttext > > \Omega\ (Omega) and \aleph\ (Aleph) > > \startbuffer[example] > start missing characters: lmmono10-regular.otf > 7 U+00327 ̧ COMBINING CEDILLA > 7 U+00335 ̵ COMBINING SHORT STROKE OVERLAY >14 U+003B7 η GREEK SMALL LETTER ETA > 7 U+021A9 ↩ LEFTWARDS ARROW WITH HOOK > 350 U+02500 ─ BOX DRAWINGS LIGHT HORIZONTAL >98 U+02502 │ BOX DRAWINGS LIGHT VERTICAL >42 U+02514 └ BOX DRAWINGS LIGHT UP AND RIGHT > 133 U+0251C ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT > 154 U+02772 ❲ LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT > 154 U+02773 ❳ LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT >14 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE > stop missing characters > start missing characters: cambria.ttc > 9 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE > 9 U+0FFFD � REPLACEMENT CHARACTER > stop missing characters > start missing characters: cambriai.ttf > 266 U+0276C ❬ MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT > 266 U+0276D ❭ MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT > stop missing characters > \stopbuffer > > \typebuffer[example] > > \startlines > \getbuffer[example] > > {\ss\getbuffer[example]} > \stoplines > > \tex{abra}\arg{...} > \type{kadabra} \type{~~~} > > \stoptext > """ > > What’s wrong? > > Hraban > ___ > If your question is of interest to others as well, please add an entry > to the Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] font fallbacks
Nobody? I couldn’t find an example of more than one fallback, so I guess that’s not supported? Hraban Am 30.07.22 um 15:51 schrieb Henning Hraban Ramm via ntg-context: Hi, I thought I could use more than one fallback font, but as soon as I list fallbacks, they stop working. In my example, I’d like to take all missing glyphs from Segoe UI Symbols, and what’s still missing (emojis) from EmojiOneColor, preferably without specifying the exact range. Additionally, I want to replace the tilde ~ of LM Modern: """ \definefontfallback[seguiFB] [file:seguisym.ttf] [0x0-0xF] [check=yes,force=no] \definefontfallback[emoneFB] [name:EmojiOneColor] [0x0-0xF] [check=yes,force=no] % replace tilde in LM \definefontfallback[tildeFB] [file:seguisym.ttf] [0x0007E-0x0007E] [force=yes] \starttypescript [start] \definetypeface [start] [rm] [serif] [cambria] [default][fallbacks={seguiFB,emoneFB}] \definetypeface [start] [ss] [sans] [modern] [default][fallbacks={seguiFB,emoneFB}] \definetypeface [start] [tt] [mono] [modern] [default][fallbacks={seguiFB,tildeFB,emoneFB}] \definetypeface [start] [mm] [math] [modern] [default][fallbacks={seguiFB,emoneFB}] \stoptypescript \setupbodyfont[start,rm,12pt] \starttext \Omega\ (Omega) and \aleph\ (Aleph) \startbuffer[example] start missing characters: lmmono10-regular.otf 7 U+00327 ̧ COMBINING CEDILLA 7 U+00335 ̵ COMBINING SHORT STROKE OVERLAY 14 U+003B7 η GREEK SMALL LETTER ETA 7 U+021A9 ↩ LEFTWARDS ARROW WITH HOOK 350 U+02500 ─ BOX DRAWINGS LIGHT HORIZONTAL 98 U+02502 │ BOX DRAWINGS LIGHT VERTICAL 42 U+02514 └ BOX DRAWINGS LIGHT UP AND RIGHT 133 U+0251C ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT 154 U+02772 ❲ LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT 154 U+02773 ❳ LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT 14 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE stop missing characters start missing characters: cambria.ttc 9 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE 9 U+0FFFD � REPLACEMENT CHARACTER stop missing characters start missing characters: cambriai.ttf 266 U+0276C ❬ MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT 266 U+0276D ❭ MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT stop missing characters \stopbuffer \typebuffer[example] \startlines \getbuffer[example] {\ss\getbuffer[example]} \stoplines \tex{abra}\arg{...} \type{kadabra} \type{~~~} \stoptext """ What’s wrong? Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] font fallbacks
Hi, I thought I could use more than one fallback font, but as soon as I list fallbacks, they stop working. In my example, I’d like to take all missing glyphs from Segoe UI Symbols, and what’s still missing (emojis) from EmojiOneColor, preferably without specifying the exact range. Additionally, I want to replace the tilde ~ of LM Modern: """ \definefontfallback[seguiFB] [file:seguisym.ttf] [0x0-0xF] [check=yes,force=no] \definefontfallback[emoneFB] [name:EmojiOneColor] [0x0-0xF] [check=yes,force=no] % replace tilde in LM \definefontfallback[tildeFB] [file:seguisym.ttf] [0x0007E-0x0007E] [force=yes] \starttypescript [start] \definetypeface [start] [rm] [serif] [cambria] [default][fallbacks={seguiFB,emoneFB}] \definetypeface [start] [ss] [sans] [modern] [default][fallbacks={seguiFB,emoneFB}] \definetypeface [start] [tt] [mono] [modern] [default][fallbacks={seguiFB,tildeFB,emoneFB}] \definetypeface [start] [mm] [math] [modern] [default][fallbacks={seguiFB,emoneFB}] \stoptypescript \setupbodyfont[start,rm,12pt] \starttext \Omega\ (Omega) and \aleph\ (Aleph) \startbuffer[example] start missing characters: lmmono10-regular.otf 7 U+00327 ̧ COMBINING CEDILLA 7 U+00335 ̵ COMBINING SHORT STROKE OVERLAY 14 U+003B7 η GREEK SMALL LETTER ETA 7 U+021A9 ↩ LEFTWARDS ARROW WITH HOOK 350 U+02500 ─ BOX DRAWINGS LIGHT HORIZONTAL 98 U+02502 │ BOX DRAWINGS LIGHT VERTICAL 42 U+02514 └ BOX DRAWINGS LIGHT UP AND RIGHT 133 U+0251C ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT 154 U+02772 ❲ LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT 154 U+02773 ❳ LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT 14 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE stop missing characters start missing characters: cambria.ttc 9 U+0278A ➊ DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE 9 U+0FFFD � REPLACEMENT CHARACTER stop missing characters start missing characters: cambriai.ttf 266 U+0276C ❬ MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT 266 U+0276D ❭ MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT stop missing characters \stopbuffer \typebuffer[example] \startlines \getbuffer[example] {\ss\getbuffer[example]} \stoplines \tex{abra}\arg{...} \type{kadabra} \type{~~~} \stoptext """ What’s wrong? Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] Credit in DTK
Hi Hraban, Wir könnten versuchen, weiter in Richtung Kirgisisch oder Georgisch zu gehen (eine Sprache, die für mich so obskur ist wie Aramäisch), nur um zu zeigen, dass Fragen der Silbentrennung nicht nur von Indianisten oder hellenistischen Experten ernst genommen werden, sondern von denen, die ConTeXt verwenden wollen . Dieser junge Ingenieur, der an seiner Statistik-Diplomarbeit arbeiten muss, ist ein Sinnbild: ConTeXt ist für die unterschiedlichsten Menschen attraktiv. Das Werk von Garulfo (ein Beispiel unter vielen) hat dies einst hervorragend demonstriert. Meine Idee war, keine mehrsprachige Antwort zu machen, sondern eine MWE mit ConTeXt in mehreren verschiedenen Sprachen (immer noch unter der Überschrift Paralleltext mit mehreren Klassenstufen), aber ConTeXt beschwert sich ... We could try to go further towards Kyrgyz or Georgian (a language which is as obscure to me as Aramaic), just to show that questions of hyphenation are taken seriously not only by Indianists, or Hellenist experts , but by those who want to use ConTeXt. This young engineer who has to work on his statistics thesis is a symbol: ConTeXt is attractive to a wide variety of people. The work of Garulfo (one example among many others) once demonstrated this excellently. My idea was not to do a polyglot answer, but a MWE with ConTeXt in several distinct languages (still under the heading parallel text with several grade levels), but ConTeXt complains... P.S. : Ik ben vergeten Nederlands toe te voegen. Ik hoop dat Hans en Taco het me niet kwalijk nemen. Le 23/01/2022 à 14:26, Henning Hraban Ramm via ntg-context a écrit : Salut Jean-Pierre, ich werde nicht versuchen, dir ebenso polyglott zu antworten. (Mein Latein ist arg eingestaubt, wegen Altgriechisch wäre ich damals beinahe sitzen geblieben, mein Russisch, Italienisch und Französisch reicht zum Einkaufen, von Schwedisch ist nicht mehr viel übrig, an Kirgisisch bin ich gescheitert, und Althochdeutsch ist schwer zu lernen...) ;D Ich nehme Luigi gerne mit auf, hatte ihn wohl übersehen. Herzliche Grüße, Hraban Am 23.01.22 um 14:08 schrieb Jean-Pierre Delange via ntg-context: Hi Hraban, Ich finde es ziemlich umfangreich. Wenn ich mich nicht irre, sollten wir auch Luigi Scarso erwähnen, der seine Meinung zu TEI/XML geäußert und auf einen früheren Beitrag von ihm zu TEI-XML und ConTeXt hingewiesen hat. I think it's pretty comprehensive. If I'm not mistaken, we should also mention Luigi Scarso, who gave his opinion on TEI/XML, and indicated an earlier contribution from him concerning TEI-XML and ConTeXt. Penso che sia abbastanza completo. Se non sbaglio, dobbiamo citare anche Luigi Scarso, che ha espresso la sua opinione su TEI/XML, e ha indicato un suo precedente contributo in merito a TEI-XML e ConTeXt. Creo que es bastante completo. Si no me equivoco, también debemos mencionar a Luigi Scarso, quien dio su opinión sobre TEI/XML e indicó una contribución anterior suya sobre TEI-XML y ConTeXt. Je crois que c'est assez complet. Si je ne me trompe, il faudrait mentionner aussi Luigi Scarso, qui a donné son avis à propos de TEI/XML, et a indiqué un apport antérieur de sa part concernant TEI-XML et ConTeXt. Satis comprehensivum illud puto. Si ni fallor, mentionem quoque debemus Luigi Scarso, qui sententiam suam de TEI/XML dedit, et priorem collationem ab eo de TEI-XML et ConTeXt indicabat. Νομίζω ότι είναι αρκετά περιεκτικό. Αν δεν κάνω λάθος, θα πρέπει να αναφέρουμε και τον Luigi Scarso, ο οποίος εξέφρασε τη γνώμη του για τα TEI/XML, και υπέδειξε παλαιότερη συνεισφορά του σχετικά με τα TEI-XML και ConTeXt. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ -- Jean-Pierre Delange Ancients Professeur de Philosophie (HC) begin:vcard fn:Jean-Pierre Delange n:Delange;Jean-Pierre org;quoted-printable:Acad=C3=A9mie de Versailles email;internet:adeiman...@free.fr title;quoted-printable:Agr=C3=A9g=C3=A9 de philosophie tel;cell:0673947496 x-mozilla-html:FALSE version:2.1 end:vcard ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Credit in DTK
Salut Jean-Pierre, ich werde nicht versuchen, dir ebenso polyglott zu antworten. (Mein Latein ist arg eingestaubt, wegen Altgriechisch wäre ich damals beinahe sitzen geblieben, mein Russisch, Italienisch und Französisch reicht zum Einkaufen, von Schwedisch ist nicht mehr viel übrig, an Kirgisisch bin ich gescheitert, und Althochdeutsch ist schwer zu lernen...) ;D Ich nehme Luigi gerne mit auf, hatte ihn wohl übersehen. Herzliche Grüße, Hraban Am 23.01.22 um 14:08 schrieb Jean-Pierre Delange via ntg-context: Hi Hraban, Ich finde es ziemlich umfangreich. Wenn ich mich nicht irre, sollten wir auch Luigi Scarso erwähnen, der seine Meinung zu TEI/XML geäußert und auf einen früheren Beitrag von ihm zu TEI-XML und ConTeXt hingewiesen hat. I think it's pretty comprehensive. If I'm not mistaken, we should also mention Luigi Scarso, who gave his opinion on TEI/XML, and indicated an earlier contribution from him concerning TEI-XML and ConTeXt. Penso che sia abbastanza completo. Se non sbaglio, dobbiamo citare anche Luigi Scarso, che ha espresso la sua opinione su TEI/XML, e ha indicato un suo precedente contributo in merito a TEI-XML e ConTeXt. Creo que es bastante completo. Si no me equivoco, también debemos mencionar a Luigi Scarso, quien dio su opinión sobre TEI/XML e indicó una contribución anterior suya sobre TEI-XML y ConTeXt. Je crois que c'est assez complet. Si je ne me trompe, il faudrait mentionner aussi Luigi Scarso, qui a donné son avis à propos de TEI/XML, et a indiqué un apport antérieur de sa part concernant TEI-XML et ConTeXt. Satis comprehensivum illud puto. Si ni fallor, mentionem quoque debemus Luigi Scarso, qui sententiam suam de TEI/XML dedit, et priorem collationem ab eo de TEI-XML et ConTeXt indicabat. Νομίζω ότι είναι αρκετά περιεκτικό. Αν δεν κάνω λάθος, θα πρέπει να αναφέρουμε και τον Luigi Scarso, ο οποίος εξέφρασε τη γνώμη του για τα TEI/XML, και υπέδειξε παλαιότερη συνεισφορά του σχετικά με τα TEI-XML και ConTeXt. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Error: attempt to index a nil value
> On 13 Oct 2021, at 22:34, Hans Hagen wrote: > > On 10/13/2021 6:54 PM, Hans Åberg wrote: >>> On 13 Oct 2021, at 18:37, Hans Hagen wrote: >>> >>> On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote: >>>> I was suggested a long ago to hack the file >>>> >>>> /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex >>>> and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I >>>> get this error: >>>> (./luaotfload.sty >>>> (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex)) >>>> (./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value >>>> (global >>>> 'arguments') >>>> stack traceback: >>>>[\directlua]:1: in main chunk. >>>> l.132 } >>>> ? … >>>> It is from this segment in the modified luatex-math.tex: >>>> \ifdefined\directlua >>>>\directlua { >>>>if arguments["mtx:lucidabright"] then >>>>tex.print("\string\\lucidabright") >>>>else >>>>tex.print("\string\\latinmodern") >>>>end >>>>} >>>> \fi >>>> Is there a workaround? —I may ditch this setup in favour of using >>>> 'context' directly, so it is not so important if there is no fix. >>> I have no clue .. >> Has not stuff been moved from LuaTeX to ConTeXt? —If so, I thought it might >> have something with that to do. > > luatex is just a tex engine and context is a macro package where context mkiv > is geared for luatex; the context fontloader has a generic core so it can be > used in plain and for latex some write a wrapper around that font hndler for > latex that evolved over years > > i have no clue why you get "(./luaotfload.sty ..." but it is not context that > you run there (and i can't imagine some plain format loading it either) I think that LaTeX extracted some parts out of ConTeXt for use with LuaTeX only for font loading, and that is why I have it, not remembering the details. I think I saw that LuaTeX a few years had more font loading stuff, but that was moved to ConTeXt, but you show know better, as it would then would have been you did it. :-) >>> it looks like you load a latex style so I suppose that 'arguments' is no >>> longer defined there (as it worked for you in the past). >> It does not contain it; it a copy in the same directory that has never >> changed. > > hm, but i have no clue what this "mtx:..." does It is line 97-105 in /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex I have not done anything to that part, just adding some support for the STIX font. >>> Maybe 'arguments' lives in some namespace? >>> >>> \directlua {for k, v in pairs(_G) do print(k,v) end} >>> >>> This will show you what is in the global namespace, maybe 'arg'? >> If I put this code in right before the \ifdefined\directlua it prints a lot >> of "nil". > > print(k,v) should print two values, key and value I may have not used it right, just copying it in right above line 97. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Error: attempt to index a nil value
On 10/13/2021 6:54 PM, Hans Åberg wrote: On 13 Oct 2021, at 18:37, Hans Hagen wrote: On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote: I was suggested a long ago to hack the file /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I get this error: (./luaotfload.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex)) (./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value (global 'arguments') stack traceback: [\directlua]:1: in main chunk. l.132 } ? … It is from this segment in the modified luatex-math.tex: \ifdefined\directlua \directlua { if arguments["mtx:lucidabright"] then tex.print("\string\\lucidabright") else tex.print("\string\\latinmodern") end } \fi Is there a workaround? —I may ditch this setup in favour of using 'context' directly, so it is not so important if there is no fix. I have no clue .. Has not stuff been moved from LuaTeX to ConTeXt? —If so, I thought it might have something with that to do. luatex is just a tex engine and context is a macro package where context mkiv is geared for luatex; the context fontloader has a generic core so it can be used in plain and for latex some write a wrapper around that font hndler for latex that evolved over years i have no clue why you get "(./luaotfload.sty ..." but it is not context that you run there (and i can't imagine some plain format loading it either) it looks like you load a latex style so I suppose that 'arguments' is no longer defined there (as it worked for you in the past). It does not contain it; it a copy in the same directory that has never changed. hm, but i have no clue what this "mtx:..." does Maybe 'arguments' lives in some namespace? \directlua {for k, v in pairs(_G) do print(k,v) end} This will show you what is in the global namespace, maybe 'arg'? If I put this code in right before the \ifdefined\directlua it prints a lot of "nil". print(k,v) should print two values, key and value Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Error: attempt to index a nil value
> On 13 Oct 2021, at 18:37, Hans Hagen wrote: > > On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote: >> I was suggested a long ago to hack the file >> >> /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex >> and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I get >> this error: >> (./luaotfload.sty >> (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex)) >> (./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value >> (global >> 'arguments') >> stack traceback: >> [\directlua]:1: in main chunk. >> l.132 } >> ? … >> It is from this segment in the modified luatex-math.tex: >> \ifdefined\directlua >>\directlua { >>if arguments["mtx:lucidabright"] then >>tex.print("\string\\lucidabright") >>else >>tex.print("\string\\latinmodern") >>end >>} >> \fi >> Is there a workaround? —I may ditch this setup in favour of using 'context' >> directly, so it is not so important if there is no fix. > I have no clue .. Has not stuff been moved from LuaTeX to ConTeXt? —If so, I thought it might have something with that to do. > it looks like you load a latex style so I suppose that 'arguments' is no > longer defined there (as it worked for you in the past). It does not contain it; it a copy in the same directory that has never changed. > Maybe 'arguments' lives in some namespace? > > \directlua {for k, v in pairs(_G) do print(k.v) end} > > This will show you what is in the global namespace, maybe 'arg'? If I put this code in right before the \ifdefined\directlua it prints a lot of "nil". ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Error: attempt to index a nil value
On 10/13/2021 6:01 PM, Hans Åberg via ntg-context wrote: I was suggested a long ago to hack the file /usr/local/texlive/2021/texmf-dist/tex/generic/context/luatex/luatex-math.tex and use LuaTeX directly, now using Version 1.13.2 (TeX Live 2021), but I get this error: (./luaotfload.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/base/ltluatex.tex)) (./luatex-math-modified.tex[\directlua]:1: attempt to index a nil value (global 'arguments') stack traceback: [\directlua]:1: in main chunk. l.132 } ? … It is from this segment in the modified luatex-math.tex: \ifdefined\directlua \directlua { if arguments["mtx:lucidabright"] then tex.print("\string\\lucidabright") else tex.print("\string\\latinmodern") end } \fi Is there a workaround? —I may ditch this setup in favour of using 'context' directly, so it is not so important if there is no fix. I have no clue .. it looks like you load a latex style so I suppose that 'arguments' is no longer defined there (as it worked for you in the past). Maybe 'arguments' lives in some namespace? \directlua {for k, v in pairs(_G) do print(k.v) end} This will show you what is in the global namespace, maybe 'arg'? Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] setup parameter problem
On 6/7/2021 6:17 PM, Hans van der Meer wrote: The code below seems ok in \startsection[title=] but not when I program the parameter collection with \def\setupparameters{\getparameters[prefix]} In that case even [title={enclosed value}] crashes with error message: Use of \doMacro doesn't match its definition. Obviously I am missing something here. What? \def\Macro{\dosingleargument\doMacro} \def\doMacro[#1]#2{#1X#2} The code below shows that it should be possible. \startsection[title=\Macro{arg} no braces needed]\stopsection \startsection[title={\Macro[arg1]{arg2} enclosed in braces}]\stopsection \stoptext just prevent expansion: \protected\def\Macro{\dosingleargument\doMacro} \def\doMacro[#1]#2{#1X#2} and when you're in adventurous mode (which i know you are) try this: \protected\tolerant\def\Macro[#1]#;#2% {\ifparameter#1\or#1:\fi#2} and when you for some reason do wan tto expand then, as in, do: \edef\foo{\expand\Macro[arg1]{arg2}} etc etc Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] setup parameter problem
The code below seems ok in \startsection[title=] but not when I program the parameter collection with \def\setupparameters{\getparameters[prefix]} In that case even [title={enclosed value}] crashes with error message: Use of \doMacro doesn't match its definition. Obviously I am missing something here. What? \def\Macro{\dosingleargument\doMacro} \def\doMacro[#1]#2{#1X#2} The code below shows that it should be possible. \startsection[title=\Macro{arg} no braces needed]\stopsection \startsection[title={\Macro[arg1]{arg2} enclosed in braces}]\stopsection \stoptext dr. Hans van der Meer ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] ctxlua percentage format escape
On 5/29/2021 3:02 PM, Jairo A. del Rio wrote: Hi, Adam. There are some ways to do it. I'm sure there are many more, but I don't remember them right now. Hi, Hans. There's a bug (?) in syst-lua.lua related to \expression in MkIV (xmath and xcomplex aren't defined). Please fix that something local result = CONTEXTLMTXMODE > 0 and { "local xmath = xmath local xcomplex = xcomplex return " } or { "local xmath = math local xcomplex = { } return " } you can test it %Temporary hack for MkIV %Only use it in case \expression ... \relax doesn't work kind of old (hacky experiment) that one ... i probably need to adapt it to lmtx anyway \luaexpr and \mathexpr are probably better for this kind of stuff (no need for the % then when the optional format arg is used) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] outputting components in their own PDFs
What exactly do you need? You can just process each component on its own. With a makefile or shell script, batch file, that should be easy enough. Or, do you need to have correct cross references, page numbers, etc.? I was asking a similar question two days ago, and Hans showed me how to add information to the log file: \writestatus{!}{SPLIT HERE: \the\realpageno} You should be then able to extract the split points from the log file and extract the components from the complete PDF. Or, if you know that you will need to split your document at certain structure elements (chapters, sections or so), it's even simpler. The lua script below will split your PDF at each chapter. It uses pdftk for splitting, but it should be easy to adapt this to context's own mechanism mentioned by Hans in the other thread. Denis -- mit welchen Dateien arbeiten wir? local base = assert(arg[1], "Keine Datei angegeben") local pdf = base .. ".pdf" local tuc = base .. ".tuc" -- import .tuc-file /extension lua local utilitydata = dofile(tuc) local breakpoints = {} local last_page = utilitydata.structures.counters.collected["realpage"][1][1] print ("Letzte Seite: " .. last_page) -- iterate over .tuc => get breakpoints for index, content in pairs(utilitydata.structures.lists.collected) do if (content["titledata"]["label"] == "chapter") then table.insert(breakpoints,content["references"]["realpage"]) end end -- welches sind die Breakpoints? print("Wir haben folgende Breakpoints:") for index, content in pairs(breakpoints) do print (content) end -- wie viele Breakpoint haben wir? function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end local breakpoints_length = tablelength(breakpoints) print ("Wir haben " .. breakpoints_length .. " Breakpoints.") -- Extraktionsbereiche festlegen local extractions = {} for index, breakpoint in pairs(breakpoints) do region = {} local startregion = breakpoint local nextstartregion = breakpoints[index + 1] local stopregion; if (nextstartregion == nil) then stopregion = last_page else stopregion = nextstartregion - 1 end region["start"] = startregion region["stop"] = stopregion table.insert(extractions,region) end print ("Wir extrahieren ...") for index, region in pairs(extractions) do print("von " .. region["start"] .. " bis " .. region["stop"]) local outputfile = "article" .. index .. ".pdf" local extract_command = "pdftk " .. pdf .. " cat " .. region["start"] .. "-" .. region["stop"] .. " output " .. outputfile os.execute(extract_command) end Von: ntg-context Im Auftrag von Alan Bowen Gesendet: Montag, 1. März 2021 22:38 An: mailing list for ConTeXt users Betreff: [NTG-context] outputting components in their own PDFs I have a project-component setup and need to produce a single PDF file containing all the components as well as a PDF file for each component. The single file is easy. Is there a way to automate the generation of the PDF files for the individual components? Alan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Disappearing characters with nolig-german-wordlist
Arg, it's getting uglier... I've been playing around with the replacement patterns. ``` \replaceword[replace][auff][au{ff}] \replaceword[replace][Aufl][Au{fl}] \replaceword[replace][aufl][au{fl}] \setreplacements[replace] \starttext auffasste auffasse Auflage aufliegen auffliegen \stoptext ``` Now it's fine for the auffasste case, but both "aufliegen" and "auffliegen" result in "aufliegen", i.e. the second f is being swallowed. Best, Denis Am 09.10.2020 um 12:05 schrieb Denis Maier: Next try, the compact syntax gives the same weird result: ``` \replaceword[replace][au{ff}asse au{ff}asst] \setreplacements[replace] \starttext auffasste auffasse \stoptext ``` I would really like to have correct ligatures. What can I do to help finding the reason for this? (Or is it obvious, and I'm just not seeing it? Best, Denis Am 08.10.2020 um 15:15 schrieb Denis Maier: Ok, I've commented the whole nolig-german-wordlist out piece by piece, and it looks like it comes down to this: ``` \replaceword[eka][auffasse][au{ff}asse] \replaceword[eka][auffasst][au{ff}asst] \setreplacements[eka] \starttext auffasste auffasse \stoptext ``` Uncommenting one of the \replacewords makes the wrong replacement disappear. But I don't see why "auffasste" should trigger an replacement. What is happening here? Best, Denis ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can't use MetaFun with mplib anymore
On 3/14/2019 8:51 AM, luigi scarso wrote: On Thu, Mar 14, 2019 at 5:56 AM Henri Menke <mailto:henrime...@gmail.com>> wrote: Dear list, Something has changed in MetaFun and it can no longer be used in plain LuaTeX, with neither of luatex test.tex mtxrun --script plain test.tex This is the error: >> LUATEXFUNCTIONALITY >> "mp.print(LUATEXFUNCTIONALITY)" ! Equation cannot be performed (numeric=string). MWE is below, as always. Cheers, Henri --- \directlua{ local mpkpse = kpse.new(arg[0], "mpost") local function finder(name, mode, ftype) if mode == "w" then return name else return mpkpse:find_file(name,ftype) end end local mpx = mplib.new { find_file = finder } local ret = mpx:execute[[ boolean mplib ; mplib := true ; input metafun.mp <http://metafun.mp> ; ]] print(ret.log) } \bye in mp-mlib.mpiv it seems that we should have string LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; instead of numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; Now I have tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; mp-mlib.mpiv:string LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; and your example looks ok. as currently the variable is isn't used we can also comment it Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can't use MetaFun with mplib anymore
On 3/14/19 8:49 PM, Hans Hagen wrote: > On 3/14/2019 5:56 AM, Henri Menke wrote: >> >> Dear list, >> >> Something has changed in MetaFun and it can no longer be used in plain >> LuaTeX, >> with neither of >> >> luatex test.tex >> mtxrun --script plain test.tex >> >> This is the error: >> >> >> LUATEXFUNCTIONALITY >> >> "mp.print(LUATEXFUNCTIONALITY)" >> ! Equation cannot be performed (numeric=string). > > hm, that can be > > mp.print(LUATEXFUNCTIONALITY or 0) > > but ... i'm surprised you can use metafun in plain at all ... i never > test that and to be honest am not too motivated to support mpiv code in > generic either .. better use Until TeX Live 2018, MetaFun worked in plain (at least the subset I'm using). It would be a shame if the support would end. I also think that there are quite a number of users. The number of posts on TeX Stack Exchange mentioning luamplib with metafun is not negligible. https://tex.stackexchange.com/search?q=mplibsetformat I (and probably a lot of other people) would really appreciate if you could apply Luigi's fix, so we can continue do enjoy MetaFun, even outside ConTeXt. Cheers, Henri > > \startMPpage > \stopMPpage > > with context and then include the pdf > > Hans > >> MWE is below, as always. >> >> Cheers, Henri >> >> --- >> >> \directlua{ >> local mpkpse = kpse.new(arg[0], "mpost") >> >> local function finder(name, mode, ftype) >> if mode == "w" then >> return name >> else >> return mpkpse:find_file(name,ftype) >> end >> end >> >> local mpx = mplib.new { >> find_file = finder >> } >> local ret = mpx:execute[[ >> boolean mplib ; mplib := true ; >> input metafun.mp ; >> ]] >> >> print(ret.log) >> } >> \bye >> >> ___ >> >> If your question is of interest to others as well, please add an entry >> to the Wiki! >> >> maillist : ntg-context@ntg.nl / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> webpage : http://www.pragma-ade.nl / http://context.aanhet.net >> archive : https://bitbucket.org/phg/context-mirror/commits/ >> wiki : http://contextgarden.net >> ___ >> >> > > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can't use MetaFun with mplib anymore
On Thu, Mar 14, 2019 at 5:56 AM Henri Menke wrote: > > Dear list, > > Something has changed in MetaFun and it can no longer be used in plain > LuaTeX, > with neither of > > luatex test.tex > mtxrun --script plain test.tex > > This is the error: > > >> LUATEXFUNCTIONALITY > >> "mp.print(LUATEXFUNCTIONALITY)" > ! Equation cannot be performed (numeric=string). > > MWE is below, as always. > > Cheers, Henri > > --- > > \directlua{ > local mpkpse = kpse.new(arg[0], "mpost") > > local function finder(name, mode, ftype) > if mode == "w" then > return name > else > return mpkpse:find_file(name,ftype) > end > end > > local mpx = mplib.new { > find_file = finder > } > local ret = mpx:execute[[ > boolean mplib ; mplib := true ; > input metafun.mp ; > ]] > > print(ret.log) > } > \bye > > in mp-mlib.mpiv it seems that we should have string LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; instead of numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; Now I have tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; mp-mlib.mpiv:string LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := runscript("mp.print(LUATEXFUNCTIONALITY)") ; and your example looks ok. -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can't use MetaFun with mplib anymore
On 3/14/2019 5:56 AM, Henri Menke wrote: Dear list, Something has changed in MetaFun and it can no longer be used in plain LuaTeX, with neither of luatex test.tex mtxrun --script plain test.tex This is the error: >> LUATEXFUNCTIONALITY >> "mp.print(LUATEXFUNCTIONALITY)" ! Equation cannot be performed (numeric=string). hm, that can be mp.print(LUATEXFUNCTIONALITY or 0) but ... i'm surprised you can use metafun in plain at all ... i never test that and to be honest am not too motivated to support mpiv code in generic either .. better use \startMPpage \stopMPpage with context and then include the pdf Hans MWE is below, as always. Cheers, Henri --- \directlua{ local mpkpse = kpse.new(arg[0], "mpost") local function finder(name, mode, ftype) if mode == "w" then return name else return mpkpse:find_file(name,ftype) end end local mpx = mplib.new { find_file = finder } local ret = mpx:execute[[ boolean mplib ; mplib := true ; input metafun.mp ; ]] print(ret.log) } \bye ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Can't use MetaFun with mplib anymore
Dear list, Something has changed in MetaFun and it can no longer be used in plain LuaTeX, with neither of luatex test.tex mtxrun --script plain test.tex This is the error: >> LUATEXFUNCTIONALITY >> "mp.print(LUATEXFUNCTIONALITY)" ! Equation cannot be performed (numeric=string). MWE is below, as always. Cheers, Henri --- \directlua{ local mpkpse = kpse.new(arg[0], "mpost") local function finder(name, mode, ftype) if mode == "w" then return name else return mpkpse:find_file(name,ftype) end end local mpx = mplib.new { find_file = finder } local ret = mpx:execute[[ boolean mplib ; mplib := true ; input metafun.mp ; ]] print(ret.log) } \bye ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xml in lua advice ?
My 2 cents: local xmlflush = lxml.flush local function text_or_xml(...) for i,v in ipairs(arg) do if "table" == type(v) then xmlflush(v) else context(v) end end end function xml.functions.heading(t) text_or_xml( "\\section{" , t , "}" ) end Massimiliano Il giorno mer, 19/09/2018 alle 15.56 +0200, Hans Hagen ha scritto: > On 9/19/2018 2:50 PM, Taco Hoekwater wrote: > > Hi, > > > > Is there a more elegant way to feed an xml tree into a context() > > command > > that what I have below? > > > > > > \startluacode > > function xml.functions.heading(t) > > context.section("{") > > lxml.flush(t) > > context("}") > > end > > \stopluacode > > > > The subtree in ’t’ could have embedded xml tags that should be > > processed, > > so just stripping it clean will not do. > > > > (this is not about \section as such, I just needed an example. > > \startsection > > would be more modern, but it would not help fix the issue ) > > it actually depends on what you do ... anyway here is some insight > (as > xml-tex old-timer you'll probably recognize the madness) > > % \enabletrackers[context*] > > \starttext > > % here is your missing mwe > > \startbuffer[test] > > some bold title > > \stopbuffer > > % this will assume xml and relate some handlers > > \setuphead[section] >[coding=xml, > xmlsetup=xml:flush] > > \startxmlsetups xml:flush > \xmlflush{#1} > \stopxmlsetups > > % comment this one for your amusement > > \startxmlsetups xml:b > {\bf \xmlflush{#1}} > \stopxmlsetups > > % here is the magic: you pass a reference > > \startluacode > function xml.finalizers.heading(t) > context.formatted.section("main::%i",t[1].ix) > end > \stopluacode > > % this loads only (can happen at the lua end ... you can sort that > out) > > \xmlloadbuffer{main}{test}{} > > % this indexes the nodes (the ix keys, basically all these #1 > argumehnts > in setups use that trickery) > > \xmladdindex{main} > > % to be sure > > \xmlsetsetup{main}{b}{xml:b} > > % now we filter / apply your finalizer > > \xmlfilter{main}{section/heading()} > > % done > > \stoptext > > > > > - >Hans Hagen | PRAGMA ADE >Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > - > _ > __ > If your question is of interest to others as well, please add an > entry to the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > _ > __ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How can I remove a blank leading line from a buffer
On 8/13/2018 10:28, Rik Kabel wrote: On 8/13/2018 03:01, Hans Hagen wrote: On 8/13/2018 5:18 AM, Rik Kabel wrote: \startparagraph % \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] % \ (first: \First, arg: \Arg) \margintext{\Mark} \setupparagraphintro[first][(first: \First, arg: \Arg)] %\setupparagraphintro[next][(first: \First, arg: \Arg)] \getbuffer[TestBuffer] \stopparagraph Hans, That works for the over-simplified case here, but fails in practice. For a \startnarrower[left] paragraph, the mark is still in the main margin, not the 'margin' of the narrowed paragraph. Also, the placement of the text in the margin is wrong and not easily controlled as with \llap and \rlap. The code started out more like: \define\Mark{\color[middlegray]{\hskip.6cm\itb¿\ }} \setwidthof{\Mark}\to\MarkWidth ... \starttexdefinition stopBufTest \startluacode buffers.prepend("TestBuffer","\\dontleavehmode\\llap{\\Mark}") \stopluacode \setupnarrower[left=\MarkWidth] \startnarrower[left,right] \startparagraph \inlinebuffer[TestBuffer] \stopparagraph \stopnarrower \egroup \stoptexdefinition So I am still looking for a way to do this. Meanwhile I am trying to understand Aditya's examples. Turns out another answer was hidden in Hans's reply. The following seems to meet my needs, but it may complicate other use of \setupparagraphintro (which I don't recall seeing before), so it may not be a generic solution. An empty string works fine instead of the llaped marking shown here. This is a less dangerous hack than redefining \par, but still may fail in more complex documents when \setupparagraphintro is used elsewhere. \starttexdefinition stopBufTest \startnarrower[left,right] \startparagraph \setupparagraphintro[first][\llap{\Mark}] \inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \stopnarrower \egroup \stoptexdefinition Thank you, Hans. (For a non-hack generic solution that does not interfere with other use of \setupparagraphintro, surely there must be an easy way to apply string.strip to the buffer.) -- Rik ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How can I remove a blank leading line from a buffer
On 8/13/2018 03:01, Hans Hagen wrote: On 8/13/2018 5:18 AM, Rik Kabel wrote: %% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \startparagraph % \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] % \ (first: \First, arg: \Arg) \margintext{\Mark} \setupparagraphintro[first][(first: \First, arg: \Arg)] %\setupparagraphintro[next][(first: \First, arg: \Arg)] \getbuffer[TestBuffer] \stopparagraph Hans, That works for the over-simplified case here, but fails in practice. For a \startnarrower[left] paragraph, the mark is still in the main margin, not the 'margin' of the narrowed paragraph. Also, the placement of the text in the margin is wrong and not easily controlled as with \llap and \rlap. The code started out more like: \define\Mark{\color[middlegray]{\hskip.6cm\itb¿\ }} \setwidthof{\Mark}\to\MarkWidth ... \starttexdefinition stopBufTest \startluacode buffers.prepend("TestBuffer","\\dontleavehmode\\llap{\\Mark}") \stopluacode \setupnarrower[left=\MarkWidth] \startnarrower[left,right] \startparagraph \inlinebuffer[TestBuffer] \stopparagraph \stopnarrower \egroup \stoptexdefinition So I am still looking for a way to do this. Meanwhile I am trying to understand Aditya's examples. -- Rik ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How can I remove a blank leading line from a buffer
On 8/13/2018 5:18 AM, Rik Kabel wrote: %% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \startparagraph % \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] % \ (first: \First, arg: \Arg) \margintext{\Mark} \setupparagraphintro[first][(first: \First, arg: \Arg)] %\setupparagraphintro[next][(first: \First, arg: \Arg)] \getbuffer[TestBuffer] \stopparagraph - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How can I remove a blank leading line from a buffer
On 13/08/18 15:18, Rik Kabel wrote: %% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph % Ignore first \par \def\par{\let\par\normalpar} \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \stopmode %% -- %% Rik Kabel ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How can I remove a blank leading line from a buffer
On Sun, 12 Aug 2018, Rik Kabel wrote: %% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \stopmode Perhaps \ignorespaces might work, but I often find that the conceptually simplest solution is to post-process the buffer at the lua end. See http://wiki.contextgarden.net/Programming_in_LuaTeX#Manipulating_verbatim_text for an example. Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] How can I remove a blank leading line from a buffer
%% How can one remove blank lines at the start of a buffer so that %% commands that grab a buffer can be used in the same way as, for %% example, \startparagraph...\stopparagraph, which allow blank %% lines around the content? %% %% The problem appears when an optional argument is allowed but none %% is provided. Adding \relax does not help; adding empty brackets %% does. I see no way to distinguish between a buffer without %% leading blank lines and a buffer that was created when brackets %% are provided. %% %% \inlinebuffer handles the leading blank lines when there is %% nothing prepended, but I need to prepend. (It also handles the %% unwanted trailing line, but that is not an issue here). %% %% How can I unpack the buffer, apply the equivalent functions of %% ignorespaspaces and removeunwantedspaces to it, and repack it? %% The buffer may contain internal blank lines and macros, and %% those should be retained. Or, is there already a function to %% strip a buffer in the manner that string.strip does a string? \setupwhitespace[none] \setupindenting[none] \define\Mark{\color[middlegray]{\itb¿\ }} \define\First{nothing yet} \define\Arg{nothing yet} \setuplanguage[en][spacing=packed] \starttexdefinition unexpanded startBufTest \bgroup \dosingleempty\dostartBufTest \stoptexdefinition \starttexdefinition dostartBufTest [#SETUPS] \doifsomethingelse{#{SETUPS}} {\define\Arg{yes}} {\define\Arg{no}} \iffirstargument \define\First{yes} \else \define\First{no} \fi \relax \getrawparameters[BufTest][xx=yy,#SETUPS] \grabbufferdata[TestBuffer][startBufTest][stopBufTest] \stoptexdefinition \starttexdefinition stopBufTest \startparagraph \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg) \stopparagraph \egroup \stoptexdefinition \starttext \startparagraph A starting paragraph. \stopparagraph \startBufTest Buffer without blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest Buffer with blank lines. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest\relax Buffer with \tex{relax}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[] Buffer with \type{[]}. \stopBufTest \startparagraph An intervening paragraph. \stopparagraph \startBufTest[key=value] Buffer with \type{[key=value]}. \stopBufTest \startparagraph A closing paragraph. \stopparagraph \stoptext \stopmode %% -- %% Rik Kabel ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] typesetting information from git
On 2/23/2018 9:38 PM, Schmitz Thomas A. wrote: Hi, I like to add a sort of watermark with info about the git revision at the bottom of some files that I typeset. I’m using Lua, so I have: context(os.resultof("git --no-pager log --pretty='%h of %aD' -1 foo.xml”)) which gives something like "git revision b085c92a of Wed, 14 Feb 2018 12:49:35 +0100.” Suppose I want to make this more general. What would be the easiest way to either say “the xml file that is being processed” (something like arg[1]) or “the xml file whose name is in the Lua variable ‘foo?’” maybe you mean \startluacode context.setupdocument { gitversion = string.strip( os.resultof("git --no-pager log --pretty='%h of %aD' -1 " .. environment.jobfilefullname) or "") } \stopluacode \setupfootertexts [this is from file: \documentvariable{gitversion}] \starttext [[\ctxlua{context(environment.jobfilefullname)}]] [[\ctxlua{context(environment.jobfilename)}]] \ctxlua{inspect(table.sortedkeys(environment))} test \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] typesetting information from git
On 2/23/2018 9:38 PM, Schmitz Thomas A. wrote: Hi, I like to add a sort of watermark with info about the git revision at the bottom of some files that I typeset. I’m using Lua, so I have: context(os.resultof("git --no-pager log --pretty='%h of %aD' -1 foo.xml”)) which gives something like "git revision b085c92a of Wed, 14 Feb 2018 12:49:35 +0100.” Suppose I want to make this more general. What would be the easiest way to either say “the xml file that is being processed” (something like arg[1]) or “the xml file whose name is in the Lua variable ‘foo?’” I'm not sure if i understand well but something \startluacode context.setupdocument { gitversion = string.strip(os.resultof("git --no-pager log --pretty='%h of %aD' -1 foo.tex") or "") } \stopluacode \setupfootertexts [this is from file: \documentvariable{gitversion}] \starttext test \stoptext (as long as uou make sure you call the got command only once and not again in each footer) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] typesetting information from git
Hi, I like to add a sort of watermark with info about the git revision at the bottom of some files that I typeset. I’m using Lua, so I have: context(os.resultof("git --no-pager log --pretty='%h of %aD' -1 foo.xml”)) which gives something like "git revision b085c92a of Wed, 14 Feb 2018 12:49:35 +0100.” Suppose I want to make this more general. What would be the easiest way to either say “the xml file that is being processed” (something like arg[1]) or “the xml file whose name is in the Lua variable ‘foo?’” Thanks! Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] image file resolver in Lua?
Am 2018-02-06 um 17:09 schrieb Procházka Lukáš Ing. <l...@pontex.cz>: > I'm usually implementing complicated solutions via Lua, with functions with > obligatory arg(s) first followed by one optional argument of table type: Thank you for your effort! I actually already wrote parts of my invoicing solution in Lua. I was planning to even run a simple GUI (tekui) on top of LuaTeX, but my priorities keep shifting... At the moment I got shell scripts that call Python scripts that read JSON files (as a simple database) and write ConTeXt code that includes (object oriented) Lua libraries for most of the the calculations... It works well enough for my own company and our publishing house, but is quite convoluted. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] image file resolver in Lua?
Hello Henning, On Tue, 06 Feb 2018 13:13:12 +0100, Henning Hraban Ramm <te...@fiee.net> wrote: I’ll try as soon as I get some time, since algorithmic image placement is a recurring problem for me, as I try to replace InDesign in my workflow. I thought about providing a module, but each of my projects has so differing needs that either every macro would need a bunch of options, or I need a lot of similar macros. We’ll see... my experience in these situations: I'm usually implementing complicated solutions via Lua, with functions with obligatory arg(s) first followed by one optional argument of table type: - it's easy to investigate this optional argument and alter the algorithm depending on table keys (presence and/or value), - you don't have to be afraid of optional arg(s) rearrangement. To be more concrete: Sample Lua code MyPlaceFigure = function(figname, opts) -- Optional; .scale = .sc, .rotation = .rot, .label, ... opts = opts or {} -- To simplify code bellow local scale, rot, lab = opts.scale or opts.sc, -- I.e. more keys are allowed in long/short alternative opts.rotation or opts.rotate or opts.rot, -- dtto opts.label or opts.lab, nil if label then -- E.g. use context.placefloat(...) else context.externalfigure({figname}, {scale = 1000 * scale, orientation = rot, }) end end Best regards, Lukas Greetlings, Hraban -- Ing. Lukáš Procházka | mailto:l...@pontex.cz Pontex s. r. o. | mailto:pon...@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to use "fontsampler example" with Persian font
In ConTeXt, use \definedfont[font-name*arabic] instead of the following two commands: \font\myfont=blah blah \myfont On Fri, Oct 7, 2016 at 11:41 AM, Mingranina Gingranina <mingran...@gmail.com > wrote: > Dear Mohammad, > Hi, > > Thank you very much for your reply. I forgot to mention that I had > modified the fontsampler codes so that I can use it in ConTeXt with > Dabeer module. > > However, inspired by your reply I could get it to work in LuaTeX but > not in ConTeXt with Dabeer module. > > Are there any other set of features that I can test? > > Thanks, > Mingranina > > On 10/7/16, Mohammad Hossein Bateni <bat...@gmail.com> wrote: > > The following works for me: > > > > \input luaotfload.sty > > \font \myfont = > > file:HM_XNiloofar.ttf:language=dflt;script=arab; > ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes > > \myfont Salam > > > > \pardir TRT > > \textdir TRT > > سلام > > حسن > > \bye > > > > > > On Fri, Oct 7, 2016 at 7:19 AM, Mohammad Hossein Bateni < > bat...@gmail.com> > > wrote: > > > >> I don't know much about fontsampler but the commands you list here are > >> mostly irrelevant. My guess is you will need to set the features in the > >> font to get proper shaping. A good set of features that should do the > >> trick is called "arabic". > >> > >> When loading the font, you should do something like the following, but I > >> have not tried it myself. > >> > >> \font\myfont=file:font.otf:language=dflt;script=arab; > >> ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes > >> > >> —MHB > >> > >> > >> On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina < > >> mingran...@gmail.com> wrote: > >> > >>> Dear All, > >>> Hello, > >>> > >>> I am trying to use "fontsampler example" with Persian fonts (please > >>> see below or "http://wiki.luatex.org/index.php/Fontsampler; > >>> for fontsampler codes). > >>> The problem is that Persian words apears as a string of separate > >>> glyphs, for example I get "حسن" instead of "حسن". > >>> Do I have to use commands like the followings inside \directlua or > >>> tex.tprint to fix the problem? If yes, how can I do that? > >>> > >>> \installlanguage [fa][default=pe,date=\longjalalidatefmt] > >>> \mainlanguage[fa] > >>> > >>> \definefontfeature[tlig][tlig=yes] > >>> \definefontfeature[slanted][slant=.2] > >>> \definefontfeature[dlang][language=dflt] > >>> \definefontfeature[flang][language=far] > >>> > >>> Thanks > >>> Mingranina > >>> > >>> > >>> fontsampler.tex > >>> > >>> = > >>> \input luaotfload.sty > >>> \overfullrule 0pt > >>> \font\mono = {file:lmmono8-regular.otf} at 6pt > >>> \parindent 0pt > >>> > >>> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890 > >>> äÄöÖüÜ ß !"§\$\%\&()=?} > >>> > >>> \directlua{ > >>> dofile("fontsampler.lua") > >>> fontsampler(arg[2]) > >>> } > >>> > >>> \bye > >>> > >>> = > >>> End Of fontsampler.tex > >>> > >>> > >>> fontsampler.lua > >>> > >>> = > >>> function dirtree(dir) > >>> assert(dir and dir ~= "", "directory parameter is missing or empty") > >>> if string.sub(dir, -1) == "/" then > >>> dir=string.sub(dir, 1, -2) > >>> end > >>> > >>> local function yieldtree(dir) > >>> for entry in lfs.dir(dir) do > >>> if not entry:match("^%.") then > >>> entry=dir.."/"..entry > >>> if not lfs.isdir(entry) then > >>> coroutine.yield(entry,lfs.attributes(entry)) > >>> end > >>> if lfs.isdir(entry) then > >>> yieldt
Re: [NTG-context] How to use "fontsampler example" with Persian font
Dear Mohammad, Hi, Thank you very much for your reply. I forgot to mention that I had modified the fontsampler codes so that I can use it in ConTeXt with Dabeer module. However, inspired by your reply I could get it to work in LuaTeX but not in ConTeXt with Dabeer module. Are there any other set of features that I can test? Thanks, Mingranina On 10/7/16, Mohammad Hossein Bateni <bat...@gmail.com> wrote: > The following works for me: > > \input luaotfload.sty > \font \myfont = > file:HM_XNiloofar.ttf:language=dflt;script=arab;ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes > \myfont Salam > > \pardir TRT > \textdir TRT > سلام > حسن > \bye > > > On Fri, Oct 7, 2016 at 7:19 AM, Mohammad Hossein Bateni <bat...@gmail.com> > wrote: > >> I don't know much about fontsampler but the commands you list here are >> mostly irrelevant. My guess is you will need to set the features in the >> font to get proper shaping. A good set of features that should do the >> trick is called "arabic". >> >> When loading the font, you should do something like the following, but I >> have not tried it myself. >> >> \font\myfont=file:font.otf:language=dflt;script=arab; >> ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes >> >> —MHB >> >> >> On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina < >> mingran...@gmail.com> wrote: >> >>> Dear All, >>> Hello, >>> >>> I am trying to use "fontsampler example" with Persian fonts (please >>> see below or "http://wiki.luatex.org/index.php/Fontsampler; >>> for fontsampler codes). >>> The problem is that Persian words apears as a string of separate >>> glyphs, for example I get "حسن" instead of "حسن". >>> Do I have to use commands like the followings inside \directlua or >>> tex.tprint to fix the problem? If yes, how can I do that? >>> >>> \installlanguage [fa][default=pe,date=\longjalalidatefmt] >>> \mainlanguage[fa] >>> >>> \definefontfeature[tlig][tlig=yes] >>> \definefontfeature[slanted][slant=.2] >>> \definefontfeature[dlang][language=dflt] >>> \definefontfeature[flang][language=far] >>> >>> Thanks >>> Mingranina >>> >>> >>> fontsampler.tex >>> >>> = >>> \input luaotfload.sty >>> \overfullrule 0pt >>> \font\mono = {file:lmmono8-regular.otf} at 6pt >>> \parindent 0pt >>> >>> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890 >>> äÄöÖüÜ ß !"§\$\%\&()=?} >>> >>> \directlua{ >>> dofile("fontsampler.lua") >>> fontsampler(arg[2]) >>> } >>> >>> \bye >>> >>> = >>> End Of fontsampler.tex >>> >>> >>> fontsampler.lua >>> >>> = >>> function dirtree(dir) >>> assert(dir and dir ~= "", "directory parameter is missing or empty") >>> if string.sub(dir, -1) == "/" then >>> dir=string.sub(dir, 1, -2) >>> end >>> >>> local function yieldtree(dir) >>> for entry in lfs.dir(dir) do >>> if not entry:match("^%.") then >>> entry=dir.."/"..entry >>> if not lfs.isdir(entry) then >>> coroutine.yield(entry,lfs.attributes(entry)) >>> end >>> if lfs.isdir(entry) then >>> yieldtree(entry) >>> end >>> end >>> end >>> end >>> >>> return coroutine.wrap(function() yieldtree(dir) end) >>> end >>> >>> >>> function fontsampler( dir ) >>> for entry in dirtree(dir) do >>> if entry:match(".otf","-4") then >>> tex.tprint({[[\mono ]]},{-2,entry},{[[ >>> (]]},{-2,fontloader.info(entry).fontname},{[[)\par\penalty >>> 1\font\sample={file:]]},{-2,entry},{[[} at >>> 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height >>> 0.25pt depth 0pt\par]]}) >>> end >>> end >>> end >>> >>> = >>> End Of fontsampler.lua >>> >>> ___ >>> If your question is of interest to others as well, please add an entry >>> to >>> the Wiki! >>> >>> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/list >>> info/ntg-context >>> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >>> archive : http://foundry.supelec.fr/projects/contextrev/ >>> wiki : http://contextgarden.net >>> >>> ___ >> >> >> > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to use "fontsampler example" with Persian font
The following works for me: \input luaotfload.sty \font \myfont = file:HM_XNiloofar.ttf:language=dflt;script=arab;ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes \myfont Salam \pardir TRT \textdir TRT سلام حسن \bye On Fri, Oct 7, 2016 at 7:19 AM, Mohammad Hossein Bateni <bat...@gmail.com> wrote: > I don't know much about fontsampler but the commands you list here are > mostly irrelevant. My guess is you will need to set the features in the > font to get proper shaping. A good set of features that should do the > trick is called "arabic". > > When loading the font, you should do something like the following, but I > have not tried it myself. > > \font\myfont=file:font.otf:language=dflt;script=arab; > ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes > > —MHB > > > On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina < > mingran...@gmail.com> wrote: > >> Dear All, >> Hello, >> >> I am trying to use "fontsampler example" with Persian fonts (please >> see below or "http://wiki.luatex.org/index.php/Fontsampler; >> for fontsampler codes). >> The problem is that Persian words apears as a string of separate >> glyphs, for example I get "حسن" instead of "حسن". >> Do I have to use commands like the followings inside \directlua or >> tex.tprint to fix the problem? If yes, how can I do that? >> >> \installlanguage [fa][default=pe,date=\longjalalidatefmt] >> \mainlanguage[fa] >> >> \definefontfeature[tlig][tlig=yes] >> \definefontfeature[slanted][slant=.2] >> \definefontfeature[dlang][language=dflt] >> \definefontfeature[flang][language=far] >> >> Thanks >> Mingranina >> >> >> fontsampler.tex >> >> = >> \input luaotfload.sty >> \overfullrule 0pt >> \font\mono = {file:lmmono8-regular.otf} at 6pt >> \parindent 0pt >> >> \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890 >> äÄöÖüÜ ß !"§\$\%\&()=?} >> >> \directlua{ >> dofile("fontsampler.lua") >> fontsampler(arg[2]) >> } >> >> \bye >> >> = >> End Of fontsampler.tex >> >> >> fontsampler.lua >> >> = >> function dirtree(dir) >> assert(dir and dir ~= "", "directory parameter is missing or empty") >> if string.sub(dir, -1) == "/" then >> dir=string.sub(dir, 1, -2) >> end >> >> local function yieldtree(dir) >> for entry in lfs.dir(dir) do >> if not entry:match("^%.") then >> entry=dir.."/"..entry >> if not lfs.isdir(entry) then >> coroutine.yield(entry,lfs.attributes(entry)) >> end >> if lfs.isdir(entry) then >> yieldtree(entry) >> end >> end >> end >> end >> >> return coroutine.wrap(function() yieldtree(dir) end) >> end >> >> >> function fontsampler( dir ) >> for entry in dirtree(dir) do >> if entry:match(".otf","-4") then >> tex.tprint({[[\mono ]]},{-2,entry},{[[ >> (]]},{-2,fontloader.info(entry).fontname},{[[)\par\penalty >> 1\font\sample={file:]]},{-2,entry},{[[} at >> 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height >> 0.25pt depth 0pt\par]]}) >> end >> end >> end >> >> = >> End Of fontsampler.lua >> >> ___ >> If your question is of interest to others as well, please add an entry to >> the Wiki! >> >> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/list >> info/ntg-context >> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net >> archive : http://foundry.supelec.fr/projects/contextrev/ >> wiki : http://contextgarden.net >> >> ___ > > > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to use "fontsampler example" with Persian font
I don't know much about fontsampler but the commands you list here are mostly irrelevant. My guess is you will need to set the features in the font to get proper shaping. A good set of features that should do the trick is called "arabic". When loading the font, you should do something like the following, but I have not tried it myself. \font\myfont=file:font.otf:language=dflt;script=arab;ccmp=yes;init=yes;medi=yes;fina=yes;rlig=yes —MHB On Fri, Oct 7, 2016 at 7:01 AM, Mingranina Gingranina <mingran...@gmail.com> wrote: > Dear All, > Hello, > > I am trying to use "fontsampler example" with Persian fonts (please > see below or "http://wiki.luatex.org/index.php/Fontsampler; > for fontsampler codes). > The problem is that Persian words apears as a string of separate > glyphs, for example I get "حسن" instead of "حسن". > Do I have to use commands like the followings inside \directlua or > tex.tprint to fix the problem? If yes, how can I do that? > > \installlanguage [fa][default=pe,date=\longjalalidatefmt] > \mainlanguage[fa] > > \definefontfeature[tlig][tlig=yes] > \definefontfeature[slanted][slant=.2] > \definefontfeature[dlang][language=dflt] > \definefontfeature[flang][language=far] > > Thanks > Mingranina > > > fontsampler.tex > > = > \input luaotfload.sty > \overfullrule 0pt > \font\mono = {file:lmmono8-regular.otf} at 6pt > \parindent 0pt > > \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890 > äÄöÖüÜ ß !"§\$\%\&()=?} > > \directlua{ > dofile("fontsampler.lua") > fontsampler(arg[2]) > } > > \bye > > = > End Of fontsampler.tex > > > fontsampler.lua > > = > function dirtree(dir) > assert(dir and dir ~= "", "directory parameter is missing or empty") > if string.sub(dir, -1) == "/" then > dir=string.sub(dir, 1, -2) > end > > local function yieldtree(dir) > for entry in lfs.dir(dir) do > if not entry:match("^%.") then > entry=dir.."/"..entry > if not lfs.isdir(entry) then > coroutine.yield(entry,lfs.attributes(entry)) > end > if lfs.isdir(entry) then > yieldtree(entry) > end > end > end > end > > return coroutine.wrap(function() yieldtree(dir) end) > end > > > function fontsampler( dir ) > for entry in dirtree(dir) do > if entry:match(".otf","-4") then > tex.tprint({[[\mono ]]},{-2,entry},{[[ > (]]},{-2,fontloader.info(entry).fontname},{[[)\par\penalty > 1\font\sample={file:]]},{-2,entry},{[[} at > 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height > 0.25pt depth 0pt\par]]}) > end > end > end > > = > End Of fontsampler.lua > > ___ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/ > listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] How to use "fontsampler example" with Persian font
Dear All, Hello, I am trying to use "fontsampler example" with Persian fonts (please see below or "http://wiki.luatex.org/index.php/Fontsampler; for fontsampler codes). The problem is that Persian words apears as a string of separate glyphs, for example I get "حسن" instead of "حسن". Do I have to use commands like the followings inside \directlua or tex.tprint to fix the problem? If yes, how can I do that? \installlanguage [fa][default=pe,date=\longjalalidatefmt] \mainlanguage[fa] \definefontfeature[tlig][tlig=yes] \definefontfeature[slanted][slant=.2] \definefontfeature[dlang][language=dflt] \definefontfeature[flang][language=far] Thanks Mingranina fontsampler.tex = \input luaotfload.sty \overfullrule 0pt \font\mono = {file:lmmono8-regular.otf} at 6pt \parindent 0pt \def \samplestring {Sphinx of black quartz, judge my vow. 1234567890 äÄöÖüÜ ß !"§\$\%\&()=?} \directlua{ dofile("fontsampler.lua") fontsampler(arg[2]) } \bye = End Of fontsampler.tex fontsampler.lua = function dirtree(dir) assert(dir and dir ~= "", "directory parameter is missing or empty") if string.sub(dir, -1) == "/" then dir=string.sub(dir, 1, -2) end local function yieldtree(dir) for entry in lfs.dir(dir) do if not entry:match("^%.") then entry=dir.."/"..entry if not lfs.isdir(entry) then coroutine.yield(entry,lfs.attributes(entry)) end if lfs.isdir(entry) then yieldtree(entry) end end end end return coroutine.wrap(function() yieldtree(dir) end) end function fontsampler( dir ) for entry in dirtree(dir) do if entry:match(".otf","-4") then tex.tprint({[[\mono ]]},{-2,entry},{[[ (]]},{-2,fontloader.info(entry).fontname},{[[)\par\penalty 1\font\sample={file:]]},{-2,entry},{[[} at 12pt\sample\samplestring\par\penalty 1\vrule width \hsize height 0.25pt depth 0pt\par]]}) end end end = End Of fontsampler.lua ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] lua tables - how do you cope?
Hello Thomas, here is my "dump()" I've been using for several years: function dump(arg, opts) -- .seen, .pfx if type(opts) == "string" then print(opts); opts = nil elseif opts == true then print("-- (dump)"); opts = nil end local pfx = opts and opts.pfx local seen = opts and opts.seen or {} if type(arg) == "table" then if pfx then pfx = pfx .. "][" else pfx = "[" --seen = {} end seen[arg] = tostring(arg) --true local keys = {} do -- Sort keys, if all are strings local strs_only = true for k in pairs(arg) do if strs_only and type(k) ~= "string" then strs_only = false end keys[#keys + 1] = k end if strs_only then table.sort(keys) end end for _, key in ipairs(keys) do local val = arg[key] io.write(pfx .. tostring(key) .. "] = " .. tostring(val) .. "\t(" .. type(val) .. ")") if type(val) == "table" then if seen[val] then print(" (seen)") else print() dump(val, {pfx = pfx .. tostring(key), seen = seen}) --pfx .. tostring(key), seen) end else print() end end else print(arg) end end Try: a = {c = 1, b = 2}; a.a = a dump(a) dump(a, "This is 'a'.") Improvements or parametrization of visualizing style would be possible, of course... Best regards, Lukas - Original Message - From: Schmitz Thomas A. [mailto:thomas.schm...@uni-bonn.de] To: mailing list for ConTeXt users [mailto:ntg-context@ntg.nl] Sent: Sat, 30 Jul 2016 23:01:29 +0100 Subject: Re: [NTG-context] lua tables - how do you cope? > Thank you, but this is not what I’m looking for. I know how to sort a table, > and I know the Lua table tutorial (the Lua wiki is, IMHO, really terrible and > disorganized). I have to construct deeply nested tables and sometimes lose > track of what is at what level of my table, so I was wondering if there was > an easy way of visualizing a nested table. On the web, you can find a number > of (mostly abandoned) projects; the one at > http://siffiejoe.github.io/lua-microscope/ says: "Many Lua programmers have > written their own pretty-printer or data dumper and some even use it for > (de-)serializing Lua data structures.” So I was wondering if any of the Lua > users here on the list has something they want to share. Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] tagging a startstop
Dear syndicate, We have \definehighlight[tagged][style=] so that \tagged{arg} tags the argument. Analogously: Is there a general facility to tag startstops? I played around with \dostarttagged etc but could not get it to work (too low-level for me I guess). What would be nice is to be able to say, e.g. \definestartstop[TAG][tag=div] % or tag=construct etc. so that my startstop also generates tags in the xhtml. Is there already a way to do this? Thanks and Best Wishes Idris -- Idris Samawi Hamid Professor of Philosophy Colorado State University Fort Collins, CO 80523 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] tagging a startstop
Am 28.03.2015 um 19:18 schrieb Idris Samawi Hamid ادريس سماوي حامد isha...@colostate.edu: Dear syndicate, We have \definehighlight[tagged][style=] so that \tagged{arg} tags the argument. Analogously: Is there a general facility to tag startstops? I played around with \dostarttagged etc but could not get it to work (too low-level for me I guess). What would be nice is to be able to say, e.g. \definestartstop[TAG][tag=div] % or tag=construct etc. so that my startstop also generates tags in the xhtml. Is there already a way to do this? Commands created with \definestartstop already add tags, is there something wrong with them? Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] total pages in external PDF
On 02/25/2015 10:45 PM, Hans Hagen wrote: On 2/25/2015 6:41 PM, Pablo Rodriguez wrote: [...] \def\Myfilename{\env{filename}} doc = epdf.open(arg[\MyFilename]) total_pages_ = doc:getNumPages() \def\Mypages{total_pages} [...] Which is the right way to get the code above working? \getfiguredimensions[whatever.pdf] \noffigurepages Many thanks for your reply, Hans. It works like charm. Now I can generate my booklets fully automatic (for the people :-)). Many thanks again for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] total pages in external PDF
Dear list, I need to get the number of pages from an external PDF file that I also define with an \env. I think I could get something like this.: \def\Myfilename{\env{filename}} doc = epdf.open(arg[\MyFilename]) total_pages_ = doc:getNumPages() \def\Mypages{total_pages} But mixing both lua and ConTeXt commands the wrong way won’t work. Sorry, but this is all Greek to me. Although I see how it could be done, I cannot write the code for this. Which is the right way to get the code above working? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] total pages in external PDF
On 2/25/2015 6:41 PM, Pablo Rodriguez wrote: Dear list, I need to get the number of pages from an external PDF file that I also define with an \env. I think I could get something like this.: \def\Myfilename{\env{filename}} doc = epdf.open(arg[\MyFilename]) total_pages_ = doc:getNumPages() \def\Mypages{total_pages} But mixing both lua and ConTeXt commands the wrong way won’t work. Sorry, but this is all Greek to me. Although I see how it could be done, I cannot write the code for this. Which is the right way to get the code above working? \getfiguredimensions[whatever.pdf] \noffigurepages - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] total pages in external PDF
On Wed, 25 Feb 2015, Pablo Rodriguez wrote: Dear list, I need to get the number of pages from an external PDF file that I also define with an \env. I think I could get something like this.: \def\Myfilename{\env{filename}} doc = epdf.open(arg[\MyFilename]) total_pages_ = doc:getNumPages() \def\Mypages{total_pages} But mixing both lua and ConTeXt commands the wrong way won’t work. Sorry, but this is all Greek to me. Although I see how it could be done, I cannot write the code for this. Which is the right way to get the code above working? From my old cut-n-paste module (to format two column pdfs into one column so that they are easier to read on an eink reader) \useexternalfigure[cnp:name][\cut!n!paste!parameter\c!name]% Is this really needed? \getfiguredimensions[cnp:name]% \edef\cut!n!paste!NOfpages {\noffigurepages}% Aditya [1]: https://github.com/adityam/cut-n-paste/blob/master/tex/context/third/cut-n-paste/t-cut-n-paste.tex___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] unwanted extra space in type definition
Dear list, I have the following sample: \definetype[TeXcode][option=TEX] \def\arg#1{\TeXcode{{#1}}} \starttext \arg{\em\de Textsatzsystem} \TeXcode{{\em\de Textsatzsystem}} \stoptext I don’t know what is wrong defined in \arg that inserts an extra space after \em? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] unwanted extra space in type definition
Am 26.05.2014 um 18:00 schrieb Pablo Rodriguez oi...@gmx.es: Dear list, I have the following sample: \definetype[TeXcode][option=TEX] \def\arg#1{\TeXcode{{#1}}} \starttext \arg{\em\de Textsatzsystem} \TeXcode{{\em\de Textsatzsystem}} \stoptext I don’t know what is wrong defined in \arg that inserts an extra space after \em? You can’t do this form a definition for a verbatim command because TeX has its own rules for such a situation (search for a description about catcodes), when you want a copy of \TeXcode add \definetype[arg][TeXcode] to your document. BTW: \arg is a predefined command and you should avoid to redefine it Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] unwanted extra space in type definition
On Mon, May 26, 2014 at 6:00 PM, Pablo Rodriguez oi...@gmx.es wrote: Dear list, I have the following sample: \definetype[TeXcode][option=TEX] \def\arg#1{\TeXcode{{#1}}} \starttext \arg{\em\de Textsatzsystem} \TeXcode{{\em\de Textsatzsystem}} \stoptext I don’t know what is wrong defined in \arg that inserts an extra space after \em? You can see how TeX works with \tracingmacros \definetype[TeXcode][option=TEX] \def\arg#1{\edef\temp{#1}\TeXcode{{#1}}} \starttext \tracingmacros1 \arg{\em\de Textsatzsystem} \tracingnone \tracingmacros1 \TeXcode{{\em\de Textsatzsystem}} \tracingnone \stoptext -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] unwanted extra space in type definition
On 05/26/2014 06:08 PM, Wolfgang Schuster wrote: Am 26.05.2014 um 18:00 schrieb Pablo Rodriguez: \def\arg#1{\TeXcode{{#1}}} [...] I don’t know what is wrong defined in \arg that inserts an extra space after \em? You can’t do this form a definition for a verbatim command because TeX has its own rules for such a situation (search for a description about catcodes), when you want a copy of \TeXcode add \definetype[arg][TeXcode] to your document. BTW: \arg is a predefined command and you should avoid to redefine it Many thanks for your reply, Wolfgang. Is there no way that I have the already predefined \arg with colored contents (braces included)? Even with defining another command, the problem is that left and right aren’t covered by option=TEX. Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] unwanted extra space in type definition
On 05/26/2014 06:55 PM, luigi scarso wrote: On Mon, May 26, 2014 at 6:00 PM, Pablo Rodriguez wrote: Dear list, I have the following sample: \definetype[TeXcode][option=TEX] \def\arg#1{\TeXcode{{#1}}} \starttext \arg{\em\de Textsatzsystem} \TeXcode{{\em\de Textsatzsystem}} \stoptext I don’t know what is wrong defined in \arg that inserts an extra space after \em? You can see how TeX works with \tracingmacros \definetype[TeXcode][option=TEX] \def\arg#1{\edef\temp{#1}\TeXcode{{#1}}} \starttext \tracingmacros1 \arg{\em\de Textsatzsystem} \tracingnone \tracingmacros1 \TeXcode{{\em\de Textsatzsystem}} \tracingnone \stoptext Many thanks for your reply, Luigi. Sorry, but I have just downloaded and read your message. Well, this seems to be something beyond my understanding (this is all Greek to me). The only conclusion I can draw is that I have to use the second option. Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] a question on coloring \tex and \var
Dear list, I have this sample: \definetype[TeXcode][option=TEX] \starttext \TeXcode{\mainlanguage[la]}, but \tex{ConTeXt} and \arg{option=value}. \stoptext I need ot have \tex and \arg colored with [option=TeX] (and I would avoid having \type colored). How can I do that? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] bug in \type?
Dear list, using the latest beta (it also happens with ConTeXt from TL 2013), I don’t get the space in \type{\em #1}. Here you have a minimal sample that shows the difference with other verbatim commands: \starttext \type{\em #1} \arg{\em #1} \starttyping\em #1\stoptyping \stoptext Is this a bug in \type or am I missing something? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] the difference between \def and \define
On 4/16/2013 1:14 PM, Alan BRASLAU wrote: Since the question has been raised about understanding \define, etc. indeed some use remains a bit unclear (to me). On Tue, 16 Apr 2013 12:34:48 +0200 Hans Hagen pra...@wxs.nl wrote: there is a commented blob that implements thinsg like this \starttext \define[2]\whatevera{#1+#2} \whatevera{A}{B} \define[me][too][2]\whateverb{#1+#2+#3+#4} \whateverb[A]{B}{C} \whateverb[A][B]{C}{D} \define[alpha][beta][gamma][delta]\whateverc{#1+#2+#3+#4} \whateverc[P][Q] \stoptext but it's just an old idea. I am perhaps a bit bewildered today... but I do not understand the above. It gets too tricky for me! that's why it's commented code -) \define [optional-arg-1-default][optional-arg-2-default]...[number of {} args] but .. not likely to become enabled anyway (was an experiment) Or, maybe, I might like to handle authors: \define[2]\Author{\index{#2, #1}#1 #2} \Author{Thomas A.}{Schmitz} But what if I were to type \Author{Aristotle}? the [] are optional with an optional default \define[one,two,three]\whatever{first: #one second: #two third: #three} that's not too complex to implement (as mkvi) if there's enough votes for it On 4/16/2013 11:10 AM, Thomas A. Schmitz wrote: It certainly isn't an urgent need, but having \define[one,two,three] wouldn't be absurd, now would it? -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Problem with local installation - MKIV- register
Hello Philipp, many thanks for your help! Wolfgang Am 02.04.2013 00:54, schrieb Philipp Gesang: Hi Wolfgang! ···date: 2013-04-02, Tuesday···from: WolfgangZ··· Hello, I have a problem with a using a register in my local installation (MKIV). The minimal example works on contextgarden. The example: \defineregister[Erf][Erflist] \defineregister[Erf] It doesn’t appear to be documented anywhere (even the source ...) but in mkiv \defineregister is an ordinary command handler so no fancy plurals anymore. Now the second arg expects an assignment: \defineregister[Erf][style=slanted,pagestyle=bold] Regards Philipp \starttext \chapter{F53667} Hello world! \Erf{Bla} Fool \page \placeregister[Erf] \stoptext The error I get: mtx-context | run 1: luatex --fmt=D:/context/tex/texmf-cache/luatex-cache/c ontext/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en --jobname=test1 --lua=D:/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776f b1556f32e/formats/luatex/cont-en.lui --no-parse-first-line --c:currentrun=1 --c :fulljobname=./test1.tex --c:input=./test1.tex --c:kindofrun=1 --c:maxnofrun s=8 cont-yes.mkiv This is LuaTeX, Version beta-0.77.0-2013033008 (rev 4622) \write18 enabled. (D:/context/tex/texmf-context/tex/context/base/cont-yes.mkiv ConTeXt ver: 2013.03.29 01:03 MKIV fmt: 2013.4.2 int: english/english system 'cont-new.mkiv' loaded (D:/context/tex/texmf-context/tex/context/base/cont-new.mkiv system beware: some patches loaded from cont-new.mkiv ) system files jobname 'test1', input 'test1', result 'test1' fontslatin modern fonts are not preloaded languageslanguage 'en' is active (test1.tex{D:/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map} fontspreloading latin modern fonts (second stage) fontstypescripts unknown library 'loc' {D:/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{D:/context/tex/texmf/fonts /map/dvips/lm/lm-rm.map} fonts'fallback modern rm 12pt' is loaded structuresectioning chapter @ level 2 : 0.1 - F53667 backend xmp using file 'D:/context/tex/texmf-context/tex/context/bas e/lpdf-pdx.xml' pagesflushing realpage 1, userpage 1 ! Missing number, treated as zero. log system tex error on line 8 in file test1.tex: Missing number, treat ed as zero ... to be read again \strc_registers_place ...\registerparameter \c!n \plusone \startcolumns [\c... \syst_helpers_double_empty_one_spaced ...1[{#2}][] to be read again \stoptext l.8 \stoptext ? Any help is welcome. Best regards Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Problem with local installation - MKIV- register
On 4/2/2013 10:08 AM, Wolfgang wrote: Hello Philipp, many thanks for your help! Wolfgang I've added \mult_check_for_parent so at least there is less change for a crash but a complete auto parent define is never going to work so it's reported as error: system error: invalid parent Erfs for Erf, Erfs defined too (best check it) Am 02.04.2013 00:54, schrieb Philipp Gesang: Hi Wolfgang! ···date: 2013-04-02, Tuesday···from: WolfgangZ··· Hello, I have a problem with a using a register in my local installation (MKIV). The minimal example works on contextgarden. The example: \defineregister[Erf][Erflist] \defineregister[Erf] It doesn’t appear to be documented anywhere (even the source ...) but in mkiv \defineregister is an ordinary command handler so no fancy plurals anymore. Now the second arg expects an assignment: \defineregister[Erf][style=slanted,pagestyle=bold] Regards Philipp \starttext \chapter{F53667} Hello world! \Erf{Bla} Fool \page \placeregister[Erf] \stoptext The error I get: mtx-context | run 1: luatex --fmt=D:/context/tex/texmf-cache/luatex-cache/c ontext/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en --jobname=test1 --lua=D:/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776f b1556f32e/formats/luatex/cont-en.lui --no-parse-first-line --c:currentrun=1 --c :fulljobname=./test1.tex --c:input=./test1.tex --c:kindofrun=1 --c:maxnofrun s=8 cont-yes.mkiv This is LuaTeX, Version beta-0.77.0-2013033008 (rev 4622) \write18 enabled. (D:/context/tex/texmf-context/tex/context/base/cont-yes.mkiv ConTeXt ver: 2013.03.29 01:03 MKIV fmt: 2013.4.2 int: english/english system 'cont-new.mkiv' loaded (D:/context/tex/texmf-context/tex/context/base/cont-new.mkiv system beware: some patches loaded from cont-new.mkiv ) system files jobname 'test1', input 'test1', result 'test1' fontslatin modern fonts are not preloaded languageslanguage 'en' is active (test1.tex{D:/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map} fontspreloading latin modern fonts (second stage) fontstypescripts unknown library 'loc' {D:/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{D:/context/tex/texmf/fonts /map/dvips/lm/lm-rm.map} fonts'fallback modern rm 12pt' is loaded structuresectioning chapter @ level 2 : 0.1 - F53667 backend xmp using file 'D:/context/tex/texmf-context/tex/context/bas e/lpdf-pdx.xml' pagesflushing realpage 1, userpage 1 ! Missing number, treated as zero. log system tex error on line 8 in file test1.tex: Missing number, treat ed as zero ... to be read again \strc_registers_place ...\registerparameter \c!n \plusone \startcolumns [\c... \syst_helpers_double_empty_one_spaced ...1[{#2}][] to be read again \stoptext l.8 \stoptext ? Any help is welcome. Best regards Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well
Re: [NTG-context] Problem with local installation - MKIV- register
Hi Wolfgang! ···date: 2013-04-02, Tuesday···from: WolfgangZ··· Hello, I have a problem with a using a register in my local installation (MKIV). The minimal example works on contextgarden. The example: \defineregister[Erf][Erflist] \defineregister[Erf] It doesn’t appear to be documented anywhere (even the source ...) but in mkiv \defineregister is an ordinary command handler so no fancy plurals anymore. Now the second arg expects an assignment: \defineregister[Erf][style=slanted,pagestyle=bold] Regards Philipp \starttext \chapter{F53667} Hello world! \Erf{Bla} Fool \page \placeregister[Erf] \stoptext The error I get: mtx-context | run 1: luatex --fmt=D:/context/tex/texmf-cache/luatex-cache/c ontext/5fe67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en --jobname=test1 --lua=D:/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776f b1556f32e/formats/luatex/cont-en.lui --no-parse-first-line --c:currentrun=1 --c :fulljobname=./test1.tex --c:input=./test1.tex --c:kindofrun=1 --c:maxnofrun s=8 cont-yes.mkiv This is LuaTeX, Version beta-0.77.0-2013033008 (rev 4622) \write18 enabled. (D:/context/tex/texmf-context/tex/context/base/cont-yes.mkiv ConTeXt ver: 2013.03.29 01:03 MKIV fmt: 2013.4.2 int: english/english system 'cont-new.mkiv' loaded (D:/context/tex/texmf-context/tex/context/base/cont-new.mkiv system beware: some patches loaded from cont-new.mkiv ) system files jobname 'test1', input 'test1', result 'test1' fontslatin modern fonts are not preloaded languageslanguage 'en' is active (test1.tex{D:/context/tex/texmf-context/fonts/map/pdftex/context/mkiv-base.map} fontspreloading latin modern fonts (second stage) fontstypescripts unknown library 'loc' {D:/context/tex/texmf/fonts/map/dvips/lm/lm-math.map}{D:/context/tex/texmf/fonts /map/dvips/lm/lm-rm.map} fonts'fallback modern rm 12pt' is loaded structuresectioning chapter @ level 2 : 0.1 - F53667 backend xmp using file 'D:/context/tex/texmf-context/tex/context/bas e/lpdf-pdx.xml' pagesflushing realpage 1, userpage 1 ! Missing number, treated as zero. log system tex error on line 8 in file test1.tex: Missing number, treat ed as zero ... to be read again \strc_registers_place ...\registerparameter \c!n \plusone \startcolumns [\c... \syst_helpers_double_empty_one_spaced ...1[{#2}][] to be read again \stoptext l.8 \stoptext ? Any help is welcome. Best regards Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments pgppaAvGySpgk.pgp Description: PGP signature ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to use module simpleslides' SideToc
Hello PengCZ, This is not exactly what you want, because it took me very long to remember to look at SideToc.pdf. But it is close, and I have tried to put in a lot of comments. Hopefully you can solve it from here? Cheers, and good luck, Sietse % * We use \Topic to set the current topic, and to % record it in the topic list % * \setuptexttexts places the topic list in the left margin % on every page % http://wiki.contextgarden.net/Command/setuptexttexts % (needs improving) % * \setupbackgrounds sets the backgrond color of the left % margin on every page: this highlights the TOC area % http://wiki.contextgarden.net/Command/setupbackgrounds % * the entry typesetting command (called \FancyTopic) typesets % entries inside a \framed block as wide as the margin is. % This allows highlighting the background of the current topic, % and also allows linebreaks etc. % http://wiki.contextgarden.net/Command/framed \setuppapersize[A6,landscape][A6,landscape] \setuplayout [leftmargin=5cm, backspace=6cm, width=6cm, ] % Color for the margin (topic list area) \definecolor[colMyTopics][r=1,g=0.7,b=0.7] % pink % Color for the current topic (in the topic list) % I like white, because it attaches the current topic to the % main area; but perhaps you prefer pale yellow? % \definecolor[colCurrentTopic][r=1,g=1,b=0.7] % pale yellow \definecolor[colCurrentTopic][r=1,g=1,b=1] % white % When \placelist[MyTopics] is called, it calls this \FancyEntry % function to typeset each individual entry. % #1: entry (i.e. topic name) to typeset % \MyMark: section (i.e. topic name) we are currently in (set by % \Topic). \define[3]\FancyEntry { \ifnum\structurelistrealpagenumber=\realpageno\relax SAME \else OTHER \fi PAGE \blank[medium] \doifelse \rawstructurelistfirst \MyMark {\framed[frame=off, align=normal, width=5cm, % same as leftmargin in \setuplayout background=color, backgroundcolor=colCurrentTopic]{% --- current mark's entry \par \color[red]{--- arg (entry): #1}\par \color[red]{--- mark: \MyMark} }} {\framed[frame=off, align=normal]{% --- other entry \par \color[blue]{--- arg (entry): #1}\par \color[blue]{--- mark: \MyMark} }} \blank[medium] } % Show the margin areas, headers, footers, etc. \showframe % Color the margin area. \setupbackgrounds must be called after % \showframe, or \showframe will 'overwrite' \setupbackgrounds. \setupbackgrounds[text][leftmargin][ background=color, backgroundcolor=colMyTopics] \definelist[MyTopics][criterium=all] \def\MyMark{} % \Topic takes one optional argument: #1, the topic name. \def\Topic% {\dosingleargument\doTopic} \def\doTopic[#1]{% % let it be known that we are in section #1 (used by \FancyTopic) \def\MyMark{#1}% % let topic #1 appear in the TOC (well, the MyTopics list) \writetolist[MyTopics]{#1}{}% } \setuplist[MyTopics] [pagenumber=no, alternative=command, command=\FancyEntry] % On every page, place the TOC in the margin, plzkthx \setuptexttexts[margin][\vbox{\placelist[MyTopics]}][] \starttext \Topic[First] First Topic \page \Topic[Second] Second Topic \page \Topic[Third] Third Topic \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Epub woes
Try lucifox (is a part of lucifox addon for firefox) arg.. to late.. try lucidor as a part of lucifox... :-D ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] verbatim text: \type, \tex and co.
On 27-9-2012 22:49, Alan Braslau wrote: Hello, Can someone indicate how to typeset $L_{α+β}$ as verbatim text? (\arg{} doesn't help here...) Furthermore, I suppose that typesetting Greek characters verbatim depends also upon which \tt font is being used. \setupbodyfont[dejavu] \starttext \starttyping $L_{α+β}$ \stoptyping \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] verbatim text: \type, \tex and co.
On Fri, 28 Sep 2012 10:43:48 +0200 Hans Hagen pra...@wxs.nl wrote: On 27-9-2012 22:49, Alan Braslau wrote: Hello, Can someone indicate how to typeset $L_{α+β}$ as verbatim text? (\arg{} doesn't help here...) Furthermore, I suppose that typesetting Greek characters verbatim depends also upon which \tt font is being used. \setupbodyfont[dejavu] \starttext \starttyping $L_{α+β}$ \stoptyping \stoptext Also, \type{$L_{α+β}$} I thought that I saw that somewhere before! :) Alan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] verbatim text: \type, \tex and co.
Hello, Can someone indicate how to typeset $L_{α+β}$ as verbatim text? (\arg{} doesn't help here...) Furthermore, I suppose that typesetting Greek characters verbatim depends also upon which \tt font is being used. Alan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] verbatim text: \type, \tex and co.
Can someone indicate how to typeset $L_{α+β}$ as verbatim text? (\arg{} doesn't help here...) Untested: \type{...} should work. (Definitely did work a couple of months ago). Furthermore, I suppose that typesetting Greek characters verbatim depends also upon which \tt font is being used. CM Unicode has a good coverage of greek characters in typewriter font. Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Figured bass symbols in a text.
Hans wrote: So, we have low/high definable and clonable etc. Best check if the defaults are compatible. Valid parameters are 'up', 'down' and 'distance' (dimensions) and of course 'style' and 'color'. Just downloaded and tested, looks nice. Small bug: It's called lomihi, but the arguments are placed middle/high/low. For documentation/clarification, is the following correct? distance = extra kerning, distance between lomihi and preceding character. up = how much the {hi} arg is raised down = how much the {low} arg is lowered Support for the [left] keyword seems to have been dropped, but is still in the documentation comments. Perhaps instead support align=..., and turn distance= into kernbefore= and kernafter=? Sorry about not knowing enough to implement it myself. Cheers, Sietse On Fri, Aug 10, 2012 at 7:59 PM, Hans Hagen pra...@wxs.nl wrote: On 10-8-2012 18:08, Wolfgang Schuster wrote: Am 10.08.2012 um 18:00 schrieb Rogers, Michael K mrog...@emory.edu: Hi, Since no one has offered a quick ConTeXt solution, I offer my usual -- a dumb Plain TeX solution: \def\lomihi#1#2#3{${\scriptstyle{#2}}\limits_{#1}^{#3}$} With the Computer Modern font, the top is a little further away from the middle than the bottom. It can be adjusted with something like \def\lomihi#1#2#3{${\scriptstyle{#2}}\limits_{#1}^{\lower0.23pt\hbox{$\scriptstyle{#3}$}}$} but this would probably have to be adjusted for each font and size. You can use \framed: \defineframed[lohimi][align=flushleft,location=middle,frame=off,foregroundstyle=\tx] \starttext text \lohi{1}{2} text \lohimi{1\\2\\3} text \stoptext Neat trick. === Wolfgang, The next beta has: \starttext \definelow [MyLow] [style=\txx] \definehigh [MyHigh] [style=\txx] \definelowhigh [MyLoHi] [style=\txx] \definelowmidhigh[MyLoMiHi][style=\txx] We have \ruledhbox{\low {L}} and \ruledhbox{\MyLow {L}} and \ruledhbox{\high{H}} and \ruledhbox{\MyHigh{H}} and \ruledhbox{\lohi {L}{H}} and \ruledhbox{\MyLoHi {L}{H}} and \ruledhbox{\lomihi{L}{M}{H}} and \ruledhbox{\MyLoMiHi{L}{M}{H}}. \stoptext So, we have low/high definable and clonable etc. Best check if the defaults are compatible. Valid parameters are 'up', 'down' and 'distance' (dimensions) and of course 'style' and 'color'. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Figured bass symbols in a text.
On 10-8-2012 21:09, Sietse Brouwer wrote: Hans wrote: So, we have low/high definable and clonable etc. Best check if the defaults are compatible. Valid parameters are 'up', 'down' and 'distance' (dimensions) and of course 'style' and 'color'. Just downloaded and tested, looks nice. Small bug: It's called lomihi, but the arguments are placed middle/high/low. ok, i'll fix that ... (or maybe midlowhigh is nicer ?) For documentation/clarification, is the following correct? distance = extra kerning, distance between lomihi and preceding character. only with low, high an lohi up = how much the {hi} arg is raised down = how much the {low} arg is lowered indeed Support for the [left] keyword seems to have been dropped, but is still in the documentation comments. still there, only for lohi .. maybe we should add an align key some day Perhaps instead support align=..., and turn distance= into kernbefore= and kernafter=? Sorry about not knowing enough to implement it myself. hm, distance is often used for this so that's better I'll do 'align' when there is demand for it. Thanks for keeping the wiki so up to date. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \box0 to Lua
Ahoj! ···date: 2012-06-18, Monday···from: Procházka Lukáš Ing. - Pontex s. r. o.··· On Mon, 18 Jun 2012 16:56:56 +0200, Jaroslav Hajtmar hajt...@gyza.cz wrote: Ahoj... To bych ti rekl ... :-) tex.box[0].height ... To ale získáš jen výšku boxu, ne? Co když ten hbox chceš vysázet Luou na nějakou šířku? Na to budeš potřebovat node.hpack() (luatexref-t.pdf, s. 95). ···8··· \starttext foo \startluacode local newnode = node.new(node.idglyph) newnode.char = unicode.utf8.bytex newnode.font = font.current() -- won’t work before \starttext newnode.lang = tex.language --- second arg to node.hpack is width int local hbox= node.hpack(newnode, 2*newnode.width) node.write(hbox) \stopluacode bar \stoptext ···8··· The first argument is the head of a node list, the second can be the width in sp (or “spread”). See Patrick’s excellent tutorial: http://wiki.luatex.org/index.php/TeX_without_TeX to get started with node fun. (The \boxn registers are accessible as tex.box, see page 112 in the luatex manual.) Philipp L. J. Dne 18.6.2012 16:53, Procházka Lukáš Ing. - Pontex s. r. o. napsal(a): Hello, (my apologies if this message is duplicated - our mail server was out-of-order some time) how to call \box0 and \hbox to3cm{abc} by Lua? \startluacode context[[\box0]] % OK but a nicer way preferred, so keep on trying - context.box(0) % Error context.box{0} % Error context.box0 % Error context.hbox({to = cm}, abc) % Error \stopluacode TIA. Best regards, Lukas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments pgpRiHOKS9Ih4.pgp Description: PGP signature ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] nesting commands with optional arguments
Dear list, I have a question concerning nesting commands with optional arguments. I'm trying to put a command with an optional argument inside the optional argument of another one … For sure this is just a simple expansion problem but I have no clue how to handle this … Thanks for any hints! Daniel Please consider the following minimal example: \def\one{\dosingleempty\doOne} \def\doOne[#1]{% in 1st: \doifsomethingelse{#1}{#1}{no arg}\par% } \def\two{\dosingleempty\doTwo} \def\doTwo[#1]{% in 2nd: \doifsomethingelse{#1}{#1}{no arg}\par% } \def\three#1{in 3rd: #1\par} \starttext \one\two \blank \one[\three{myArg}] \blank \one[\two[Argument]] \stoptext This is what I get: ! Use of \doOne doesn't match its definition. system tex error on line 18 in file testOpt.tex: Use of ... \doifnextoptionalelse ...xt_optional_command_yes { #1}\def \next_optional_com... argument \two [Argument \doifsomethingelse #1-\edef \!!stringa {#1 }\ifx \!!stringa \empty \expandaf... \doOne [#1]-in 1st: \doifsomethingelse {#1} {#1}{no arg}\par l.18 \one[\two[Argument] ] ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] nesting commands with optional arguments
On 28-3-2012 16:49, Daniel Schopper wrote: Dear list, I have a question concerning nesting commands with optional arguments. I'm trying to put a command with an optional argument inside the optional argument of another one … For sure this is just a simple expansion problem but I have no clue how to handle this … Thanks for any hints! Daniel Please consider the following minimal example: \def\one{\dosingleempty\doOne} \def\doOne[#1]{% in 1st: \doifsomethingelse{#1}{#1}{no arg}\par% } \def\two{\dosingleempty\doTwo} \def\doTwo[#1]{% in 2nd: \doifsomethingelse{#1}{#1}{no arg}\par% } \def\three#1{in 3rd: #1\par} \starttext \one\two \blank \one[\three{myArg}] \blank \one[\two[Argument]] \stoptext \one[{\two[Argument]}] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] nesting commands with optional arguments
Of course, should have tried that … thanks! btw. since when is this working? (I tried it with a pretty old minimal from 2011-08, where I got this error) Am 28.03.12 16:51, schrieb Hans Hagen: On 28-3-2012 16:49, Daniel Schopper wrote: Dear list, I have a question concerning nesting commands with optional arguments. I'm trying to put a command with an optional argument inside the optional argument of another one … For sure this is just a simple expansion problem but I have no clue how to handle this … Thanks for any hints! Daniel Please consider the following minimal example: \def\one{\dosingleempty\doOne} \def\doOne[#1]{% in 1st: \doifsomethingelse{#1}{#1}{no arg}\par% } \def\two{\dosingleempty\doTwo} \def\doTwo[#1]{% in 2nd: \doifsomethingelse{#1}{#1}{no arg}\par% } \def\three#1{in 3rd: #1\par} \starttext \one\two \blank \one[\three{myArg}] \blank \one[\two[Argument]] \stoptext \one[{\two[Argument]}] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] UTF conversion via Lua
Hello Hans, thank you for the extension; I've tested and it works perfectly. On Thu, 16 Feb 2012 23:56:44 +0100, Hans Hagen pra...@wxs.nl wrote: regimes.toregime('8859-1',abcde Ä,?) but you'll have to test and wikify it. I'll going to wikify it - - I supppose: regimes.toregime(target-regime, text-to-convert, third-arg) so question - what is the third-argment used for? Maybe as default character when the UTF code cannot be mapped to target-regime? (It didn't happen in my case, so I can just estimate what third-arg is for.) Best regards, Lukas Hans -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] UTF conversion via Lua
On 17-2-2012 09:09, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello Hans, thank you for the extension; I've tested and it works perfectly. On Thu, 16 Feb 2012 23:56:44 +0100, Hans Hagen pra...@wxs.nl wrote: regimes.toregime('8859-1',abcde Ä,?) but you'll have to test and wikify it. I'll going to wikify it - - I supppose: regimes.toregime(target-regime, text-to-convert, third-arg) so question - what is the third-argment used for? Maybe as default character when the UTF code cannot be mapped to target-regime? yes (It didn't happen in my case, so I can just estimate what third-arg is for.) then you should make a test for it (just take some chinese character and see if it becomes a ?) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] How to make Figure captions justify if long?
Thanks by the answer, but I had already thought in this. I would like something more definitive. By the way, at http://wiki.contextgarden.net/Reference/en/setupcaptions I can see a command argument. I was wondering if a custom command can do the trick, but I don't know how I should use this arg and what it is for. -- Wagner Macedo On 8 February 2012 21:43, Marco net...@lavabit.com wrote: I don't know if I get you right, but I think you are talking about the width of the caption. It adaptes to the with of the figure. There is the “minwidth” parameter for \setupcaptions, but since the short captions will not be centred it's probably not what you aim for. I don't have a solution, but a workaround that alters the global width setting for an individual caption: ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] LuaTeX Function Arguments Variables Parameters List ConTeXt Lua \startluacode
Hi List, I am trying to program with Lua but there are concepts I must not understand, and the documentation is somewhat lacking. The only useful thing I could use is Hans' manual, thanks to him. If someone could help me just understanding the concept I must me missing in this simple example I would appreciate it. So here it is. Running the following code, variable a should not be modified by my function, and stay (1,2), but it does get modified and becomes (4,2) like the new variable b I am creating. What is wrong with my code ? Thank you for any hint ! Mathieu \starttext \startluacode function myFunc(arg) local var = arg var[1] = var[1] + 3 return var end local a = {1,2} context(a = \\{) context(a[1]) context(,\\;) context(a[2]) context(\\}\\par) context(\\blank) local b = myFunc(a) context(a = \\{) context(a[1]) context(,\\;) context(a[2]) context(\\}\\par) context(\\blank) context(b = \\{) context(b[1]) context(,\\;) context(b[2]) context(\\}\\par) \stopluacode \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] LuaTeX Function Arguments Variables Parameters List ConTeXt Lua \startluacode
Hi Mathieu, On 2012-01-27 19:06, Mathieu Dupont wrote: Hi List, Running the following code, variable a should not be modified by my function, and stay (1,2), but it does get modified and becomes (4,2) like the new variable b I am creating. Tables are references. Using the “local” keyword, you generate a local variable that still points to the original table. Instead, you need to (deep) copy the table explicitly. · \starttext \startluacode function myFunc(arg) local var = table.copy(arg) var[1] = var[1] + 3 return var end local a = {1,2} local b = myFunc(a) context.type(table.serialize(a)) context[[\par\blank]] context.type(table.serialize(b)) context[[\par\blank]] \stopluacode \stoptext \endinput · There’s also a function table.fastcopy(), see http://wiki.contextgarden.net/table_manipulation#table.fastcopy.28table_t.2C_.5Bboolean_meta.5D.29 Hth, Philipp What is wrong with my code ? Thank you for any hint ! Mathieu \starttext \startluacode function myFunc(arg) local var = arg var[1] = var[1] + 3 return var end local a = {1,2} context(a = \\{) context(a[1]) context(,\\;) context(a[2]) context(\\}\\par) context(\\blank) local b = myFunc(a) context(a = \\{) context(a[1]) context(,\\;) context(a[2]) context(\\}\\par) context(\\blank) context(b = \\{) context(b[1]) context(,\\;) context(b[2]) context(\\}\\par) \stopluacode \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments pgpEAMlmRkn38.pgp Description: PGP signature ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] float names and lists
Hi Otared, On Fri, 25 Nov 2011 09:11:05 -0700, Otared Kavian ota...@gmail.com wrote: By the way, you had a mistyping in your code: 2. \placelistoftablescws produces an undefined control sequence: What am I missing here? ………..^ … it should be \placelistoftablecws Then everything works as Wolfgang pointed out. Ah, u caught that ;-) OTOH it was only in my list post, once I added the plural arg here all works. Hans is adding criterium=component to the next beta :-) so in a way it's all moot, but it's been a very good exercise nonetheless. Best wishes Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shīʿī Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] float names and lists
On 25-11-2011 20:01, Idris Samawi Hamid ادريس سماوي حامد wrote: Hi Otared, On Fri, 25 Nov 2011 09:11:05 -0700, Otared Kavian ota...@gmail.com wrote: By the way, you had a mistyping in your code: 2. \placelistoftablescws produces an undefined control sequence: What am I missing here? ………..^ … it should be \placelistoftablecws Then everything works as Wolfgang pointed out. Ah, u caught that ;-) OTOH it was only in my list post, once I added the plural arg here all works. Hans is adding criterium=component to the next beta :-) so in a way it's all moot, but it's been a very good exercise nonetheless. It's probabaly already in the beta but it might be that the garden blocks this new feature till there is a proper wiki entry -) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] \unit and Hertz, lux, and degrees/minutes/seconds
Am 24.11.2011 um 13:36 schrieb robin.kirk...@csiro.au robin.kirk...@csiro.au: On Monday, 21 November 2011 20:52, Hans Hagen wrote: Over the weekend I've discovered a couple more problems with \unit so I'll make up some test cases and desired output and post it in a few days. ok, I'll wait for that then Hans, all, I attach a document (source and PDF) with some \unit test cases that don't currently work (even with the most recent beta). It also has a number of suggestions for improvement. Some of this should be construed as personal opinion, but hopefully it isn't too controversial. Nice summary, you should write a My Way about units once this things are fixed. A few comments from me: \type{1234}\tex{unit}\arg{m} should print equivalently to \tex{unit}\arg{1234m} and \tex{unit}\arg{1234 m}. (I have a lot of text that uses a \tex{unit} macro like that.) Maybe it’s possible with MkIV to check if the text before the \unit command was a number but of the number is part of the unit them put in the command, such things are always tricky with TeX and it’s better to force users to use proper input. Within \type{phys-dim.lua} all the units and all the prefixes seem to have capitalised names; in fact, they should be all lowercase (even when they are named after some person). The exception is Celsius. I think this is a feature because Hans saves also a lowercase version of all keywords and you can use both as input. I wonder whether \tex{unit} should only parse and format units, and have another macro \tex{quan} or \tex{quantity} to handle number+unit combinations (obviously using \tex{digit} and \tex{unit}). Please don’t suggest this, one of the nice features is that you don’t have to care which command you need but it would be nice to drop the old formatting options for \digits in the \unit command. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] References to annotations
I'm getting two unexpected results from references to annotations: 1. The numbering is different: \placeannotationnumber starts at 1, \in[ref] starts at 0 2. \atpage sometimes gives the page number and sometimes yields something surprising: as we show below (or above). That's nifty, but unexpected. Thank you. Michael Example - \usemodule[annotation] \defineannotation[Arg][alternative=command,number=yes,command=\ArgCommand,text=Argument] \define[2]\ArgCommand{ \startitemize[n] \placeannotationcontent \stopitemize \placeannotationtext\ \placeannotationnumber\ \placeannotationtitle } \starttext \startArg[title=An OK Argument,reference=OK] \item All men are mortal. \item Socrates is a man. \item Therefore, Socrates isn’t going to make it. \stopArg References to the first argument: \in{argument}[OK], \atpage[OK] References to the second argument: \in{argument}[NotOK], \atpage[NotOK] \page \startArg[title=A Bad Argument,reference=NotOK] \item Someone I don’t know called me. \item Barack Obama is someone I don’t know. \item Therefore, Barack Obama called me. \stopArg References to the second argument: \in{argument}[NotOK], \atpage[NotOK] References to the first argument: \in{argument}[OK], \atpage[OK] \stoptext - Results [page 1] 1. All men are mortal. 2. Socrates is a man. 3. Therefore, Socrates isn’t going to make it. Argument 1 An OK Argument References to the first argument: argument 0, at page 1 References to the second argument: argument 1, as we show below [page 2] 1. Someone I don’t know called me. 2. Barack Obama is someone I don’t know. 3. Therefore, Barack Obama called me. Argument 2 A Bad Argument References to the second argument: argument 1, at page 2 References to the first argument: argument 0, as we show above - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Finding values of the context macros inside Lua functions (=expansion inside Lua functions?)
Hello all, For several hours trying to find solutions of problem. My minimal example (I mention it at the end of email) for clear reasons show, that : 7 is not number. 7 is number. 7is not number. 7is not number. In the first is argument '\value' negotiable to the value, in second it is not possible (but for clear reasons too). I would need to find from argument ie macro '\\value' in the LUA function its numerical value. Is there any function that would do that? I need something as a function of context (...), which would, however, its output is not located into ConTeXt, but its result get to back to a Lua function or into variable. It is something like the expansion of an existing ConTeXt macro to its value. Thanx Jaroslav Here is my minimal example: \startluacode function test(arg) if type(arg)=='number' then context(arg.. is number.\\par ) else context(arg.. is not number.\\par) end if type(tonumber(arg))=='number' then context(arg.. is number.\\par ) else context(arg.. is not number.\\par) end end \stopluacode \starttext \def\value{7} \ctxlua{test('\value');} \blank[big] \ctxlua{test('\\value');} \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Finding values of the context macros inside Lua functions (=expansion inside Lua functions?)
Am 17.07.2011 um 14:01 schrieb Jaroslav Hajtmar: Hello all, For several hours trying to find solutions of problem. My minimal example (I mention it at the end of email) for clear reasons show, that : 7 is not number. 7 is number. 7is not number. 7is not number. In the first is argument '\value' negotiable to the value, in second it is not possible (but for clear reasons too). I would need to find from argument ie macro '\\value' in the LUA function its numerical value. Is there any function that would do that? I need something as a function of context (...), which would, however, its output is not located into ConTeXt, but its result get to back to a Lua function or into variable. It is something like the expansion of an existing ConTeXt macro to its value. \startluacode function test(arg) -- use thirddata namespace for real functions if type(tonumber(arg)) == number then if tonumber(arg) 0 then context(The argument \\quotation{%s} is a positive number,arg) else context(The argument \\quotation{%s} is a negative number,arg) end else context(The argument \\quotation{%s} is a string.,arg) end end \stopluacode \starttext \ctxlua{test(7)} \ctxlua{test(-4)} \ctxlua{test(text)} \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Finding values of the context macros inside Lua functions (=expansion inside Lua functions?)
Thanx Wolfgang. But I guess I was wrong to express.. I need to pass parameter '\\macroI' to the function and turn it up a inside luafunction expand to its value. Ie when \def\macroI{6} Then I need when I make in your example \ctxlua{test(\\macroI)} get the result : The argument “6” is a positive number and not result The argument “6” is a string. see: I modify your example : \startluacode function test(arg) -- use thirddata namespace for real functions if type(tonumber(arg)) == number then if tonumber(arg) 0 then context(The argument \\quotation{%s} is a positive number,arg) else context(The argument \\quotation{%s} is a negative number,arg) end else context(The argument \\quotation{%s} is a string.,arg) end end \stopluacode \starttext \ctxlua{test(7)} \ctxlua{test(-4)} \ctxlua{test(text)} \def\macroI{6} \ctxlua{test(\macroI)} \ctxlua{test(\\macroI)} \stoptext Dne 17.7.2011 14:19, Wolfgang Schuster napsal(a): Am 17.07.2011 um 14:01 schrieb Jaroslav Hajtmar: Hello all, For several hours trying to find solutions of problem. My minimal example (I mention it at the end of email) for clear reasons show, that : 7 is not number. 7 is number. 7is not number. 7is not number. In the first is argument '\value' negotiable to the value, in second it is not possible (but for clear reasons too). I would need to find from argument ie macro '\\value' in the LUA function its numerical value. Is there any function that would do that? I need something as a function of context (...), which would, however, its output is not located into ConTeXt, but its result get to back to a Lua function or into variable. It is something like the expansion of an existing ConTeXt macro to its value. \startluacode function test(arg) -- use thirddata namespace for real functions if type(tonumber(arg)) == number then if tonumber(arg) 0 then context(The argument \\quotation{%s} is a positive number,arg) else context(The argument \\quotation{%s} is a negative number,arg) end else context(The argument \\quotation{%s} is a string.,arg) end end \stopluacode \starttext \ctxlua{test(7)} \ctxlua{test(-4)} \ctxlua{test(text)} \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Finding values of the context macros inside Lua functions (=expansion inside Lua functions?)
Am 17.07.2011 um 15:10 schrieb Jaroslav Hajtmar: then it's not for me very good news, because I thus probably not my module to process only at the Lua language ... You can’t expand macro from Lua but the following is possible: \startluacode values = { I = 1, II = 2, } function test(arg) if string.find(arg,\\macro) then arg = string.gsub(arg,\\macro,) if values[arg] then context(values[arg]) else context(Invalid index.) end else context(Invalid command.) end end \stopluacode \starttext \starttabulate \NC \type{\macroI} \EQ \ctxlua{test(\\macroI)} \NC\NR \NC \type{\macroII} \EQ \ctxlua{test(\\macroII)} \NC\NR \NC \type{\macroIII} \EQ \ctxlua{test(\\macroIII)} \NC\NR \NC \type{\foo} \EQ \ctxlua{test(\\foo)} \NC\NR \stoptabulate \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Finding values of the context macros inside Lua functions (=expansion inside Lua functions?)
Thanx Wolfgang. It is a good example, which I will definitely come in handy sometimes, but unfortunately I can not help my problem to solve. Once again, many thanks Jaroslav Dne 17.7.2011 15:40, Wolfgang Schuster napsal(a): You can’t expand macro from Lua but the following is possible: \startluacode values = { I = 1, II = 2, } function test(arg) if string.find(arg,\\macro) then arg = string.gsub(arg,\\macro,) if values[arg] then context(values[arg]) else context(Invalid index.) end else context(Invalid command.) end end \stopluacode \starttext \starttabulate \NC \type{\macroI} \EQ \ctxlua{test(\\macroI)} \NC\NR \NC \type{\macroII} \EQ \ctxlua{test(\\macroII)} \NC\NR \NC \type{\macroIII} \EQ \ctxlua{test(\\macroIII)} \NC\NR \NC \type{\foo} \EQ \ctxlua{test(\\foo)} \NC\NR \stoptabulate \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] [beta] grid head
Hi Hans, the new beta appears to modify the behaviour of long headings on the grid. In the following example the chapter head moves up into the page header which it did not prior to the update (cf. mkii’s behaviour): · \setuppapersize[A5][A5] \setuplayout[grid=verystrict] \setupheadertexts[{Blindtext}][{\tfb\bf \pagenumber}] \setuphead[chapter][ style=\WORD, grid=yes, ] \starttext \chapter {This is supposed to mimick a rather long chapter title as is common in German language environments; shorter titles might not look as natural as longer ones} \dorecurse{5}{\input dawkins\par} \stoptext \endinput · Gridless it works ok. I’d just like to know whether this is to be taken as a bug or as a feature. Thanks a lot, Philipp On 2011-07-13 22:50:42, Hans Hagen wrote: Hi, I uploaded a beta: - Project structure related files are now dealt with in lua: it's mostly compatible but somewhat more strict (proper push and pop). In the log file the used structure is summarized. - All writing from lua to tex is now under control of the cld infrastructure. This means that logging is more complete. The speed penalty is neglectable and in some places faster. - There are a couple of fixes related to marks. - There are a couple of fixes (thanks to Wolfgang, who checks all commands as part of the user interface (setups) documentation). - In \asciimode, %% now can be used as traditional tex comment starter. Also, modules and environments are loaded under the normal catcode regime. - Typing gets frontstripped with the number of spaces in front of \stoptyping so that one can have nicely formatted input like: \startitemize \startitem test \starttyping test \stoptyping \stopitem \stopitemize - Entities in xml mode have a slightly different roundtrip treatment now and hopefully Thomas S as well as Hans vd M files still work ok. - Unicode math variants (supported by xits) are supported: \mathematics { \utfchar{2229} = \utfchar{2229}\utfchar{FE00} = \vsone{\utfchar{2229}} } - Defining commands at the lua end now also handles arg only cases and has better tracing. - Some other other things, like \startlayout[page] ... \stoplayout and whatever I forgot. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments pgp2r74FN1BGv.pgp Description: PGP signature ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] beta
On 07/13/2011 10:50 PM, Hans Hagen wrote: Hi, I uploaded a beta: - Project structure related files are now dealt with in lua: it's mostly compatible but somewhat more strict (proper push and pop). In the log file the used structure is summarized. - All writing from lua to tex is now under control of the cld infrastructure. This means that logging is more complete. The speed penalty is neglectable and in some places faster. - There are a couple of fixes related to marks. - There are a couple of fixes (thanks to Wolfgang, who checks all commands as part of the user interface (setups) documentation). - In \asciimode, %% now can be used as traditional tex comment starter. Also, modules and environments are loaded under the normal catcode regime. - Typing gets frontstripped with the number of spaces in front of \stoptyping so that one can have nicely formatted input like: \startitemize \startitem test \starttyping test \stoptyping \stopitem \stopitemize - Entities in xml mode have a slightly different roundtrip treatment now and hopefully Thomas S as well as Hans vd M files still work ok. - Unicode math variants (supported by xits) are supported: \mathematics { \utfchar{2229} = \utfchar{2229}\utfchar{FE00} = \vsone{\utfchar{2229}} } - Defining commands at the lua end now also handles arg only cases and has better tracing. - Some other other things, like \startlayout[page] ... \stoplayout and whatever I forgot. Hans Hi Hans, my xml files seem to run OK (I just did a few experiments). However, there is a problem with the new project structure code. My book project is set up like a proper ConTeXt project, and with the new version, context has lost the ability to compile single components. context mycomponent will compile the entire document, and then append the single mycomponent at the end of the document. That can't be right... Thomas ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt
Thanx very much Hans and Wolfgang too, I converted ALL my ConTeXt definitions (macros) with fixed numbers of parameters by using yours method - ie: interfaces.definecommand { name = , macro = ., arguments = { { content, string }, { content, string }, }, } It is great and very easy - thanx. Now I want convert rest of definitions (macros) - they have varied numbers of parameters. Is there any similar way to do it? Suffice it to indicate how. Thanx Jaroslav To show what macros I want to convert, I mention these examples: \def\opencsvfile{% \dosingleempty\doopencsvfile% } \def\doopencsvfile[#1]{% \dosinglegroupempty\dodoopencsvfile } \def\dodoopencsvfile#1{% \iffirstargument \ctxlua{thirddata.scancsv.opencsvfile(#1)} \else \ctxlua{thirddata.scancsv.opencsvfile()} \fi } or other macro etc: % \doloopaction % implicit use \lineaction macro % \doloopaction{\action} % use \action macro for all lines % \doloopaction{\action}{4} % use \action macro for first 4 lines % \doloopaction{\action}{2}{5} % use \action macro for lines from 2 to 5 \def\doloopaction{\dotriplegroupempty\doloopAction} \def\doloopAction#1#2#3{% \opencsvfile% \doifsomethingelse{#3}{%3 args. \doloopfromto{#2}{#3}{#1}% if 3 arguments then do #1 macro from #2 line to #3 line }{% \doifsomethingelse{#2}{%2 args. \doloopfromto{1}{#2}{#1}% if 2 arguments then do #1 macro for first #2 lines }% {\doifsomethingelse{#1}{% 1 arg. \doloopfromto{-1}{-1}{#1}% }{% if without arguments then do \lineaction macro for all lines \doloopfromto{-1}{-1}{\lineaction}% }% }% }% }% Dne 13.7.2011 16:33, Wolfgang Schuster napsal(a): Am 13.07.2011 um 16:09 schrieb Jaroslav Hajtmar: Thanx Wolfgang, It looks very interesting... It can be used this method for example for macro definitions? It depends what you want to achieve, while you try to create many commands in the form \MacroXXX where each command contains some content i define only one command which takes the content only when requested. When I will return to the subject of this mail: Can also be used for the council said Hans macros with multiple parameters? For example macros without parameter is no problem: context.setvalue('printline',calling.luafunction(),tex.par) I assume that for a more parameters cannot be used context.setvalue (...) .. But how to use multiple parameters when defining the macro as follows: context([[\\def\\paramcontrol#1#2{%s}]],thirddata.scancsv.paramcontrol('#1', '#2')) Look into cldf-int.lua where you can see a method to create TeX commands without optional arguments from Lua. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt
Hello all. It is GREAT! Thanx Hans and Wolfgang too. It is very instructive and inspiring for me... I was looking for something similar for a long time, but I have not found anything (not even in the CLD-MKIV and others ...). Finally, after yours reply to this email find something in the ctx-man.pdf from 1997 year :-). But I have a few questions and comments on this subject: 1. Is there any possibility to do anything similar with counters, dimensions etc? I trying but without success. For example: context.newcount(mycounter) or context.newcounter(mycounter) context.mycounter=5 etc. or it must be realized by classical way: context('\\newcount\\mycounter') context('\\mycounter=10') context('\\advance\\mycounter by5') context('\\the\\mycounter') similary with \newdimen, \newif etc... 2. Any person interested in using context.setvalue{Mymacro,somevalue) and context([[\def\MyMacro#1{#1}]]) syntaxes I have pointed out that the second syntax only operates when the command is given in a separate LUA file (ie file.lua) (ie not within an environment \startluacode - \stopluacode in classical TEX file!!!). Hans told me once that it is the individual categories of characters (backslash??) (if I remember correctly). First syntax works perfectly in LUA and TeX files too. Here I have a question. Why not comment out this case in TEX file? \startluacode -- context([[\def\macro#1{#1}]]) \stopluacode I get error: ! Undefined control sequence. -- context([[\def \macro #1{#1}]]) \dodostartluacode ...and \directlua \zerocount {#1 }} l.25 \stopluacode ? That category characters again? Comment character -- works differently in TEX file, and otherwise in the LUA file? Ie. comment on the backslash? 3. Wolfgang write about using context command \convertnumber{R}{1400} and the corresponding syntax: context.convertnumber(R,1400) to roman converting. It is great, but I could not figure out how to use in combination with the above syntax (ie use case context.command) or find the appropriate conversion LUA function (I did not use a custom function). Is there any way to do something like that: context([[\def\Macro%s{Macro%s}]],context.convertnumber(R,1400),1400) ??? ie. TEX command is used as a LuaTeX parameter? Thanx Jaroslav Dne 12.7.2011 17:43, Hans Hagen napsal(a): On 12-7-2011 5:30, Jaroslav Hajtmar wrote: But someone advised me that I use the better syntax: context('\\def\\Mymacro\{arg of mymacro\}') or context(\\def\\test#1{#1}) etc... whatever you like best context.setvalue{Mymacro,somevalue) context([[\def\MyMacro#1{#1}]]) Exist other (best or most optimal) way to do? for i = 1, 10 do tex.sprint(tex.ctxcatcodes,'\\def\\macro'..ar2rom(i)..'\{macro '..i..'\}') context('\\def\\Macro'..ar2rom(i)..'\{Macro '..i..'\}') end for i = 1, 10 do context([[\def\Macro%s{Macro%s}]],ar2rom(i),i) end When more than one argument is given, the context command treats the first argument as format template. By using the context command you can see what happens with \enabletrackers[context.trace] Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] beta
Hi, I uploaded a beta: - Project structure related files are now dealt with in lua: it's mostly compatible but somewhat more strict (proper push and pop). In the log file the used structure is summarized. - All writing from lua to tex is now under control of the cld infrastructure. This means that logging is more complete. The speed penalty is neglectable and in some places faster. - There are a couple of fixes related to marks. - There are a couple of fixes (thanks to Wolfgang, who checks all commands as part of the user interface (setups) documentation). - In \asciimode, %% now can be used as traditional tex comment starter. Also, modules and environments are loaded under the normal catcode regime. - Typing gets frontstripped with the number of spaces in front of \stoptyping so that one can have nicely formatted input like: \startitemize \startitem test \starttyping test \stoptyping \stopitem \stopitemize - Entities in xml mode have a slightly different roundtrip treatment now and hopefully Thomas S as well as Hans vd M files still work ok. - Unicode math variants (supported by xits) are supported: \mathematics { \utfchar{2229} = \utfchar{2229}\utfchar{FE00} = \vsone{\utfchar{2229}} } - Defining commands at the lua end now also handles arg only cases and has better tracing. - Some other other things, like \startlayout[page] ... \stoplayout and whatever I forgot. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Optimal way to defining of macros in Luacode in ConTeXt
Hello ConTeXist. How best (optimally) in Lua code in ConTeXt define own ConTeXt macros? I was used recently LuaTeX syntax (for example) : tex.sprint(tex.ctxcatcodes,'\\def\\mymacro\{arg of mymacro\}') But someone advised me that I use the better syntax: context('\\def\\Mymacro\{arg of mymacro\}') or context(\\def\\test#1{#1}) etc... Exist other (best or most optimal) way to do? for example something like: context.def.mymacro(first arg, sec arg:) (which of course does not work ...) Thanx Jaroslav My example: \startluacode function ar2rom(arnum) -- Convert Arabic numbers to Roman. Used for numbering column in the TeX macros local romans = {{1000, M}, {900, CM}, {500, D}, {400, CD}, {100, C}, {90, XC}, {50, L}, {40, XL}, {10, X}, {9, IX}, {5, V}, {4, IV}, {1, I} } local romnum='' for _, v in ipairs(romans) do -- create of the Roman numbers val, let = unpack(v) while arnum = val do arnum = arnum - val romnum=romnum..let end end return romnum end for i = 1, 10 do tex.sprint(tex.ctxcatcodes,'\\def\\macro'..ar2rom(i)..'\{macro '..i..'\}') context('\\def\\Macro'..ar2rom(i)..'\{Macro '..i..'\}') end tex.sprint(tex.ctxcatcodes,'\\def\\mymacro\{arg of mymacro\}') context('\\def\\Mymacro\{arg of Mymacro\}') \stopluacode \starttext \macroI, \MacroI \macroII, \MacroII etc ... \macroIX, \MacroIX \macroX, \MacroX \Mymacro, \mymacro \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt
On 12-7-2011 5:30, Jaroslav Hajtmar wrote: But someone advised me that I use the better syntax: context('\\def\\Mymacro\{arg of mymacro\}') or context(\\def\\test#1{#1}) etc... whatever you like best context.setvalue{Mymacro,somevalue) context([[\def\MyMacro#1{#1}]]) Exist other (best or most optimal) way to do? for i = 1, 10 do tex.sprint(tex.ctxcatcodes,'\\def\\macro'..ar2rom(i)..'\{macro '..i..'\}') context('\\def\\Macro'..ar2rom(i)..'\{Macro '..i..'\}') end for i = 1, 10 do context([[\def\Macro%s{Macro%s}]],ar2rom(i),i) end When more than one argument is given, the context command treats the first argument as format template. By using the context command you can see what happens with \enabletrackers[context.trace] Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt
Am 12.07.2011 um 17:30 schrieb Jaroslav Hajtmar: Hello ConTeXist. How best (optimally) in Lua code in ConTeXt define own ConTeXt macros? I was used recently LuaTeX syntax (for example) : tex.sprint(tex.ctxcatcodes,'\\def\\mymacro\{arg of mymacro\}') But someone advised me that I use the better syntax: context('\\def\\Mymacro\{arg of mymacro\}') or context(\\def\\test#1{#1}) etc... Exist other (best or most optimal) way to do? You can use “context.setvalue”. To convert numbers in different formats you can use the \convertnumber command. \starttext \startluacode context.setvalue(One,1) context.setvalue(Two,2) \stopluacode \define\Three{3} \One:\Two:\Three \blank \startluacode context.define({2},\\CMDA,[One:#1,Two:#2]) \stopluacode \define[2]\CMDB{[One:#1,Two:#2]} \CMDA{1}{2} \CMDB{1}{2} \blank \convertnumber{R}{1400} \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Umathquad again - lots of mktexlsr errors
On Mon, Jun 27, 2011 at 10:38 PM, Hans Hagen pra...@wxs.nl wrote: On 27-6-2011 8:42, Hans van der Meer wrote: Ok, thanks. I understand the mktexlsr stuff is nothing serious. it looks like mktexlsr has a bug - when run with on windows it tries to hash / - when run on linux with it loops any unknown path does this so, i think that maybe when there is an empty path given or in the texmf spec, that this problem surfaces Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ imo, a shift is missed From line 73 of mktexlsr, look at # ADD THIS below # A copy of some stuff from mktex.opt, so we can run in the presence of # terminally damaged ls-R files. while test $# -gt 0; do if test x$1 = x--help || test x$1 = x-help; then echo $usage exit 0 elif test x$1 = x--version || test x$1 = x-version; then echo `basename $0` $version kpsewhich --version exit 0 elif test x$1 = x--verbose || test x$1 = x-verbose; then verbose=true elif test x$1 = x--dry-run || test x$1 = x-n; then dry_run=true elif test x$1 = x--quiet || test x$1 = x--silent \ || test x$1 = x-quiet || test x$1 = x-silent ; then verbose=false elif test x$1 = x--; then : elif echo x$1 | grep '^x-' /dev/null; then echo $progname: unknown option \`$1', try --help if you need it. 2 exit 1 else if test ! -d $1; then echo $progname: $1: not a directory, skipping. 2 shift ## ADD THIS, otherwise a loop continue fi # By saving the argument in a file, we can later get it back while # supporting spaces in the name. This still doesn't support # newlines in the directory names, but nobody ever complains about # that, and it seems much too much trouble to use \0 terminators. (umask 077 if echo $1 $treefile; then :; else echo $progname: $treefile: could not append to arg file, goodbye. 2 exit 1 fi ) fi shift done -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___