summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mtx-context-common.tex
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
commit8d8d528d2ad52599f11250cfc567fea4f37f2a8b (patch)
tree94286bc131ef7d994f9432febaf03fe23d10eef8 /tex/context/base/mkiv/mtx-context-common.tex
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/base/mkiv/mtx-context-common.tex')
-rw-r--r--tex/context/base/mkiv/mtx-context-common.tex43
1 files changed, 43 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/mtx-context-common.tex b/tex/context/base/mkiv/mtx-context-common.tex
new file mode 100644
index 000000000..2db0a5be2
--- /dev/null
+++ b/tex/context/base/mkiv/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 ADE \& \CONTEXT\ Development Team}]
+%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) -- no, as we don't want to uppercase 'landscape'
+ 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