summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-sid.mkiv
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-18 22:52:45 +0000
committerKarl Berry <karl@freefriends.org>2015-04-18 22:52:45 +0000
commit16aa5a7c87f18a2483d0d61795899f886781b51c (patch)
tree1d72f00b2a4185425393598402fe055c61d1de58 /Master/texmf-dist/tex/context/base/page-sid.mkiv
parente68dc4d5506d46bf72823234f902bc76d1f70352 (diff)
context, from www.pragma-ade.com/context/beta/cont-tmf.zip (18apr15)
git-svn-id: svn://tug.org/texlive/trunk@36923 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-sid.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/page-sid.mkiv101
1 files changed, 85 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-sid.mkiv b/Master/texmf-dist/tex/context/base/page-sid.mkiv
index f7a2357bf34..cbdb95fc371 100644
--- a/Master/texmf-dist/tex/context/base/page-sid.mkiv
+++ b/Master/texmf-dist/tex/context/base/page-sid.mkiv
@@ -15,21 +15,18 @@
\unprotect
-% These macro deal with side floats. We started with Daniel
-% Comenetz macros as published in TUGBoat Volume 14 (1993),
-% No.\ 1: Anchored Figures at Either Margin. I extended and
-% patched the macros to suite our needs which results in a
-% messy module. Therefore, this module badly needs an update
-% because it's now a mixture of old and new macros.
+% These macro deal with side floats. We started with Daniel Comenetz macros as published
+% in TUGBoat Volume 14 (1993), No.\ 1: Anchored Figures at Either Margin. I extended and
+% patched the macros to suite our needs which results in a messy module. Therefore, this
+% module badly needs an update because it's now a mixture of old and new macros.
% Interesting cases where it goes wrong:
%
% \placefigure[left]{}{} \dorecurse{3}{\input ward } {\par} \input ward
%
-% Here we get an unwanted carried over hangindent and parindent. A
-% solution is to associate it with the local par node instead. This
-% is something to discuss with Taco as it could be a new luatex
-% feature: explicitly set par properties.
+% Here we get an unwanted carried over hangindent and parindent. A solution is to associate
+% it with the local par node instead. This is something to discuss with Taco as it could be
+% a new luatex/mkiv feature: explicitly set par properties.
% Maybe I should just rewrite the lot.
@@ -202,17 +199,72 @@
\global\setfalse\c_page_sides_short
\global\setfalse\c_page_sides_flag}
+\unexpanded\def\doifelsesidefloat
+ {\par
+ \ifnum\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\let\doifsidefloatelse\doifelsesidefloat
+
+% \def\page_sides_flush_floats_indeed
+% {\global\advance\d_page_sides_vsize-\d_page_sides_bottomskip
+% \begingroup
+% \let\page_sides_flush_floats\relax
+% \forgetall
+% \doloop
+% {\strut
+% \iftracesidefloats
+% \color[darkgray]{\ruledhbox{\strut\kern\d_page_sides_width}}%
+% \fi
+% \par
+% % \ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
+% \ifdim\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax>\zeropoint
+% \ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles
+% \exitloop
+% \fi
+% \else
+% \exitloop
+% \fi}%
+% \endgroup
+% \ifdim\parskip>\zeropoint % why this test ?
+% \ifdim\d_page_sides_bottomskip>\parskip
+% % \nowhitespace
+% % \vskip\d_page_sides_bottomskip
+% \blank[\v!nowhite,\the\dimexpr\d_page_sides_bottomskip]
+% \fi
+% \else
+% \blank[\the\d_page_sides_bottomskip]% new, so needs checking
+% \fi}
+
+\installcorenamespace{sidefloatsteps}
+
+\setvalue{\??sidefloatsteps\v!line }{\strut}
+\setvalue{\??sidefloatsteps\v!big }{\strut}
+\setvalue{\??sidefloatsteps\v!medium}{\halfstrut}
+\setvalue{\??sidefloatsteps\v!small }{\quarterstrut}
+\setvalue{\??sidefloatsteps\v!depth }{\depthstrut}
+
+% we don't officially know what kind of float we flush
+
\def\page_sides_flush_floats_indeed
{\global\advance\d_page_sides_vsize-\d_page_sides_bottomskip
\begingroup
\let\page_sides_flush_floats\relax
+ \edef\m_pages_strut{\executeifdefined{\??sidefloatsteps\rootfloatparameter\c!step}\strut}%
\forgetall
\doloop
- {\strut
- \iftracesidefloats
- \color[darkgray]{\ruledhbox{\strut\kern\d_page_sides_width}}%
+ {\iftracesidefloats
+ \dontleavehmode
+ \ruledhbox{\m_pages_strut\kern\d_page_sides_width}%
+ \else
+ \m_pages_strut
\fi
\par
+ \nointerlineskip
+ % \ifdim\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax>\zeropoint
\ifdim\dimexpr\d_page_sides_vsize-\pagetotal\relax>\zeropoint
\ifnum\recurselevel>\plushundred % safeguard, sort of deadcycles
\exitloop
@@ -223,11 +275,28 @@
\endgroup
\ifdim\parskip>\zeropoint % why this test ?
\ifdim\d_page_sides_bottomskip>\parskip
- \nowhitespace
- \vskip\d_page_sides_bottomskip
+ % \nowhitespace
+ % \vskip\d_page_sides_bottomskip
+% \blank[\v!nowhite,\the\dimexpr\d_page_sides_bottomskip]
+ \blank[\v!nowhite,\rootfloatparameter\c!sidespaceafter]
\fi
+ \else
+% \blank[\the\d_page_sides_bottomskip]% new, so needs checking
+ \blank[\rootfloatparameter\c!sidespaceafter]% new, so needs checking
\fi}
+% alternative method (unsnapped)
+%
+% \def\page_sides_flush_floats_indeed
+% {\scratchdimen\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax
+% \ifdim\parskip>\zeropoint % why this test ?
+% \ifdim\scratchdimen>\parskip
+% \blank[\v!nowhite,\the\scratchdimen] % better in stages
+% \fi
+% \else
+% \blank[\the\scratchdimen]
+% \fi}
+
\def\page_sides_check_floats_after_par
{\page_sides_check_floats_indeed
\ifdim\oldpagetotal=\pagetotal \else
@@ -764,7 +833,7 @@
\def\checksidefloat {\page_sides_check_floats}
\def\flushsidefloats {\page_sides_flush_floats}
\def\flushsidefloatsafterpar{\page_sides_flush_floats_after_par}
-%def\forgetsidefloats {\page_sides_forget_floats}
+\def\forgetsidefloats {\page_sides_forget_floats}
%def\synchronizesidefloats {\page_sides_synchronize_floats}
\protect \endinput