ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Difficulties with \startformula
@ 2014-01-13 23:13 Elspeth McGullicuddy
  2014-01-14 17:36 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Elspeth McGullicuddy @ 2014-01-13 23:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

1- I put here a far too long example to show difficulties that I have
with formulas in conjunction with framed:
I haven't find a way to insert a formula (displaystyle, vertical
mode), at the beginning of a \framed.

2- It might be related with this other thing:
The last examples are about mouse text selection with Okular (haven't
tried with another viewer):

When I "mouse text select" elements of the formula, when the
\startformula \stopformula in embeded in a \hbox, what is highlighted
looks alright. Instead, when it's in "vertical mode", what is
highlighted is very very large.

It's probably not the purpose of pdf documents, but this select (and
copy) feature is very convenient. This feature is rather impinged with
this not so nice looking behavior. Also in these conditions Okular
can't select the text precisely, but instead select a much wider area
of text (one example here does this).

3- When embedded in \hbox (not vertical mode then), the height of
"mouse text section" is alright is formula is 'x+y', but there is an
error if the formula in instead '\int_a^b'.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\starttext

\setupformulas[spacebefore=-1ex]


\framed[width=5cm,align=yes]{%
Hello
}


\framed[width=5cm,align=yes]{%
Hello
\startformula
x+y
\stopformula
}

\framed[width=5cm,align=yes]{%
%Hello
\startformula
x+y
\stopformula
}

\framed[width=5cm,align=yes]{%
\vskip-1.3\baselineskip
\startformula
x+y
\stopformula
}

\framed[width=5cm,align=yes]{%
\hairline
\startformula
x+y
\stopformula
\hairline
}


\hairline
\startformula
x+y
\stopformula
\hairline

\framed[align=yes]{%
\type{\vrule \hrule \vbox $$}\\
\hbox{\vrule{\hsize=7cm\vbox{\hrule
$$
x+y
$$
\input{knuth}
\hrule}}\vrule}}



\framed[align=yes]{%
trying to select the ``x'' in the next formula, select text [\type{he
``xhe \vbox x+ syste conyer and}]\\
\type{\vrule \hrule \vbox \startformula}\\
\hbox{\vrule{\hsize=7cm\vbox{\hrule
\startformula
x+y
\stopformula
\input{knuth}
\hrule}}\vrule}}

\framed[align=yes]{%
\type{\framed \vbox \startformula}\\
\framed{%
{\hsize=5cm\vbox{%
\startformula
x+y
\stopformula
\input{knuth}
}}}}

\framed[align=yes]{%
\type{\framed $$}\\
\framed[align=yes,width=5cm]{%
$$
x+y
$$
\input{knuth}
}}

\startbuffer
\hbox{\vrule\startformula \int_a^b x+y \stopformula}
\stopbuffer

\framed[align=yes]{%
This line generates an error\\
\typebuffer}

\framed[align=yes]{%
When one ``text select'' with mouse with Okular, height of selection
is correct.\\
\hbox{\vrule\startformula x+y \stopformula}}

\framed[align=yes]{%
When one ``text select'' with mouse with Okular, height of selection
is much larger than expected.\\
\startformula x+y \stopformula}



\stoptext

%%%%%%%%%%%%%%%%%%%%

Regards,
Chris
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Difficulties with \startformula
  2014-01-13 23:13 Difficulties with \startformula Elspeth McGullicuddy
@ 2014-01-14 17:36 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2014-01-14 17:36 UTC (permalink / raw)
  To: ntg-context

On 1/14/2014 12:13 AM, Elspeth McGullicuddy wrote:
> Hi,
>
> 1- I put here a far too long example to show difficulties that I have
> with formulas in conjunction with framed:
> I haven't find a way to insert a formula (displaystyle, vertical
> mode), at the beginning of a \framed.

Here is a small example:

\nopdfcompression

\startTEXpage[offset=3cm]
     \hbox{$ x+y $}
\stopTEXpage

If you look in the pdf file you will see the following:

/FontBBox    [-1042 -3060 4082 3560]
/Ascent      3560
/CapHeight   683
/Descent     -3060
/ItalicAngle 0
/StemV       93
/XHeight     431

The less clever viewer can use that information for the selection 
dimensions. Acrobat instead uses the glyph properties.

If you run instead

\starttext
     \hbox{$$ x+y $$}
\stoptext

you will not get math at all because the $$ == an empty inline math so 
there a text font is used:

/FontBBox    [-422 -280 1394 1127]
/Ascent      1127
/CapHeight   683
/Descent     -280
/ItalicAngle 0
/StemV       91
/XHeight     431

In context,

     \hbox{\startformula x+y \stopformula}

boils down to

   \hbox{\par $$ x+y $$ \par}

plus some more so i decided to turn this into

\hbox{\par \Ustartdisplaymath x+y \Ustopdisplaymath \par}

Now, believe it it not, when I tested that one luatex crashed as we 
never thought about the fact that $$ is catched in the main loop and 
\Ustartdisplaymath falls through and creates havoc. So, after some 
debugging Luigi and I figured out that this was too messy to catch. Math 
magician Taco will fix it in luatex's parser part. So, be warned, don't 
this this trickery now.

In the meantime, i fixed context to deal with such matters. Of course 
that bug doesn't relate to your observations.

Hans





-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-14 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-13 23:13 Difficulties with \startformula Elspeth McGullicuddy
2014-01-14 17:36 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).