diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-11-24 15:29:57 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-11-24 15:29:57 +0100 |
commit | 4f3937859f3619e397cf38e220e59eb26ade73e2 (patch) | |
tree | 398dd98cd403521c016a40bedd2a87124a4da4dc /doc/context/sources/general/manuals/math/math-fonts-helpers.tex | |
parent | 8d75b6caf54310bf17db7e5a9d91939fe97c4036 (diff) | |
download | context-4f3937859f3619e397cf38e220e59eb26ade73e2.tar.gz |
2021-11-24 15:18:00
Diffstat (limited to 'doc/context/sources/general/manuals/math/math-fonts-helpers.tex')
-rw-r--r-- | doc/context/sources/general/manuals/math/math-fonts-helpers.tex | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/doc/context/sources/general/manuals/math/math-fonts-helpers.tex b/doc/context/sources/general/manuals/math/math-fonts-helpers.tex new file mode 100644 index 000000000..7d52c2a7f --- /dev/null +++ b/doc/context/sources/general/manuals/math/math-fonts-helpers.tex @@ -0,0 +1,83 @@ +\starttexdefinition OneMathSample #1#2 + \startcontent + \switchtobodyfont[#1] + \framed[align=middle,offset=2ex,corner=round,rulethickness=1pt,framecolor=darkred] \bgroup + \getbuffer[#2]% + \blank[back] + \egroup + \stopcontent + \startcaption + \tt\tfb\color[darkred]{#1} + \stopcaption +\stoptexdefinition + +\startluacode + local default = { + "cambria", + "modern", + -- "modernlatin", + "dejavu", + "pagella", + "termes", + "bonum", + "schola", + "lucidadk", + -- "xits", + "stixtwo", + "libertinus", + "ebgaramond", + "kpfonts", + -- "minion", + -- "asana" + } + + function document.MathSamples(list,samples) + list = string.strip(list) + samples = string.strip(samples) + local s = list ~= "" and utilities.parsers.settings_to_array(list) or default + local n = #s + if s[n] == "" then + n = n - 1 + end + local m = n % 4 + local x = 4 + local y = n // 4 + if m > 0 then + x = x + 1 + end + -- for i=1,n do + -- context.usebodyfont { s[i] } + -- end +-- context.startTEXpage { offset = "2ex" } + context.startcombination { nx = x, ny = y, location = "top", distance = "2ex", after = "\\blank[2*big]" } + for i=1,n do + context.OneMathSample(s[i],samples) + end + context.stopcombination() +-- context.stopTEXpage() + end +\stopluacode + +\protected\def\MathSamples[#1]#*[#2]% + {\ctxlua{document.MathSamples("#1","#2")}} + +\def\DoShowNextBox + {\begingroup + \dowithnextbox + {\showboxinbuffer{mathbox}\nextbox\plusone + \midaligned{\framed{\box\nextbox}}% + \switchtobodyfont[4pt] + \typebuffer[mathbox][option=TEX]% + \endgroup + \endgroup}% + \hbox} + +\protected\def\StartShowBox + {\begingroup + \protected\def\StopShowBox{\removeunwantedspaces\egroup}% + \DoShowNextBox + \bgroup\ignorespaces} + +\protected\def\ShowBox + {\begingroup + \DoShowNextBox} |