summaryrefslogtreecommitdiff
path: root/tex/context/base/page-col.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-07-04 12:00:14 +0300
committerMarius <mariausol@gmail.com>2012-07-04 12:00:14 +0300
commit895f68ef1727ec31a51ef8799e2bf576ea7642d0 (patch)
treebaec5079e7fd9febeee6c1cb257b064a46fe665b /tex/context/base/page-col.mkiv
parentbb0eac07417aec9a0da32a54fbdad4553cebcce7 (diff)
downloadcontext-895f68ef1727ec31a51ef8799e2bf576ea7642d0.tar.gz
beta 2012.07.04 10:42
Diffstat (limited to 'tex/context/base/page-col.mkiv')
-rw-r--r--tex/context/base/page-col.mkiv75
1 files changed, 39 insertions, 36 deletions
diff --git a/tex/context/base/page-col.mkiv b/tex/context/base/page-col.mkiv
index 87591e336..3143cadd2 100644
--- a/tex/context/base/page-col.mkiv
+++ b/tex/context/base/page-col.mkiv
@@ -13,22 +13,23 @@
\writestatus{loading}{ConTeXt Page Macros / Column Helpers}
-%D Here we implement a couple of helpers for dealing with
-%D columns. For the moment we keep the names.
+%D Here we implement a couple of helpers for dealing with columns. For
+%D the moment we keep the names. When the mul and set modules are redone
+%D these can be adapted or disappear.
\unprotect
-%D The next two registers can be used to store pre column
-%D material as well as footnotes or so.
+%D The next two registers can be used to store pre column material as well
+%D as footnotes or so.
\newbox\precolumnbox \newdimen\precolumnboxheight
\newbox\postcolumnbox \newdimen\postcolumnboxheight
-%D We reserve a counter for the number of columns as well as
-%D the current column. Both are not to be changed by users!
+%D We reserve a counter for the number of columns as well as the current
+%D column. Both are not to be changed by users!
-\newcount\nofcolumns \nofcolumns = 1
-\newcount\mofcolumns \mofcolumns = 1
+\newcount\nofcolumns \nofcolumns\plusone
+\newcount\mofcolumns \mofcolumns\plusone
\setnewconstant\maxnofcolumns 50
\setnewconstant\allocatednofcolumns 0
@@ -38,14 +39,13 @@
\newdimen\finalcolumnheights
\newcount\finalcolumnlines
-%D This register can be used as a temporary storage for page
-%D content.
+%D This register can be used as a temporary storage for page content.
\newbox\restofpage
%D A few more (some might go away):
-\newif\ifintermediatefootnotes
+\newif\ifintermediatefootnotes % seems to be obsolete
\newif\ifcarryoverfootnotes %\carryoverfootnotestrue
\newif\iflastcolumnfootnotes %\lastcolumnfootnotestrue
\newif\ifbalancecolumns %\balancecolumnstrue
@@ -70,7 +70,6 @@
\newif\ifrecentercolumnbox \recentercolumnboxtrue
\newif\ifrerecentercolumnbox \rerecentercolumnboxtrue
-\newif\ifpackcolumnfloats \packcolumnfloatstrue
%D During initialization the temporary boxes are allocated.
%D This enables us to use as much columns as we want, without
@@ -80,7 +79,12 @@
%D Two sets of boxes are declared, the txtboxes are used for
%D the text, the topboxes are for moved column floats.
-\def\initializecolumns#1%
+\installcorenamespace{columntext}
+\installcorenamespace{columnfooter}
+\installcorenamespace{columntop}
+\installcorenamespace{columnbottom}
+
+\unexpanded\def\initializecolumns#1%
{\ifnum#1>\maxnofcolumns
\showmessage\m!columns1\maxnofcolumns
\nofcolumns\maxnofcolumns
@@ -90,11 +94,10 @@
\ifnum\nofcolumns>\allocatednofcolumns
\dorecurse\nofcolumns
{\ifnum\recurselevel>\allocatednofcolumns\relax
- % \newbox\next \letgvalue{\??zc-\recurselevel-t}=\next
- \expandafter\newbox\csname\??zc-\recurselevel-t\endcsname % text
- \expandafter\newbox\csname\??zc-\recurselevel-f\endcsname % foot
- \expandafter\newbox\csname\??zc-\recurselevel-h\endcsname % top insert
- \expandafter\newbox\csname\??zc-\recurselevel-l\endcsname % top insert
+ \expandafter\newbox\csname\??columntext \recurselevel\endcsname % text
+ \expandafter\newbox\csname\??columnfooter\recurselevel\endcsname % footer
+ \expandafter\newbox\csname\??columntop \recurselevel\endcsname % top insert
+ \expandafter\newbox\csname\??columnbottom\recurselevel\endcsname % bottom insert
\fi}%
\global\allocatednofcolumns\nofcolumns
\fi}
@@ -107,10 +110,10 @@
\def\currenttopcolumnbox {\columntopbox \mofcolumns}
\def\lasttopcolumnbox {\columntopbox \nofcolumns}
-\def\columntextbox #1{\csname\??zc-\number#1-t\endcsname}
-\def\columnfootbox #1{\csname\??zc-\number#1-f\endcsname}
-\def\columntopbox #1{\csname\??zc-\number#1-h\endcsname}
-\def\columnbotbox #1{\csname\??zc-\number#1-l\endcsname}
+\def\columntextbox #1{\csname\??columntext \number#1\endcsname}
+\def\columnfootbox #1{\csname\??columnfooter\number#1\endcsname}
+\def\columntopbox #1{\csname\??columntop \number#1\endcsname}
+\def\columnbotbox #1{\csname\??columnbottom\number#1\endcsname}
\def\columnsettextbox {\global\setbox\columntextbox}
\def\columnsetfootbox {\global\setbox\columnfootbox}
@@ -122,30 +125,30 @@
\def\columngettopbox {\copy\columntopbox}
\def\columngetbotbox {\copy\columnbotbox}
-\def\columnerasetextboxes{\dorecurse\allocatednofcolumns{\columnsettextbox\recurselevel\emptybox}}
-\def\columnerasefootboxes{\dorecurse\allocatednofcolumns{\columnsetfootbox\recurselevel\emptybox}}
-\def\columnerasetopboxes {\dorecurse\allocatednofcolumns{\columnsettopbox \recurselevel\emptybox}}
-\def\columnerasebotboxes {\dorecurse\allocatednofcolumns{\columnsetbotbox \recurselevel\emptybox}}
+\unexpanded\def\columnerasetextboxes{\dorecurse\allocatednofcolumns{\columnsettextbox\recurselevel\emptybox}}
+\unexpanded\def\columnerasefootboxes{\dorecurse\allocatednofcolumns{\columnsetfootbox\recurselevel\emptybox}}
+\unexpanded\def\columnerasetopboxes {\dorecurse\allocatednofcolumns{\columnsettopbox \recurselevel\emptybox}}
+\unexpanded\def\columnerasebotboxes {\dorecurse\allocatednofcolumns{\columnsetbotbox \recurselevel\emptybox}}
+
+%D Without going in details we present two macro's which handle the columns. The
+%D action which is transfered by the the first and only parameter can do something
+%D with \type {\currentcolumnbox}. In case of the mid columns, \type
+%D {\firstcolumnbox} and \type {\lastcolumnbox} are handled outside these macro's.
-%D Without going in details we present two macro's which handle
-%D the columns. The action which is transfered by the the first
-%D and only parameter can do something with \type
-%D {\currentcolumnbox}. In case of the mid columns, \type
-%D {\firstcolumnbox} and \type {\lastcolumnbox} are handled
-%D outside these macro's.
+%D If needed these can be sped up by using a dedicated loop macro.
-\def\dohandlecolumn#1%
+\unexpanded\def\dohandlecolumn#1%
{\mofcolumns\recurselevel
\let\currentcolumn\recurselevel
#1\relax}
-\def\dohandleallcolumns#1%
+\unexpanded\def\dohandleallcolumns#1%
{\dorecurse\nofcolumns{\dohandlecolumn{#1}}}
-\def\dohandlerevcolumns#1%
+\unexpanded\def\dohandlerevcolumns#1%
{\dostepwiserecurse\nofcolumns\plusone\minusone{\dohandlecolumn{#1}}}
-\def\dohandlemidcolumns#1%
+\unexpanded\def\dohandlemidcolumns#1%
{\dohandleallcolumns
{\ifnum\recurselevel>\plusone
\ifnum\recurselevel<\nofcolumns