[NTG-context] \indenting[next] and math => no vertical space before the formula

Mikael Persson mickep at gmail.com
Wed Apr 30 09:24:46 CEST 2008


On Tue, Apr 29, 2008 at 6:49 AM, Aditya Mahajan <adityam at umich.edu> wrote:
> On Mon, 28 Apr 2008, Mikael Persson wrote:
>
>  > Hello again,
>  >
>  > * snip *
>  >>
>  >>  I could reproduce the result and have also a fix but I don't know what
>  >>  the correct
>  >>  reults should be and other people like Aditya should decide if it makes sense
>  >>  to change the current behaviour.
>  >>
>  >>  \def\startdisplaymath
>  >>   {\ifgridsnapping
>  >>      \beforedisplayspace
>  >>      \snapmathtogrid\vbox
>  > * snip *
>  >>  Wolfgang
>  >
>  > This fix seems not to solve the problem entirely. With this fix
>  > applied, If one now put a formula inside an enumeration one gets
>  > "double" space before the formula. This is a test file that shows the
>  > problem:
>
>  This is basically because in enumerations indenting is set to never.
>
>  You can see the same affect with
>
>  \setupindenting[no]
>  \testtext
>
>  One possible fix is to add
>
>  indenting=(reset|next|first) %default is never
>
>  to the \setupenumeration command. For example
>
>
>  > \defineenumeration[example]
>  >        [text=Example,
>  >        location=serried,
>  >        width=fit,
>           indenting=reset, %%<<<---- Add This
>
> >        distance=0.5em,
>  >       way=bysection,
>  >        ]
>
>  Another is to change \startdisplaymath to
>
>
>  \def\startdisplaymath
>    {\ifgridsnapping
>       \beforedisplayspace
>       \snapmathtogrid\vbox
>
>       \bgroup
>       \informulatrue
>      %\forgetall % breaks side floats
>     \else
>       \bgroup
>       \parskip\formulaparskip % ! !
>       \informulatrue
>      %\forgetall % otherwise backgrounds fail
>       \ifdim\lastskip<\zeropoint\else
>         \par
>         \ifvmode \ifdim\parskip>\zeropoint\relax
>           \whitespace \vskip-\parskip % kind of forces and cancels again
>         \fi \fi
>       \fi
>       \doif\displaygridcorrection{-\v!top}{\kern-\strutht}% new, currently only option/default
>       \beforedisplayspace
>       \par
>       \ifvmode \ifdim\parskip>\zeropoint\relax \else
>
>        \ifindentfirstparagraph
>           \verticalstrut
>           \vskip-\struttotal
>           \vskip-\baselineskip
>         \fi\fi
>       \fi
>     \fi
>     $$\setdisplaydimensions
>     \setpredisplaysize\lastlinewidth
>     \startinnermath}
>
>  But this is getting ugly.
>
>  Aditya
>

Thank you Aditya, but I don't get that to work. Both with

ConTeXt  ver: 2007.04.03 13:01 MKII  fmt: 2008.4.24  int:
english/english (with the fix earlier in this thread)
and
ConTeXt  ver: 2007.09.28 16:52 MKII  fmt: 2008.4.24  int:
english/english (which is the one from new ubuntu, without the fix)

this fails with the following error msg:

%% Start error msg
! Illegal unit of measure (pt inserted).
<to be read again>
                   \chardef
\@@in:reset ...rue \parindent \zerocount \chardef
                                                  \indentingtoggle \zerocount
\next1 #1,->\docomplexsetupindentingB {#1}
                                          \doprocesscommaitem
\doprocesscommalist ...item \gobbleoneargument #1,
                                                  ]\relax \global \advance \...
<argument> ...ndenting ]\docomplexsetupindentingB
                                                  \checkeverypar \ifindentfi...

\firstofoneargument #1->#1

...
l.29 \testexpr
               % Too much space before the formula if the fix is applied,
?
%% Stop error msg

The file that gives that error is:

%% Begin file
\setupindenting[yes,small]
\indenting[next]

\def\testtext{This is just some text so we see better what happens.}

\def\testexpr{%
\par
\testtext
\startformula
f(x)= \sin(x)
\stopformula
\testtext
\par
}

\defineenumeration[example]
       [text=Example,
       location=serried,
       width=fit,
       indenting=reset,
       distance=0.5em,
       way=bysection,
       ]

\starttext
\testexpr % OK if fix is applied, otherwise to little space before the
formula
\startexample
\testexpr % Too much space before the formula if the fix is applied,
otherwise OK.
\stopexample

\stoptext
%% End file

Best regards, Micke P


More information about the ntg-context mailing list