summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/context/documents/general/manuals/luatex.pdfbin1006864 -> 1006863 bytes
-rw-r--r--doc/context/documents/general/manuals/math-mkiv.pdfbin1149224 -> 2866911 bytes
-rw-r--r--doc/context/sources/general/manuals/math/math-framing-001.tex113
-rw-r--r--doc/context/sources/general/manuals/math/math-mkiv.tex79
-rw-r--r--doc/context/sources/general/manuals/math/math-spacing-001.tex73
-rw-r--r--tex/context/base/context-version.pdfbin4253 -> 4245 bytes
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-otf.lua2
-rw-r--r--tex/context/base/mkiv/font-otl.lua10
-rw-r--r--tex/context/base/mkiv/math-ali.mkiv455
-rw-r--r--tex/context/base/mkiv/math-for.mkiv20
-rw-r--r--tex/context/base/mkiv/pack-rul.mkiv43
-rw-r--r--tex/context/base/mkiv/spac-chr.lua4
-rw-r--r--tex/context/base/mkiv/spac-chr.mkiv12
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9090 -> 9218 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin269052 -> 269049 bytes
-rw-r--r--tex/context/base/mkiv/strc-mat.mkiv27
-rw-r--r--tex/context/base/mkiv/supp-box.mkiv12
-rw-r--r--tex/context/interface/mkiv/i-common-argument.xml1
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin821076 -> 821219 bytes
-rw-r--r--tex/context/interface/mkiv/i-formula.xml9
-rw-r--r--tex/context/interface/mkiv/i-note.xml2
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60787 -> 60790 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua12
25 files changed, 734 insertions, 144 deletions
diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf
index ccb6b07a4..4a5d53202 100644
--- a/doc/context/documents/general/manuals/luatex.pdf
+++ b/doc/context/documents/general/manuals/luatex.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/math-mkiv.pdf b/doc/context/documents/general/manuals/math-mkiv.pdf
index eed4d598e..74bd9eedb 100644
--- a/doc/context/documents/general/manuals/math-mkiv.pdf
+++ b/doc/context/documents/general/manuals/math-mkiv.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/math/math-framing-001.tex b/doc/context/sources/general/manuals/math/math-framing-001.tex
new file mode 100644
index 000000000..5081b8ad2
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-framing-001.tex
@@ -0,0 +1,113 @@
+\setuplayout[topspace=5mm,bottomspace=5mm,height=middle,header=1cm,footer=0cm]
+
+\starttext
+
+\startbuffer[sample]
+ \enabletrackers[formulas.framed] \showboxes
+ \startformula
+ e = mc^2
+ \stopformula
+ \par
+ \startformula
+ e = mc^2
+ \stopformula
+ \startformula
+ e = mc^2
+ \stopformula
+ \startformula
+ e \dorecurse{12} { = mc^2 }
+ \stopformula
+ \startplaceformula
+ \startformula
+ e = mc^2
+ \stopformula
+ \stopplaceformula
+ \startplaceformula
+ \startformula
+ e \dorecurse{12} { = mc^2 }
+ \stopformula
+ \stopplaceformula
+\stopbuffer
+
+\startbuffer[setup-b]
+\setupformula
+ [option=frame]
+\stopbuffer
+
+\startbuffer[setup-d]
+\setupformulaframed
+ [frame=on,
+ %toffset=10pt,
+ %boffset=10pt,
+ foregroundcolor=white,
+ background=color,
+ backgroundcolor=gray]
+\stopbuffer
+
+\startbuffer[setup-c]
+\setupformula
+ [frame=number]
+\stopbuffer
+
+\startbuffer[all]
+\start
+ \typebuffer[setup-a]
+ \getbuffer[setup-a]
+ \getbuffer[sample]
+ \typebuffer[setup-b]
+ \typebuffer[setup-d]
+ \getbuffer[setup-b]
+ \getbuffer[setup-d]
+ \getbuffer[sample]
+ \typebuffer[setup-c]
+ \getbuffer[setup-c]
+ \getbuffer[sample]
+ \page
+\stop
+\stopbuffer
+
+\startbuffer
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushleft]
+ \stopbuffer
+ \getbuffer[all]
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushleft,location=left]
+ \stopbuffer
+ \getbuffer[all]
+
+ \startbuffer[setup-a]
+ \setupformula
+ [align=middle]
+ \stopbuffer
+ \getbuffer[all]
+ \startbuffer[setup-a]
+ \setupformula
+ [align=middle,location=left]
+ \stopbuffer
+ \getbuffer[all]
+
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushright]
+ \stopbuffer
+ \getbuffer[all]
+ \startbuffer[setup-a]
+ \setupformula
+ [align=flushright,location=left]
+ \stopbuffer
+ \getbuffer[all]
+\stopbuffer
+
+\getbuffer
+
+\startbuffer[setup-b]
+\setupformula
+ [option={tight,frame}]
+\stopbuffer
+
+\getbuffer
+
+\stoptext
diff --git a/doc/context/sources/general/manuals/math/math-mkiv.tex b/doc/context/sources/general/manuals/math/math-mkiv.tex
index 0148a8807..f16359fcb 100644
--- a/doc/context/sources/general/manuals/math/math-mkiv.tex
+++ b/doc/context/sources/general/manuals/math/math-mkiv.tex
@@ -606,8 +606,87 @@ We might add some more control in the future, but this is what you get:
\startlinecorrection \getbuffer \stoplinecorrection
+Framing a formula is also supported as a option, where the full power of framed can
+be applied to the formula. We will illustrate this in detail on the next pages. For this
+we use the following sample:
+
+\typefile{math-framing-001.tex}
+
+In \in {figure} [framing-flushleft], \in [framing-middle] \in {and}
+[framing-flushright] you see some combinations. You can run this example on your
+machine and see the details.
+
+\startplacefigure[location=page,reference=framing-flushleft,title={Framed formulas flushed left.}]
+ \startcombination[2*2]
+ {\typesetfile[math-framing-001.tex][page=01,height=.45\textheight]} {\tttf right + flushleft}
+ {\typesetfile[math-framing-001.tex][page=02,height=.45\textheight]} {\tttf right + flushleft}
+ {\typesetfile[math-framing-001.tex][page=07,height=.45\textheight]} {\tttf left + flushleft + tight}
+ {\typesetfile[math-framing-001.tex][page=08,height=.45\textheight]} {\tttf left + flushleft + tight}
+ \stopcombination
+\stopplacefigure
+
+\startplacefigure[location=page,reference=framing-middle,title={Framed formulas centered.}]
+ \startcombination[2*2]
+ {\typesetfile[math-framing-001.tex][page=03,height=.45\textheight]} {\tttf right + middle}
+ {\typesetfile[math-framing-001.tex][page=04,height=.45\textheight]} {\tttf right + middle}
+ {\typesetfile[math-framing-001.tex][page=09,height=.45\textheight]} {\tttf left + middle + tight}
+ {\typesetfile[math-framing-001.tex][page=10,height=.45\textheight]} {\tttf left + middle + tight}
+ \stopcombination
+\stopplacefigure
+
+\startplacefigure[location=page,reference=framing-flushright,title={Framed formulas flushed right.}]
+ \startcombination[2*2]
+ {\typesetfile[math-framing-001.tex][page=05,height=.45\textheight]} {\tttf right + flushright}
+ {\typesetfile[math-framing-001.tex][page=06,height=.45\textheight]} {\tttf right + flushright}
+ {\typesetfile[math-framing-001.tex][page=11,height=.45\textheight]} {\tttf left + flushright + tight}
+ {\typesetfile[math-framing-001.tex][page=12,height=.45\textheight]} {\tttf left + flushright + tight}
+ \stopcombination
+\stopplacefigure
+
\stopchapter
+With each formula class a framed variants is automatically created:
+
+\startbuffer
+\defineformula
+ [foo]
+
+\setupformulaframed
+ [foo]
+ [frame=on,
+ framecolor=red]
+
+\startfooformula[frame]
+ e=mc^2
+\stopfooformula
+\stopbuffer
+
+\typebuffer
+
+This time you get a red frame:
+
+\getbuffer
+
+You can also frame the number, as in:
+
+\startbuffer
+\setupformulaframed[framecolor=red,frame=on,offset=1ex]
+\setupformula[option=frame,color=blue]
+\setupformula[numbercommand={\inframed[framecolor=green]}]
+
+\startplaceformula
+ \startformula
+ 2 + 2 = 2x
+ \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer
+
+The boxes get properly aligned:
+
+\start \showboxes \getbuffer \stop
+
\stoptext
% when we compare these tables with the one that the ff loader produces we notice
diff --git a/doc/context/sources/general/manuals/math/math-spacing-001.tex b/doc/context/sources/general/manuals/math/math-spacing-001.tex
new file mode 100644
index 000000000..a0ccda449
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-spacing-001.tex
@@ -0,0 +1,73 @@
+\doifmodeelse {with-struts} {
+ \def\Line{\dontleavehmode{\showstruts\dorecurse{18}{x \strut x }}}
+} {
+ \def\Line{\dontleavehmode{\showstruts\dorecurse{18}{x x }}}
+}
+
+\setuplayout
+ [width=middle,
+ height=middle,
+ backspace=1mm,
+ topspace=1cm]
+
+\setupbodyfont
+ [17.3pt]
+
+\starttext
+
+\Line
+
+\startformula
+ x
+\stopformula
+
+\Line
+
+\startformula
+ y
+\stopformula
+
+\Line
+
+\startformula
+ \strut x
+\stopformula
+
+\Line
+
+\startformula \startalign
+ \NC c - a = \NC b \NR
+ \NC d + c - b = \NC a \NR
+\stopalign \stopformula
+
+\Line
+
+\startformula \startalign
+ \NC c - a = \NC b \NR
+ \NC d + c - b = \NC a \NR
+\stopalign \stopformula
+
+\Line
+
+\startformula
+\mframed
+ [offset=1mm,loffset=3mm,roffset=3mm] {
+ a + b = c
+ }
+\stopformula
+
+\Line
+
+\startformula
+\mframed
+ [offset=1mm,loffset=3mm,roffset=3mm] {
+ \startalign
+ \NC c - a = \NC b \NR
+ \NC d + c - b = \NC a \NR
+ \stopalign
+ }
+\stopformula
+
+\Line
+
+\stoptext
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 8bdadef12..45bbe7b03 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index a60a70a72..9d03d82da 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.06.16 23:49}
+\newcontextversion{2016.06.18 16:28}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 670a1a683..ec4da7bd0 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.06.16 23:49}
+\edef\contextversion{2016.06.18 16:28}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-otf.lua b/tex/context/base/mkiv/font-otf.lua
index 3a8894ea7..dbfc0b583 100644
--- a/tex/context/base/mkiv/font-otf.lua
+++ b/tex/context/base/mkiv/font-otf.lua
@@ -2697,7 +2697,7 @@ local function copytotfm(data,cache_id)
spaceunits, spacer = charwidth, "charwidth"
end
end
- spaceunits = tonumber(spaceunits) or 500 -- brrr
+ spaceunits = tonumber(spaceunits) or units/2
--
parameters.slant = 0
parameters.space = spaceunits -- 3.333 (cmr10)
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 5c63ea312..6eb12cdcf 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -506,14 +506,14 @@ local function copytotfm(data,cache_id)
spaceunits, spacer = charwidth, "charwidth"
end
end
- spaceunits = tonumber(spaceunits) or 500 -- brrr
+ spaceunits = tonumber(spaceunits) or units/2
--
parameters.slant = 0
- parameters.space = spaceunits -- 3.333 (cmr10)
+ parameters.space = spaceunits -- 3.333 (cmr10)
parameters.space_stretch = 1*units/2 -- 500 -- 1.666 (cmr10)
- parameters.space_shrink = 1*units/3 -- 333 -- 1.111 (cmr10)
- parameters.x_height = 2*units/5 -- 400
- parameters.quad = units -- 1000
+ parameters.space_shrink = 1*units/3 -- 333 -- 1.111 (cmr10)
+ parameters.x_height = 2*units/5 -- 400
+ parameters.quad = units -- 1000
if spaceunits < 2*units/5 then
-- todo: warning
end
diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv
index b339223dc..f9ac1e877 100644
--- a/tex/context/base/mkiv/math-ali.mkiv
+++ b/tex/context/base/mkiv/math-ali.mkiv
@@ -1052,17 +1052,6 @@
\newdimen\d_math_number_correction
-\unexpanded\def\startmathbox#1%
- {\hsize\displaywidth % \checkeddisplaymath
- \global\mathnumberstatus\plusone
- \mathraggedstatus#1\relax
- \global\d_math_number_correction\zeropoint
- \strc_formulas_place_number
- \setbox\scratchbox\math_hbox to \displaywidth\bgroup % \checkeddisplaymath
- \mathinnerstrut
- \startforceddisplaymath
- \ifcase\mathraggedstatus\or\hfill\or\hfill\fi}
-
\def\math_box_llapped_math_no
{\ifcase\mathraggedstatus\or
\box\b_strc_formulas_number
@@ -1081,111 +1070,387 @@
\box\b_strc_formulas_number
\fi}
-% \unexpanded\def\stopmathbox
-% {\stopforceddisplaymath
-% \ifcase\mathraggedstatus\or\or\hfill\or\hfill\fi
-% \egroup
-% \setbox0\hbox{\unhcopy\scratchbox}%
-% \scratchdimen\wd0
-% % to be tested: \scratchdimen\naturalwd\scratchbox
-% \ifdim\scratchdimen>\displaywidth % \checkeddisplaymath
-% \donetrue
-% \else
-% \donefalse
-% \fi
-% % is number correction still needed ?
-% \dontcomplain
-% \dontleavehmode
-% \kern\d_strc_formulas_display_margin_left
-% \hbox to \displaywidth\bgroup
-% \ifcase\mathnumberstatus
-% \box\scratchbox
-% \or
-% \ifzeropt\wd\b_strc_formulas_number
-% \box\scratchbox
-% \else\ifx\p_location\v!left
-% \ifdone
-% \vpack{\hpack to \displaywidth{\math_box_rlapped_math_no\hss}\box\scratchbox}% \checkeddisplaymath
-% \else
-% \math_box_rlapped_math_no\box\scratchbox\hss % hss makes room for number
-% \fi
-% \else
-% \ifdone
-% \vpack{\box\scratchbox\hpack to \displaywidth{\hss\math_box_llapped_math_no}}% \checkeddisplaymath
-% \else
-% \hss\box\scratchbox\math_box_llapped_math_no % hss makes room for number
-% \fi
-% \fi\fi
-% \or
-% \hskip\d_math_number_correction
-% \box\scratchbox
-% \hss
-% \else
-% \box\scratchbox
-% \fi
-% \egroup}
-
-\unexpanded\def\stopmathbox
- {\stopforceddisplaymath
- \ifcase\mathraggedstatus\or\or\hfill\or\hfill\fi
+\newconditional\c_strc_math_has_number
+\newconditional\c_strc_math_display_overflow
+\newconstant \c_strc_math_number_location
+\newdimen \d_strc_math_number_width
+\newdimen \d_strc_math_display_width
+\newbox \b_strc_math_display
+\newconstant \c_strc_formulas_frame_mode
+
+\let\d_strc_math_framed_width\displaywidth
+
+\setvalue{\??formulaoption\v!frame}%
+ {\edef\p_frame{\formulaparameter\c!frame}%
+ \ifx\p_frame\v!number
+ \c_strc_formulas_frame_mode\plustwo % inside frame
+ \else
+ \c_strc_formulas_frame_mode\plusone % outside frame
+ \fi}
+
+% mode: 0=no frame | 1=number inside frame | 2=number outside frame
+
+\def\strc_math_flush_aligned
+ {\ifcase\mathraggedstatus\or\hfill\or\hfill\fi
+ \box\b_strc_math_display
+ \ifcase\mathraggedstatus\or\or\hfill\or\hfill\fi}
+
+\def\strc_math_flush_box_normal
+ {\hbox to \displaywidth\bgroup
+ \strc_math_flush_aligned
+ \egroup}
+
+\def\strc_math_flush_box_framed_common
+ {\setformulaframedparameter\c!align{\formulaparameter\c!align}%
+ \letformulaframedparameter\c!strut\v!no
+ \d_framed_formula\ht\b_strc_math_display
+ \ifcase\mathraggedstatus\or\hfill\or\hfill \fi
+ \inheritedformulaframedframed{\box\b_strc_math_display}%
+ \ifcase\mathraggedstatus\or \or\hfill\or\hfill\fi}
+
+% \def\strc_math_flush_box_framed_inline
+% {\letformulaframedparameter\c!location\empty
+% \letformulaframedparameter\c!width\displaywidth
+% \strc_math_flush_box_framed_common}
+
+\def\strc_math_flush_box_framed_display
+ {\let\currentformulaframed\currentformula
+ \letformulaframedparameter\c!location\v!formula
+ \setformulaframedparameter\c!width{\d_strc_math_framed_width}%
+ \strc_math_flush_box_framed_common}
+
+\def\strc_math_flush_box_framed_fit_inline
+ {\let\currentformulaframed\currentformula
+ \letformulaframedparameter\c!location\empty
+ \letformulaframedparameter\c!width\v!fit
+ \strc_math_flush_box_framed_common}
+
+\def\strc_math_flush_box_framed_fit_display
+ {\let\currentformulaframed\currentformula
+ \letformulaframedparameter\c!location\v!formula
+ \letformulaframedparameter\c!width\v!fit
+ \strc_math_flush_box_framed_common}
+
+% combiners
+
+\def\strc_math_flush_box
+ {\ifcase\c_strc_formulas_frame_mode
+ \strc_math_flush_box_normal
+ \else
+ \strc_math_flush_box_framed_display
+ \fi}
+
+\def\strc_math_number_right_normal
+ {\strc_math_flush_aligned
+ \hss % hss makes room for number
+ \math_box_llapped_math_no}
+
+\def\strc_math_number_left_normal
+ {\math_box_rlapped_math_no
+ \strc_math_flush_aligned
+ \hss} % hss makes room for number
+
+\def\strc_math_number_right_normal_outside
+ {\ifconditional\c_strc_formulas_tight
+ \strc_math_flush_box_framed_fit_display
+ \else
+ \strc_math_flush_box_framed_display
+ \fi
+ \hss % hss makes room for number
+ \math_box_llapped_math_no}
+
+\def\strc_math_number_left_normal_outside
+ {\math_box_rlapped_math_no
+ \hss % hss makes room for number
+ \ifconditional\c_strc_formulas_tight
+ \strc_math_flush_box_framed_fit_display
+ \else
+ \strc_math_flush_box_framed_display
+ \fi}
+
+\def\strc_math_number_right_normal_inside
+ {\setbox\b_strc_math_display\hpack to \dimexpr\displaywidth-\d_framed_locator_lo-\d_framed_locator_ro\relax\bgroup
+ \strc_math_flush_aligned
+ \hss
+ \math_box_llapped_math_no
\egroup
+ \strc_math_flush_box_framed_fit_inline}
+
+\def\strc_math_number_left_normal_inside
+ {\setbox\b_strc_math_display\hpack to \dimexpr\displaywidth-\d_framed_locator_lo-\d_framed_locator_ro\relax\bgroup
+ \math_box_rlapped_math_no
+ \hss
+ \strc_math_flush_aligned
+ \egroup
+ \strc_math_flush_box_framed_fit_inline}
+
+\def\strc_math_number_right_overflow
+ {\vpack\bgroup
+ \strc_math_flush_box
+ \par
+ \hpack to \displaywidth\bgroup
+ \hss
+ \math_box_llapped_math_no
+ \egroup
+ \egroup}
+
+\def\strc_math_number_left_overflow
+ {\vpack\bgroup
+ \hpack to \displaywidth\bgroup
+ \math_box_rlapped_math_no
+ \hss
+ \egroup
+ \strc_math_flush_box
+ \egroup}
+
+\def\strc_math_number_right_overflow_outside
+ {\vpack\bgroup
+ \strc_math_flush_box_framed_fit_inline
+ \hskip\zeropoint % nicely breaks the line with out introducing funny vertical spacing ... why o why
+ \hpack to \displaywidth\bgroup
+ \hss
+ \math_box_llapped_math_no
+ \egroup
+ \egroup}
+
+\def\strc_math_number_left_overflow_outside
+ {\vpack\bgroup
+ \hpack to \dimexpr\displaywidth-\d_framed_locator_lo\relax\bgroup
+ \math_box_rlapped_math_no
+ \hss
+ \egroup
+ \hskip\zeropoint % nicely breaks the line with out introducing funny vertical spacing ... why o why
+ \strc_math_flush_box_framed_fit_inline
+ \egroup}
+
+\def\strc_math_number_right_overflow_inside
+ {\setbox\b_strc_math_display\vpack\bgroup
+ \box\b_strc_math_display
+ \hpack to \displaywidth\bgroup
+ \hss
+ \math_box_llapped_math_no
+ \hskip\d_framed_locator_ro
+ \egroup
+ \egroup
+ \strc_math_flush_box_framed_fit_inline}
+
+\def\strc_math_number_left_overflow_inside
+ {\setbox\b_strc_math_display\vpack\bgroup
+ \hpack to \displaywidth\bgroup
+ % \hskip\d_framed_locator_lo
+ \math_box_rlapped_math_no
+ \hss
+ \egroup
+ \box\b_strc_math_display
+ \egroup
+ \strc_math_flush_box_framed_fit_inline}
+
+% checkers
+
+\def\strc_math_number_check
+ {\d_strc_math_display_width\wd\b_strc_math_display
\ifconditional\c_strc_formulas_tight
- \setnaturalwd\scratchbox
- \scratchdimen\wd\scratchbox
- \ifdim\scratchdimen>\displaywidth % \checkeddisplaymath
- \donetrue
+ \ifdim\d_strc_math_display_width>\displaywidth
+ \settrue\c_strc_math_display_overflow
\else
- \displaywidth\scratchdimen
- \donefalse
+ \displaywidth\d_strc_math_display_width
+ \setfalse\c_strc_math_display_overflow
\fi
\else
- \scratchdimen\getnaturalwd\scratchbox
- \ifdim\scratchdimen>\displaywidth % \checkeddisplaymath
- \donetrue
+ \ifdim\d_strc_math_display_width>\displaywidth
+ \settrue\c_strc_math_display_overflow
\else
- \donefalse
+ \setfalse\c_strc_math_display_overflow
\fi
+ \fi}
+
+\def\strc_math_number_check_outside
+ {\d_strc_math_display_width\naturalwd\b_strc_math_display
+ \ifdim\dimexpr\d_strc_math_display_width+\d_framed_locator_lo+\d_framed_locator_ro\relax>\displaywidth
+ \settrue\c_strc_math_display_overflow
+ \else
+ \setfalse\c_strc_math_display_overflow
\fi
- % is number correction still needed ?
+ % still ok?
+ \ifnum\mathraggedstatus=\plustwo
+ \edef\d_strc_math_framed_width{\the\dimexpr\displaywidth-2\wd\b_strc_formulas_number\relax}%
+ \else
+ \edef\d_strc_math_framed_width{\the\dimexpr\displaywidth-\wd\b_strc_formulas_number\relax}%
+ \fi}
+
+\let\strc_math_number_check_inside\strc_math_number_check_outside
+
+% offsets
+
+\def\strc_math_number_check_offsets
+ {\begingroup
+ \setbox\scratchbox\hbox
+ {\inheritedformulaframedframed
+ {\pack_framed_locator_set_lo\pack_framed_locator_set_ro}}%
+ \endgroup}
+
+% tracing
+
+\def\strc_math_traced_state_yes
+ {\llap{\setbox\scratchbox\hbox{\infofont
+ \ifcase\mathraggedstatus unset\or right\or middle\or left\fi
+ \space
+ \ifcase\c_strc_formulas_frame_mode no\or out\or in\fi
+ \space
+ \ifconditional\c_strc_math_display_overflow overflow\else fit\fi
+ \quad}\ht\scratchbox\zeropoint\dp\scratchbox\zeropoint\box\scratchbox}}
+
+\let\strc_math_traced_state\relax
+
+\installtextracker
+ {formulas.framed}
+ {\let\strc_math_traced_state\strc_math_traced_state_yes}
+ {\let\strc_math_traced_state\relax}
+
+% packaging
+
+\unexpanded\def\strc_math_box_start#1%
+ {\hsize\displaywidth % \checkeddisplaymath
+ \global\mathnumberstatus\plusone
+ \mathraggedstatus#1\relax
+ %
+ \global\d_math_number_correction\zeropoint
+ %
+ \edef\p_location{\formulaparameter\c!location}%
+ \useformulacolorparameter\c!color
+ \c_strc_math_number_location\ifx\p_location\v!left\plusone\else\ifx\p_location\v!right\plustwo\else\zerocount\fi\fi
+ %
+ \strc_formulas_place_number
\dontcomplain
- \noindentation
- % \dontleavehmode
+ \setbox\b_strc_math_display\math_hbox\bgroup % \checkeddisplaymath
+ \mathinnerstrut
+ \startforceddisplaymath}
+
+\def\strc_math_flush_number_no
+ {\ifconditional\c_strc_math_display_overflow
+ \ifcase\c_strc_formulas_frame_mode
+ \strc_math_flush_box_normal
+ \else
+ \strc_math_flush_box_framed_fit_inline
+ \fi
+ \else
+ \ifcase\c_strc_formulas_frame_mode
+ %\ifconditional\c_strc_formulas_tight
+ % \strc_math_flush_box_normal
+ %\else
+ \strc_math_flush_box_normal
+ %\fi
+ \else
+ \ifconditional\c_strc_formulas_tight
+ \strc_math_flush_box_framed_fit_inline
+ \else
+ \strc_math_flush_box_framed_display
+ \fi
+ \fi
+ \fi}
+
+\def\strc_math_flush_number_left
+ {\ifconditional\c_strc_math_display_overflow
+ \ifcase\c_strc_formulas_frame_mode
+ \strc_math_number_left_overflow
+ \or
+ \strc_math_number_left_overflow_outside
+ \or
+ \strc_math_number_left_overflow_inside
+ \fi
+ \else
+ \ifcase\c_strc_formulas_frame_mode
+ \strc_math_number_left_normal
+ \or
+ \strc_math_number_left_normal_outside
+ \or
+ \strc_math_number_left_normal_inside
+ \fi
+ \fi}
+
+\def\strc_math_flush_number_right
+ {\ifconditional\c_strc_math_display_overflow
+ \ifcase\c_strc_formulas_frame_mode
+ \strc_math_number_right_overflow
+ \or
+ \strc_math_number_right_overflow_outside
+ \or
+ \strc_math_number_right_overflow_inside
+ \fi
+ \else
+ \ifcase\c_strc_formulas_frame_mode
+ \strc_math_number_right_normal
+ \or
+ \strc_math_number_right_normal_outside
+ \or
+ \strc_math_number_right_normal_inside
+ \fi
+ \fi}
+
+\unexpanded\def\strc_math_box_stop
+ {\stopforceddisplaymath
+ \egroup
+ % check number
+ \d_strc_math_number_width\wd\b_strc_formulas_number
+ %
+ \ifcase\mathnumberstatus
+ \setfalse\c_strc_math_has_number
+ \or\ifzeropt\d_strc_math_number_width
+ \setfalse\c_strc_math_has_number
+ \else
+ \settrue\c_strc_math_has_number
+ \fi\fi
+ % preroll left and right offsets
+ \ifcase\c_strc_formulas_frame_mode
+ % no frame
+ \else
+ \strc_math_number_check_offsets
+ \fi
+ \ifcase\c_strc_formulas_frame_mode
+ \strc_math_number_check
+ \or
+ \strc_math_number_check_outside
+ \else
+ \strc_math_number_check_inside
+ \fi
+ \noindent % \noindentation % not \dontleavehmode
\hskip\d_strc_formulas_display_margin_left % was kern but that doesn't indent
+ \strc_math_traced_state
\hbox to \displaywidth \bgroup
\ifcase\mathnumberstatus
- \box\scratchbox
- \or
- \ifzeropt\wd\b_strc_formulas_number
- \box\scratchbox
- \else\ifx\p_location\v!left
- \ifdone
- \vpack{\hpack to \displaywidth{\math_box_rlapped_math_no\hss}\box\scratchbox}% \checkeddisplaymath
+ \strc_math_flush_box
+ \or % status 1
+ \ifcase\c_strc_math_number_location
+ \strc_math_flush_box
+ \or % number left
+ \ifzeropt\wd\b_strc_formulas_number
+ \strc_math_flush_number_no
\else
- \math_box_rlapped_math_no\box\scratchbox\hss % hss makes room for number
+ \strc_math_flush_number_left
\fi
- \else
- \ifdone
- \vpack{\box\scratchbox\hpack to \displaywidth{\hss\math_box_llapped_math_no}}% \checkeddisplaymath
+ \else % number right
+ \ifzeropt\wd\b_strc_formulas_number
+ \strc_math_flush_number_no
\else
- \hss\box\scratchbox\math_box_llapped_math_no % hss makes room for number
+ \strc_math_flush_number_right
\fi
- \fi\fi
- \or
- \hskip\d_math_number_correction
- \box\scratchbox
+ \fi
+ \or % status 2
+ \hskip\d_math_number_correction % probably no longer used
+ \strc_math_flush_box
\hss
\else
- \box\scratchbox
+ \strc_math_flush_box
\fi
\egroup}
-\defineinnermathhandler\v!left {\startmathbox\plusone }{\stopmathbox}
-\defineinnermathhandler\v!middle {\startmathbox\plustwo }{\stopmathbox}
-\defineinnermathhandler\v!right {\startmathbox\plusthree}{\stopmathbox}
-\defineinnermathhandler\v!flushleft {\startmathbox\plusthree}{\stopmathbox}
-\defineinnermathhandler\v!center {\startmathbox\plustwo }{\stopmathbox}
-\defineinnermathhandler\v!flushright{\startmathbox\plusone }{\stopmathbox}
-\defineinnermathhandler\v!normal {\startmathbox\plustwo }{\stopmathbox}
+\defineinnermathhandler\v!left {\strc_math_box_start\plusone }{\strc_math_box_stop}
+\defineinnermathhandler\v!middle {\strc_math_box_start\plustwo }{\strc_math_box_stop}
+\defineinnermathhandler\v!right {\strc_math_box_start\plusthree}{\strc_math_box_stop}
+\defineinnermathhandler\v!flushleft {\strc_math_box_start\plusthree}{\strc_math_box_stop}
+\defineinnermathhandler\v!center {\strc_math_box_start\plustwo }{\strc_math_box_stop}
+\defineinnermathhandler\v!flushright{\strc_math_box_start\plusone }{\strc_math_box_stop}
+\defineinnermathhandler\v!normal {\strc_math_box_start\plustwo }{\strc_math_box_stop}
%D For documentation, see \type {math-mkiv.tex}.
diff --git a/tex/context/base/mkiv/math-for.mkiv b/tex/context/base/mkiv/math-for.mkiv
index 0c8bd05ae..176552406 100644
--- a/tex/context/base/mkiv/math-for.mkiv
+++ b/tex/context/base/mkiv/math-for.mkiv
@@ -19,15 +19,29 @@
\unprotect
%D \macros
-%D {setupformulas,setupsubformulas}
+%D {setupformulas,setupsubformulas,setupformulaframed}
\installcorenamespace{formula}
\installcorenamespace{subformula}
+\installcorenamespace{formulaframed}
+\installcorenamespace{formulaoption}
-\installcommandhandler \??formula {formula} \??formula
-\installcommandhandler \??subformula {subformula} \??subformula % maybe just setuphandler (no childs used yet)
+\installcommandhandler \??formula {formula} \??formula
+\installcommandhandler \??subformula {subformula} \??subformula % maybe just setuphandler (no childs used yet)
+\installframedcommandhandler \??formulaframed {formulaframed} \??formulaframed
\let\setupformulas \setupformula
\let\setupsubformulas\setupsubformula
+\appendtoks
+ \normalexpanded{\defineformulaframed[\currentformula][\currentformulaparent]}%
+\to \everydefineformula
+
+\def\strc_formulas_option#1%
+ {\ifcsname\??formulaoption#1\endcsname
+ \lastnamedcs
+ \else
+ \font_basics_switchtobodyfont{#1}% for old time sake, might go away, only pt so maybe dimension and small test
+ \fi}
+
\protect \endinput
diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv
index cf8fe4941..d5b1c4234 100644
--- a/tex/context/base/mkiv/pack-rul.mkiv
+++ b/tex/context/base/mkiv/pack-rul.mkiv
@@ -1668,16 +1668,37 @@
\newdimen\d_framed_locator_ht
\newdimen\d_framed_locator_dp
+\newdimen\d_framed_locator_lo
+\newdimen\d_framed_locator_ro
-\def\pack_framed_locater_set#1%
+\def\pack_framed_locator_set#1%
{\d_framed_locator_ht\dimexpr
#1+\d_framed_linewidth
\ifconditional\c_framed_has_offset
+\framedparameter\c!offset
\fi
+ +\framedparameter\c!toffset
\relax
\d_framed_locator_dp\dimexpr\ht\b_framed_normal-\d_framed_locator_ht\relax}
+\def\pack_framed_locator_set_lo
+ {\global\d_framed_locator_lo\dimexpr
+ \d_framed_linewidth
+ \ifconditional\c_framed_has_offset
+ +\framedparameter\c!offset
+ \fi
+ +\framedparameter\c!loffset
+ \relax}
+
+\def\pack_framed_locator_set_ro
+ {\global\d_framed_locator_ro\dimexpr
+ \d_framed_linewidth
+ \ifconditional\c_framed_has_offset
+ +\framedparameter\c!offset
+ \fi
+ +\framedparameter\c!roffset
+ \relax}
+
% \ruledhbox
% {A
% \framed[width=2cm,align=middle,location=hanging]{location\\equals\\hanging}
@@ -1742,11 +1763,11 @@
\installframedlocator \v!high
{}
- {\pack_framed_locater_set\strutht
+ {\pack_framed_locator_set\strutht
\setbox\b_framed_normal\hpack{\lower\d_framed_locator_dp\box\b_framed_normal}%
\ht\b_framed_normal\strutht
\dp\b_framed_normal\strutdp
- \hpack{\box\b_framed_normal}}
+ \hpack{\box\b_framed_normal}} % why pack
\installframedlocator \v!line
{}
@@ -1757,7 +1778,7 @@
\installframedlocator \v!low
{}
- {\pack_framed_locater_set\strutdp
+ {\pack_framed_locator_set\strutdp
\setbox\b_framed_normal\hpack{\lower\d_framed_locator_ht\box\b_framed_normal}%
\ht\b_framed_normal\strutht
\dp\b_framed_normal\strutdp
@@ -1765,7 +1786,7 @@
\installframedlocator \v!top
{}
- {\pack_framed_locater_set\strutht
+ {\pack_framed_locator_set\strutht
\setbox\b_framed_normal\hpack{\lower\d_framed_locator_dp\box\b_framed_normal}%
\ht\b_framed_normal\d_framed_locator_ht
\dp\b_framed_normal\d_framed_locator_dp
@@ -1785,7 +1806,7 @@
\installframedlocator \v!bottom
{}
- {\pack_framed_locater_set\strutdp
+ {\pack_framed_locator_set\strutdp
\setbox\b_framed_normal\hpack{\lower\d_framed_locator_ht\box\b_framed_normal}%
\ht\b_framed_normal\d_framed_locator_dp
\dp\b_framed_normal\d_framed_locator_ht
@@ -1795,6 +1816,16 @@
{\pack_framed_remove_depth}
{\pack_framed_restore_depth}
+\newdimen\d_framed_formula
+
+\installframedlocator \v!formula % private, will become a more generic name
+ {}
+ {\pack_framed_locator_set\d_framed_formula
+ \setbox\b_framed_normal\hpack{\lower\d_framed_locator_dp\box\b_framed_normal}%
+ \ht\b_framed_normal\d_framed_locator_ht
+ \dp\b_framed_normal\d_framed_locator_dp
+ \hpack{\box\b_framed_normal}}
+
% also used in fastlocalframed
\newdimen\d_framed_original_wd
diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua
index 1fde2348c..2ea53b89e 100644
--- a/tex/context/base/mkiv/spac-chr.lua
+++ b/tex/context/base/mkiv/spac-chr.lua
@@ -177,7 +177,9 @@ local methods = {
-- The next one uses an attribute assigned to the character but still we
-- don't have the 'local' value.
- [0x001F] = function(head,current)
+ -- maybe also 0x0008 : backspace
+
+ [0x001F] = function(head,current) -- kind of special
local next = getnext(current)
if next then
local char = isglyph(next)
diff --git a/tex/context/base/mkiv/spac-chr.mkiv b/tex/context/base/mkiv/spac-chr.mkiv
index 562fb940c..c4aadd49f 100644
--- a/tex/context/base/mkiv/spac-chr.mkiv
+++ b/tex/context/base/mkiv/spac-chr.mkiv
@@ -62,6 +62,7 @@
% % "2003 % quad == \quad == \hskip\emwidth
\edef\threeperemspace {\normalUchar"2004} % quad/3
\edef\fourperemspace {\normalUchar"2005} % quad/4
+%edef\fiveperemspace {\normalUchar"001E} % quad/5 (bonus)
\edef\sixperemspace {\normalUchar"2006} % quad/6
\edef\figurespace {\normalUchar"2007} % width of zero
\edef\punctuationspace {\normalUchar"2008} % width of period
@@ -71,9 +72,12 @@
\edef\zerowidthnonjoiner {\normalUchar"200C} % 0
\edef\zerowidthjoiner {\normalUchar"200D} % 0
\edef\narrownobreakspace {\normalUchar"202F} % quad/8
-% % "205F % space/8 (math)
-% \zerowidthnobreakspace {\normalUchar"FEFF}
+%edef\mediummathspace {\normalUchar"205F} % space/8 (math)
+%edef\zerowidthnobreakspace {\normalUchar"FEFF}
+%edef\fiveperemspace {\normalUchar"001E}
+
\udef\zerowidthnobreakspace {\penalty\plustenthousand\kern\zeropoint}
+\udef\fiveperemspace {\hskip\dimexpr\emwidth/5\relax}
\let\zwnj\zerowidthnonjoiner
\let\zwj \zerowidthjoiner
@@ -87,9 +91,5 @@
\unexpanded\def~{\nobreakspace}
-% Goodies:
-
-\unexpanded\def\fiveperemspace{\hskip\dimexpr\emwidth/5\relax}
-
\protect \endinput
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 19d80b93f..1030dfbde 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index ada7cf06f..ed14795e4 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv
index 0fb609e45..554dc84ca 100644
--- a/tex/context/base/mkiv/strc-mat.mkiv
+++ b/tex/context/base/mkiv/strc-mat.mkiv
@@ -48,6 +48,12 @@
\c!strut=\v!no,
\c!distance=2\emwidth]
+\setupformulaframed
+ [%c!location=<auto set>,
+ %c!width=<auto set>,
+ %c!align=<auto set>,
+ \c!offset=.5\exheight]
+
\ifdefined\matheqnogapstep
% we're ok, now we have that quad in the distance which is
% more consistent and not depending on the text font in math
@@ -620,11 +626,19 @@
\directvspacing\p_spaceafter
\fi}
+\def\strc_math_obey_depth
+ {\ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp
+ % maybe add a tracing option here
+ \kern\dimexpr\strutdp-\prevdepth\relax
+ \prevdepth\strutdp
+ \fi\fi\fi}
+
\setvalue{\??mathdisplayspacemodel\v!before:3}%
- {\ifdim\lastskip>\zeropoint
+ {% not ok, try \stopformula\par\startformula vs \stopformula\startformula
+ \ifdim\lastskip>\zeropoint
% bah
\else
- \obeydepth
+ \strc_math_obey_depth
\nointerlineskip
\fi
\ifx\p_spacebefore\v!none
@@ -702,15 +716,6 @@
%D
%D \typebuffer \getbuffer
-\installcorenamespace{formulaoption}
-
-\def\strc_formulas_option#1%
- {\ifcsname\??formulaoption#1\endcsname
- \lastnamedcs
- \else
- \font_basics_switchtobodyfont{#1}% for old time sake, might go away, only pt so maybe dimension and small test
- \fi}
-
\setvalue{\??formulaoption\v!packed}%
{\c_strc_formulas_space_model\zerocount}
diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv
index bb7e2b709..499281ebe 100644
--- a/tex/context/base/mkiv/supp-box.mkiv
+++ b/tex/context/base/mkiv/supp-box.mkiv
@@ -2619,13 +2619,11 @@
\fi}
\unexpanded\def\obeydepth
- {\par
- \ifvmode
- \ifdim\prevdepth>\zeropoint
- \kern-\prevdepth
- \fi
- \kern\strutdp
- \fi}
+ {\par % watch out for changes in math formulas
+ \ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp
+ \kern\dimexpr\strutdp-\prevdepth\relax
+ \prevdepth\strutdp
+ \fi\fi\fi}
\unexpanded\def\undepthed
{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\hbox}
diff --git a/tex/context/interface/mkiv/i-common-argument.xml b/tex/context/interface/mkiv/i-common-argument.xml
index f197481e7..305b93e90 100644
--- a/tex/context/interface/mkiv/i-common-argument.xml
+++ b/tex/context/interface/mkiv/i-common-argument.xml
@@ -501,6 +501,7 @@
<cd:constant type="packed"/>
<cd:constant type="tight"/>
<cd:constant type="middle"/>
+ <cd:constant type="frame"/>
<cd:inherit name="setupbodyfont"/>
</cd:keywords>
</cd:define>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 27ac41c42..6e5c2e428 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-formula.xml b/tex/context/interface/mkiv/i-formula.xml
index ea0dcb52f..f288e4f8a 100644
--- a/tex/context/interface/mkiv/i-formula.xml
+++ b/tex/context/interface/mkiv/i-formula.xml
@@ -53,6 +53,15 @@
<cd:parameter name="numbercommand">
<cd:constant type="cd:oneargument"/>
</cd:parameter>
+ <cd:parameter name="color">
+ <cd:constant type="cd:color"/>
+ </cd:parameter>
+ <cd:parameter name="numberstyle">
+ <cd:resolve name="value-style"/>
+ </cd:parameter>
+ <cd:parameter name="numbercolor">
+ <cd:constant type="cd:color"/>
+ </cd:parameter>
<cd:parameter name="option">
<cd:constant type="middle"/>
</cd:parameter>
diff --git a/tex/context/interface/mkiv/i-note.xml b/tex/context/interface/mkiv/i-note.xml
index be74ca3a6..dacdfeb0b 100644
--- a/tex/context/interface/mkiv/i-note.xml
+++ b/tex/context/interface/mkiv/i-note.xml
@@ -660,4 +660,4 @@
</cd:arguments>
</cd:command>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 89d98204c..f49b500fc 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index aea018286..e19ac93fa 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 06/16/16 23:49:06
+-- merge date : 06/18/16 16:28:26
do -- begin closure to overcome local limits and interference
@@ -15712,13 +15712,13 @@ local function copytotfm(data,cache_id)
spaceunits,spacer=charwidth,"charwidth"
end
end
- spaceunits=tonumber(spaceunits) or 500
+ spaceunits=tonumber(spaceunits) or units/2
parameters.slant=0
- parameters.space=spaceunits
+ parameters.space=spaceunits
parameters.space_stretch=1*units/2
- parameters.space_shrink=1*units/3
- parameters.x_height=2*units/5
- parameters.quad=units
+ parameters.space_shrink=1*units/3
+ parameters.x_height=2*units/5
+ parameters.quad=units
if spaceunits<2*units/5 then
end
if italicangle and italicangle~=0 then