diff options
Diffstat (limited to 'tex/context/base/mtx-context-common.tex')
-rw-r--r-- | tex/context/base/mtx-context-common.tex | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tex/context/base/mtx-context-common.tex b/tex/context/base/mtx-context-common.tex new file mode 100644 index 000000000..8327dd28d --- /dev/null +++ b/tex/context/base/mtx-context-common.tex @@ -0,0 +1,43 @@ +%D \module +%D [ file=mtx-context-common, +%D version=2009.03.21, +%D title=\CONTEXT\ Extra Trickry, +%D subtitle=Common Stuff, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=\PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startluacode + local combination = document.arguments['combination'] or '2*2' + local nx, ny = string.match(combination,"^(%d+)%s*[%*x]%s*(%d+)$") + if not nx then + nx, ny = 2, 2 + elseif not ny then + nx = tonumber(combination) or 2 + ny = nx + else + nx = tonumber(nx) or 2 + ny = tonumber(ny) or nx or 2 + end + document.setargument("combination_nx",nx) + document.setargument("combination_ny",ny) +\stopluacode + +\startluacode + local paperformat = document.arguments['paperformat'] or 'A4*A4' + paperformat = string.upper(paperformat) + local f, t = string.match(paperformat,"^(.-)%s*[%*xX]%s*(.-)$") + if not f then + f, t = "A4", "A4" + elseif not t then + t = f + end + document.setargument("paperformat_paper",f) + document.setargument("paperformat_print",t) +\stopluacode + +\endinput |