[NTG-context] math formula linebreak

2012-08-09 Thread Steffen Wolfrum
Hi,

for nice linebreaking we can adjust math formulas by the use of NC, NR 
alignment.

But if someone only wants long formulas to fit in a defined area, and want them 
to break automatically ... is there a handy solution?

(Below are examples that don't work)

Thanks,
Steffen
---


\starttext


\placeformula
\startformula[9pt]
I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
+(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\}-\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
\stopformula



\defineframedtext
 [defbackground]
 [width=10cm,
  frame=on,
  location=paragraph]


\startdefbackground
\placeformula
\startformula[9pt]
I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
+(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\} -\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
\stopformula
\stopdefbackground





\definelayer[mylayer]


\setlayerframed
 [mylayer]
 [x=25mm,
  y=85mm,
  height=43.5mm,
  width=10cm,align=block]
 {
 \placeformula
\startformula[9pt]
I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
+(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\} -\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
\stopformula
 }

\setupbackgrounds[page][background=mylayer]






\stoptext

___
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
___


[NTG-context] [***SPAM***] Widows: penalty without efffect (ConTeXt iv)

2012-08-09 Thread d_jan

Dear List,

I ran into trouble with the widow/orphan-control in context.
I searched the mailinglist, and saw that there were some other threads 
on the topic bevore, but as far as I am concerned what was suggested 
there did not work for me when I tried it.


I run context iv using the version which comes with TexLive 2011.

First trail was to include \widowpenalty=9000 and \clubpenalty=9000 at 
the start of the document, before \starttext (cause I do my setups, and 
definitions there)
As this did not work I tried to put them after \starttext. As well I 
lowered \brokenpenalty. But both approaches, which were suggested in 
previous Posts on the ntg-context list failed to show an effect in my case.


Is there anything I could do to prevent the widow lines?

PS.: As I may be doing any noobish errors, here an overview of the 
documents structure and the placement of the penalty-commands

_

\widowpenalty=9000
\clubpenalty=9000

\definepapersize[janssize][width=190mm, height=245mm]

\setuppapersize[janssize][A4] %we can use something like [A5][A4], which 
is a a5 Page sized Document printed on a A4 sheet



\setuplayout[grid=yes, marking=on, location=middle, backspace=30mm, 
width=110mm]%former: location=doublesided



\starttext

\startstandardmakeup
\stopstandardmakeup

\startfrontmatter
%TOC...
\stopfrontmatter

\startbodymatter %the main stuff goes here
% Loads of text
\stopbodymatter

\startappendices %appendices go here
\stopappendices

\stoptext




___
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
___


Re: [NTG-context] \startcomponent, \startproduct... + automatic file name

2012-08-09 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Great, thank you.

Lukas


On Thu, 09 Aug 2012 11:27:08 +0200, Hans Hagen pra...@wxs.nl wrote:


in the current beta you can say

\startcomponent *

Hans



--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___
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
___


Re: [NTG-context] [***SPAM***] Widows: penalty without efffect (ConTeXt iv)

2012-08-09 Thread Stefan Müller

Hi,

did you see [1]? You have to do something like

\starttext
\clubpenalty=1
\widowpenalty=1

My text that should not contain any widow or orphan lines.
\stoptext

If that does not work for you, please provide a minimal example.

HTH,
Stefan


[1] 
http://archive.contextgarden.net/message/20111211.162442.4f689e7b.en.html


On 09.08.2012 11:36, d_jan wrote:

Dear List,

I ran into trouble with the widow/orphan-control in context.
I searched the mailinglist, and saw that there were some other threads
on the topic bevore, but as far as I am concerned what was suggested
there did not work for me when I tried it.

I run context iv using the version which comes with TexLive 2011.

First trail was to include \widowpenalty=9000 and \clubpenalty=9000 at
the start of the document, before \starttext (cause I do my setups, and
definitions there)
As this did not work I tried to put them after \starttext. As well I
lowered \brokenpenalty. But both approaches, which were suggested in
previous Posts on the ntg-context list failed to show an effect in my case.

Is there anything I could do to prevent the widow lines?

PS.: As I may be doing any noobish errors, here an overview of the
documents structure and the placement of the penalty-commands
_

\widowpenalty=9000
\clubpenalty=9000

\definepapersize[janssize][width=190mm, height=245mm]

\setuppapersize[janssize][A4] %we can use something like [A5][A4], which
is a a5 Page sized Document printed on a A4 sheet


\setuplayout[grid=yes, marking=on, location=middle, backspace=30mm,
width=110mm]%former: location=doublesided


\starttext

\startstandardmakeup
\stopstandardmakeup

\startfrontmatter
%TOC...
\stopfrontmatter

\startbodymatter %the main stuff goes here
% Loads of text
\stopbodymatter

\startappendices %appendices go here
\stopappendices

\stoptext

___
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
___


Re: [NTG-context] [***SPAM***] Widows: penalty without efffect (ConTeXt iv)

2012-08-09 Thread Wolfgang Schuster

Am 09.08.2012 um 11:36 schrieb d_jan d_...@ymail.com:

 Dear List,
 
 I ran into trouble with the widow/orphan-control in context.
 I searched the mailinglist, and saw that there were some other threads on the 
 topic bevore, but as far as I am concerned what was suggested there did not 
 work for me when I tried it.
 
 I run context iv using the version which comes with TexLive 2011.
 
 First trail was to include \widowpenalty=9000 and \clubpenalty=9000 at the 
 start of the document, before \starttext (cause I do my setups, and 
 definitions there)
 As this did not work I tried to put them after \starttext. As well I lowered 
 \brokenpenalty. But both approaches, which were suggested in previous Posts 
 on the ntg-context list failed to show an effect in my case.
 
 Is there anything I could do to prevent the widow lines?

You can change the default penalties with \setuplayout[setups=…], the default 
setting is \setuplayout[setups=*default] but you can change this to 
“setups=*strict”  which should help. It’s also possible to create your own 
penalties setup, e.g.

\startsetups mypenalties

  \widowpenalty = 9000
  \clubpenalty  = 9000

\stopsetups

\setuplayout[setups=mypenalties]

\starttext
…
\stoptext

Wolfgang
___
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
___


Re: [NTG-context] \startcomponent, \startproduct... + automatic file name

2012-08-09 Thread Sietse Brouwer
 On Thu, 09 Aug 2012 11:27:08 +0200, Hans Hagen pra...@wxs.nl wrote:
 in the current beta you can say

 \startcomponent *

 Hans

Wikified at http://wiki.contextgarden.net/Command/startcomponent. This
trick also works for startproject, startenvironment, and startproduct,
I assume?

And for the general case, what about
`\ctxlua{commands.processedfile}`? That looks like it should print the
current filename, as long as any inclusions use the ConTeXt commands
and not \input.

--Sietse

On Thu, Aug 9, 2012 at 1:24 PM, Procházka Lukáš Ing. - Pontex s. r. o.
l...@pontex.cz wrote:
 Great, thank you.

 Lukas


 On Thu, 09 Aug 2012 11:27:08 +0200, Hans Hagen pra...@wxs.nl wrote:

 in the current beta you can say

 \startcomponent *

 Hans



 --
 Ing. Lukáš Procházka [mailto:l...@pontex.cz]
 Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
 Bezová 1658
 147 14 Praha 4

 Tel: +420 244 062 238
 Fax: +420 244 461 038

 ___
 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
 ___
___
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
___

[NTG-context] Can't generate an epub - what am I doing wrong?

2012-08-09 Thread Marcin Borkowski
Hello all,

my problem is as in the topic;).  The minimal example from the wiki
works fine, but this does not:


\setupbackend[export=yes,xhtml=yes]

\settaggedmetadata
  [title=My Document,
   author=A. U. Thor]

\starttext

\startchapter[title={First chapter}]
\input tufte  
\stopchapter

\startchapter[title={Second chapter}]
\input knuth
\stopchapter
\stoptext


The resulting epub file (after the mtxrun, of course) does not contain
any metadata; also, there is no chapter structure whatsoever.

What am I missing?

TIA,

-- 
Marcin Borkowski
http://mbork.pl


-- 
Marcin Borkowski
http://mbork.pl
___
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
___


Re: [NTG-context] \startcomponent, \startproduct... + automatic file name

2012-08-09 Thread Wolfgang Schuster

Am 09.08.2012 um 15:08 schrieb Sietse Brouwer sbbrou...@gmail.com:

 On Thu, 09 Aug 2012 11:27:08 +0200, Hans Hagen pra...@wxs.nl wrote:
 in the current beta you can say
 
 \startcomponent *
 
 Hans
 
 Wikified at http://wiki.contextgarden.net/Command/startcomponent. This
 trick also works for startproject, startenvironment, and startproduct,
 I assume?
 
 And for the general case, what about
 `\ctxlua{commands.processedfile}`? That looks like it should print the
 current filename, as long as any inclusions use the ConTeXt commands
 and not \input.

You can use \currentcomponent, \currentproduct and \currentproject to print the 
name of the file.

Wolfgang
___
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
___


Re: [NTG-context] \startcomponent, \startproduct... + automatic file name

2012-08-09 Thread Sietse Brouwer
Wolfgang wrote:
 You can use \currentcomponent, \currentproduct and \currentproject to print 
 the name of the file.

Another secret unearthed! All wikified, together with \processedfile
and \processedfiles. Sans examples, but at least the info's there.
Thank you, Wolfgang.

Cheers,
Sietse
___
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
___


Re: [NTG-context] Can't generate an epub - what am I doing wrong?

2012-08-09 Thread Rogers, Michael K
Hi,

I don't seem to have an epub reader that can format the output.  (MS Word 
complain there was no xslt file,  But the xhtml file produced contains the 
metadata and the document structure.  Output pasted below.

Michael

On Aug 9, 2012, at 9:09 AM, Marcin Borkowski wrote:

Hello all,

my problem is as in the topic;).  The minimal example from the wiki
works fine, but this does not:


\setupbackend[export=yes,xhtml=yes]

\settaggedmetadata
 [title=My Document,
  author=A. U. Thor]

\starttext

\startchapter[title={First chapter}]
\input tufte
\stopchapter

\startchapter[title={Second chapter}]
\input knuth
\stopchapter
\stoptext


The resulting epub file (after the mtxrun, of course) does not contain
any metadata; also, there is no chapter structure whatsoever.

What am I missing?

TIA,

--
Marcin Borkowski
http://mbork.pl

XHTML output (text shortened):

?xml version='1.0' encoding='UTF-8' standalone='yes' ?

!-- input filename   : foo13338  --
!-- processing date  : Thu Aug  9 09:30:38 2012 --
!-- context version  : 2012.08.05 12:52  --
!-- exporter version : 0.30  --


document xmlns:m=http://www.w3.org/1998/Math/MathML; version=0.30 
language=en date=Thu Aug  9 09:30:38 2012 file=foo13338 
context=2012.08.05 12:52 xmlns:xhtml=http://www.w3.org/1999/xhtml;
metadata
  metavariable name=authorA. U. Thor/metavariable
  metavariable name=titleMy Document/metavariable
/metadata
  xhtml:a name=aut_1section location=aut:1 detail=chapter
sectionnumber1/sectionnumber
sectiontitleFirst chapter/sectiontitle
sectioncontent
We thrive...
/sectioncontent
  /section/xhtml:a
  xhtml:a name=aut_2section location=aut:2 detail=chapter
sectionnumber2/sectionnumber
sectiontitleSecond chapter/sectiontitle
sectioncontent
Thus,...
  break/
The separation...
  break/
But...
/sectioncontent
  /section/xhtml:a
/document



This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___
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
___

Re: [NTG-context] Can't generate an epub - what am I doing wrong?

2012-08-09 Thread Marcin Borkowski
Dnia 2012-08-09, o godz. 14:33:36
Rogers, Michael K mrog...@emory.edu napisał(a):

 Hi,
 
 I don't seem to have an epub reader that can format the output.  (MS
 Word complain there was no xslt file,  But the xhtml file produced
 contains the metadata and the document structure.  Output pasted
 below.
 
 Michael

Agreed, but opening in fbreader showed blank screen, and in sigil I saw
the text but not divided into chapters.

Best,

-- 
Marcin Borkowski
http://mbork.pl
___
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
___

Re: [NTG-context] Can't generate an epub - what am I doing wrong?

2012-08-09 Thread Wolfgang Schuster

Am 09.08.2012 um 17:55 schrieb Marcin Borkowski mb...@wmi.amu.edu.pl:

 Dnia 2012-08-09, o godz. 14:33:36
 Rogers, Michael K mrog...@emory.edu napisał(a):
 
 Hi,
 
 I don't seem to have an epub reader that can format the output.  (MS
 Word complain there was no xslt file,  But the xhtml file produced
 contains the metadata and the document structure.  Output pasted
 below.
 
 Michael
 
 Agreed, but opening in fbreader showed blank screen, and in sigil I saw
 the text but not divided into chapters.

ConTeXt uses it’s own tag names for the elements and doesn’t use the normal 
HTML structure which is a problem for most epub readers (hardware and software).

Wolfgang
___
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
___

Re: [NTG-context] Can't generate an epub - what am I doing wrong?

2012-08-09 Thread Hans Hagen

On 9-8-2012 18:11, Wolfgang Schuster wrote:


Am 09.08.2012 um 17:55 schrieb Marcin Borkowski mb...@wmi.amu.edu.pl:


Dnia 2012-08-09, o godz. 14:33:36
Rogers, Michael K mrog...@emory.edu napisał(a):


Hi,

I don't seem to have an epub reader that can format the output.  (MS
Word complain there was no xslt file,  But the xhtml file produced
contains the metadata and the document structure.  Output pasted
below.

Michael


Agreed, but opening in fbreader showed blank screen, and in sigil I saw
the text but not divided into chapters.


ConTeXt uses it’s own tag names for the elements and doesn’t use the normal 
HTML structure which is a problem for most epub readers (hardware and software).


that's because it's an export (ie .. we want to preserve information). 
One can easily transform the export into something suitable for some 
purpose.


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
___

Re: [NTG-context] math formula linebreak

2012-08-09 Thread Aditya Mahajan

On Thu, 9 Aug 2012, Steffen Wolfrum wrote:


Hi,

for nice linebreaking we can adjust math formulas by the use of NC, NR 
alignment.

But if someone only wants long formulas to fit in a defined area, and want them 
to break automatically ... is there a handy solution?


Short answer: No easy solution exists.

Aditya

___
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
___


Re: [NTG-context] math formula linebreak

2012-08-09 Thread Sietse Brouwer
Steffen Wolfrum wrote:
 them to break automatically ... is there a handy solution?

Aditya Mahajan wrote:
 Short answer: No easy solution exists.

Is this because allowing automatic line breaks in math mode is itself
hard to implement, or is the basic mechanism possible but preventing
stupid/ugly breakpoints is hard? Because I can imagine a 70 percent
solution being a big help already.
--Sietse
___
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
___


Re: [NTG-context] [***SPAM***] Widows: penalty without efffect (ConTeXt iv)

2012-08-09 Thread d_jan

Hi Stephan,
Thanks for your help. Seemingly I missed that in my search on the list.

\starttext
\clubpenalty=1
\widowpenalty=1
\brokenpenalty=1
[...]

seems to do the job.

Reards,
 Jan

On 09.08.2012 14:25, Stefan Müller wrote:

Hi,

did you see [1]? You have to do something like

\starttext
\clubpenalty=1
\widowpenalty=1

My text that should not contain any widow or orphan lines.
\stoptext

If that does not work for you, please provide a minimal example.

HTH,
Stefan


[1] 
http://archive.contextgarden.net/message/20111211.162442.4f689e7b.en.html


On 09.08.2012 11:36, d_jan wrote:

Dear List,

I ran into trouble with the widow/orphan-control in context.
I searched the mailinglist, and saw that there were some other threads
on the topic bevore, but as far as I am concerned what was suggested
there did not work for me when I tried it.

I run context iv using the version which comes with TexLive 2011.

First trail was to include \widowpenalty=9000 and \clubpenalty=9000 at
the start of the document, before \starttext (cause I do my setups, and
definitions there)
As this did not work I tried to put them after \starttext. As well I
lowered \brokenpenalty. But both approaches, which were suggested in
previous Posts on the ntg-context list failed to show an effect in my 
case.


Is there anything I could do to prevent the widow lines?

PS.: As I may be doing any noobish errors, here an overview of the
documents structure and the placement of the penalty-commands
_

\widowpenalty=9000
\clubpenalty=9000

\definepapersize[janssize][width=190mm, height=245mm]

\setuppapersize[janssize][A4] %we can use something like [A5][A4], which
is a a5 Page sized Document printed on a A4 sheet


\setuplayout[grid=yes, marking=on, location=middle, backspace=30mm,
width=110mm]%former: location=doublesided


\starttext

\startstandardmakeup
\stopstandardmakeup

\startfrontmatter
%TOC...
\stopfrontmatter

\startbodymatter %the main stuff goes here
% Loads of text
\stopbodymatter

\startappendices %appendices go here
\stopappendices

\stoptext


___
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
___


Re: [NTG-context] math formula linebreak

2012-08-09 Thread Aditya Mahajan

On Thu, 9 Aug 2012, Sietse Brouwer wrote:


Steffen Wolfrum wrote:

them to break automatically ... is there a handy solution?


Aditya Mahajan wrote:

Short answer: No easy solution exists.


Is this because allowing automatic line breaks in math mode is itself
hard to implement, or is the basic mechanism possible but preventing
stupid/ugly breakpoints is hard? Because I can imagine a 70 percent
solution being a big help already.


Partly both.

The question is not so much the difficulty in choosing break-points (which 
is easy: before all \mathbin atoms, after \mathpunct if needed, etc). The 
hard part is how to align the split up portions, and choosing different 
alignments changes the line widths, and therefore affect future 
line-breaks.


The old manual of breqn (the one by Michel Jones) had some discussion on 
the different alignment of display math. They are also explained nicely in 
the book on typesetting math by AMS (I forget the author's name).


In principle, one can follow the same approach as Knuth did for 
line-breaking text (define penalties and then solve a dynamic program to 
find the layout that gives the lowest score). The breqn package does 
implement such an algorithm that works well in most cases. I wish that the 
breqn algorithm were described somethere; then one could play around 
implementing it in luatex. Trying to read breqn code to understand the 
algorithm is very difficult.


Aditya
___
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
___


Re: [NTG-context] math formula linebreak

2012-08-09 Thread Sietse Brouwer
Hi Aditya,

 I wish that the breqn algorithm were described somethere;
 then one could play around implementing it in luatex.

Have you seen the new User's Guide yet? It's from last May, very
recent, so it may not have been there yet when last you looked. It
includes the entire source code, and comments that quite thoroughly:
the ratio works out to 16 lines of comment per 26 lines of code. (A
page is about 42 lines.) And the comments go into the how, and not
just the what. Might be useful at some point in the future, if it is
indeed new.

http://ctan.unixbrain.com/macros/latex/contrib/mh/breqn.pdf

--Sietse

P.s. The lack of an index and a table of contents is criminal,
although probably due to this being a beta version (v0.98b) of the
manual. I've extracted the sections and subsection titles, albeit
without the page numbers.

== User's guide ==
1 A bit of history
2 Package loading
3 To do
4 Introduction
5 Principal features
6 Shortcomings of the package
6.1 Incompatibilities
6.2 Indention of delimited fragments
6.3 Math symbol subversion
6.4 Subscripts and superscripts
7 Incomplete
8 Package options
9 Environments and commands
9.1 Environments
9.2 Commands
10 Various environment options
11 The \@exisym package
12 Caution! Warning!
13 Examples

== Implementation ==
14 Introduction
15 Strategy
16 Prelim
17 Package options
18 Required packages
19 Some useful tools
20 Debugging
21 The \listwidth variable
22 Parameters
23 Measuring equation components
24 The dmath and dmath* environments
25 Special processing for end-of-equation
26 Preprocessing the equation body
27 Choosing optimal line breaks
28 Equation layout options
29 Centered Right-Number Equations
30 Framing an equation
31 Delimiter handling
32 Series of expressions
33 Equation groups
34 The darray environment
35 Miscellaneous
36 Wrap-up
37 To do
___
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
___


Re: [NTG-context] math formula linebreak

2012-08-09 Thread Prashanth


On 09/08/12 09:37, Steffen Wolfrum wrote:

Hi,

for nice linebreaking we can adjust math formulas by the use of NC, NR 
alignment.

But if someone only wants long formulas to fit in a defined area, and want them 
to break automatically ... is there a handy solution?

(Below are examples that don't work)

Thanks,
Steffen
---


\starttext


\placeformula
\startformula[9pt]
I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
+(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\}-\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
\stopformula



\defineframedtext
  [defbackground]
  [width=10cm,
   frame=on,
   location=paragraph]


\startdefbackground
\placeformula
\startformula[9pt]
I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
+(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\} -\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
\stopformula
\stopdefbackground





\definelayer[mylayer]


\setlayerframed
  [mylayer]
  [x=25mm,
   y=85mm,
   height=43.5mm,
   width=10cm,align=block]
  {
  \placeformula
\startformula[9pt]
I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
+(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\} -\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
\stopformula
  }

\setupbackgrounds[page][background=mylayer]






\stoptext

When I needed something like that, I used \allowbreak with inlinemath. 
In your case, you could do:

\bTABLE[frame=on,align=right,width=10cm]
\bTR
\bTD
$I=\big\{\lambda u(x_0-\pi^H K)\allowbreak+(1-\lambda)[\pi^L 
u(x_0-K+(1-\pi^L)Z_{L'})\allowbreak+(1-\pi^L)u(x_0-\pi^L 
Z_{L'})]\big\}\allowbreak -\big\{\pi^U 
u(x_0-K+(1-\pi^U)Z_{U'})\allowbreak+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.$

\eTD
\eTR
\eTABLE

This will just flow it like regular text. I don't know if this is good 
enough for your needs. If not, you can add another way to your list of 
ways ;-).


-- Prash
___
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
___

Re: [NTG-context] math formula linebreak

2012-08-09 Thread Sietse Brouwer
Addendum: I just bumped into Morten Høgholm's bachelor's thesis.
Automatic line-breaking of displayed math expressions
https://sites.google.com/site/mortenhoegholm/breqn-thesis.pdf

That thesis contains a conceptual explanation of the breqn algorithm
(or at least the algorithm he used when reimplementing breqn as
l3breqn). Might be useful if/when somebody decides to have a go at
improving ConTeXts math breaking. The thesis also contains the code of
l3breqn, but that is rather more sparsely commented than the code in
the breqn.pdf manual.

--Sietse
___
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
___

[NTG-context] beta

2012-08-09 Thread Hans Hagen

Hi,

There is a new feature in mtxrun:

As I wanted to acccess the help on the wiki, I've added a feature to 
mtxrun that can be used in an editor:


mtxrun
  --gethelp
  --url=http://www.contextgarden.net/Command/setuplist;

Actually, one can also use this:

mtxrun
  --gethelp
  --url=http://www.contextgarden.net/Command/%command%;
  --command=setuplist

So, in scite I do:

mtxrun
  --gethelp
  --url=http://www.contextgarden.net/Command/%command%;
  --command=$(CurrentWord)

and hitting F1 takes the current word and runs this command. On windows 
it effective boils down to


start the url

I have no clue what happens on unix.

Ps 1: Isn't it possible to also support /command on the wiki? It looks 
like the url resolver is case sensitive.


Ps 2: one can also run

mtxrun --script server --start --auto

and then use

mtxrun
  --gethelp

--url=http://localhost:31415/mtx-server-ctx-help.lua?command=%command%; 
--command=$(CurrentWord)


but the garden provides more info.

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
___


Re: [NTG-context] math formula linebreak

2012-08-09 Thread Hans Hagen

On 9-8-2012 20:53, Aditya Mahajan wrote:

On Thu, 9 Aug 2012, Sietse Brouwer wrote:


Steffen Wolfrum wrote:

them to break automatically ... is there a handy solution?


Aditya Mahajan wrote:

Short answer: No easy solution exists.


Is this because allowing automatic line breaks in math mode is itself
hard to implement, or is the basic mechanism possible but preventing
stupid/ugly breakpoints is hard? Because I can imagine a 70 percent
solution being a big help already.


Partly both.

The question is not so much the difficulty in choosing break-points
(which is easy: before all \mathbin atoms, after \mathpunct if needed,
etc). The hard part is how to align the split up portions, and choosing
different alignments changes the line widths, and therefore affect
future line-breaks.

The old manual of breqn (the one by Michel Jones) had some discussion on
the different alignment of display math. They are also explained nicely
in the book on typesetting math by AMS (I forget the author's name).

In principle, one can follow the same approach as Knuth did for
line-breaking text (define penalties and then solve a dynamic program to
find the layout that gives the lowest score). The breqn package does
implement such an algorithm that works well in most cases. I wish that
the breqn algorithm were described somethere; then one could play around
implementing it in luatex. Trying to read breqn code to understand the
algorithm is very difficult.


When I'm done ceaning up the pending tex and lua code, I'll look into 
these issues. It's probably not that hard to come up with a solution in 
lua (one of the pet projects on my list).


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
___


Re: [NTG-context] math formula linebreak

2012-08-09 Thread Steffen Wolfrum

Am 09.08.2012 um 22:21 schrieb Prashanth:

 
 On 09/08/12 09:37, Steffen Wolfrum wrote:
 Hi,
 
 for nice linebreaking we can adjust math formulas by the use of NC, NR 
 alignment.
 
 But if someone only wants long formulas to fit in a defined area, and want 
 them to break automatically ... is there a handy solution?
 
 (Below are examples that don't work)
 
 Thanks,
 Steffen
 ---
 
 
 \starttext
 
 
 \placeformula
 \startformula[9pt]
 I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
 +(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\}-\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
 +(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
 \stopformula
 
 
 
 \defineframedtext
  [defbackground]
  [width=10cm,
   frame=on,
   location=paragraph]
 
 
 \startdefbackground
 \placeformula
 \startformula[9pt]
 I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
 +(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\} -\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
 +(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
 \stopformula
 \stopdefbackground
 
 
 
 
 
 \definelayer[mylayer]
 
 
 \setlayerframed
  [mylayer]
  [x=25mm,
   y=85mm,
   height=43.5mm,
   width=10cm,align=block]
  {
  \placeformula
 \startformula[9pt]
 I=\big\{\lambda u(x_0-\pi^H K)+(1-\lambda)[\pi^L u(x_0-K+(1-\pi^L)Z_{L'})
 +(1-\pi^L)u(x_0-\pi^L Z_{L'})]\big\} -\big\{\pi^U u(x_0-K+(1-\pi^U)Z_{U'})
 +(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.
 \stopformula
  }
 
 \setupbackgrounds[page][background=mylayer]
 
 
 
 
 
 
 \stoptext
 
 When I needed something like that, I used \allowbreak with inlinemath. In 
 your case, you could do:
 \bTABLE[frame=on,align=right,width=10cm]
 \bTR
 \bTD
 $I=\big\{\lambda u(x_0-\pi^H K)\allowbreak+(1-\lambda)[\pi^L 
 u(x_0-K+(1-\pi^L)Z_{L'})\allowbreak+(1-\pi^L)u(x_0-\pi^L 
 Z_{L'})]\big\}\allowbreak -\big\{\pi^U 
 u(x_0-K+(1-\pi^U)Z_{U'})\allowbreak+(1-\pi^U)u(x_0-\pi^U Z_{U'})\big\}.$
 \eTD
 \eTR
 \eTABLE
 
 This will just flow it like regular text. I don't know if this is good enough 
 for your needs. If not, you can add another way to your list of ways ;-).



Hey, you skipped start/stopformula and used a $$ environment?! 
Why not, that's a quite clever approach (... actually, it's a quite efficient 
workaround for my needs).

Thank you Prash, thank you very much!
Steffen
___
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
___


Re: [NTG-context] Luatex error in latest beta (standalone)

2012-08-09 Thread Aditya Mahajan

On Fri, 3 Aug 2012, Alan Bowen wrote:


Files that used to process are now getting this error message:

! LuaTeX error ...TeXt/tex/texmf-context/tex/context/base/strc-not.lua:351:
attempt to call global 'getdeltapage' (a nil value)


This bug is still present in the latest beta.

Aditya
___
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
___


Re: [NTG-context] beta

2012-08-09 Thread Mojca Miklavec
On Thu, Aug 9, 2012 at 11:01 PM, Hans Hagen wrote:
 Hi,

 There is a new feature in mtxrun:

 As I wanted to acccess the help on the wiki, I've added a feature to mtxrun
 that can be used in an editor:

 mtxrun
   --gethelp
   --url=http://www.contextgarden.net/Command/setuplist;

sh: http://www.contextgarden.net/Command/setuplist: No such file or directory

Mojca
___
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
___


Re: [NTG-context] beta

2012-08-09 Thread Hans Hagen

On 10-8-2012 00:31, Mojca Miklavec wrote:

On Thu, Aug 9, 2012 at 11:01 PM, Hans Hagen wrote:

Hi,

There is a new feature in mtxrun:

As I wanted to acccess the help on the wiki, I've added a feature to mtxrun
that can be used in an editor:

mtxrun
   --gethelp
   --url=http://www.contextgarden.net/Command/setuplist;


sh: http://www.contextgarden.net/Command/setuplist: No such file or directory


So what would be the right way? Is there some abstract shortcut to the 
preferred browser?


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
___


Re: [NTG-context] Luatex error in latest beta (standalone)

2012-08-09 Thread Hans Hagen

On 9-8-2012 23:25, Aditya Mahajan wrote:

On Fri, 3 Aug 2012, Alan Bowen wrote:


Files that used to process are now getting this error message:

! LuaTeX error
...TeXt/tex/texmf-context/tex/context/base/strc-not.lua:351:
attempt to call global 'getdeltapage' (a nil value)


This bug is still present in the latest beta.


Ah ... name typo .. I'll fix it (you can fix the function name a few 
lines above where you grep it).


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
___


Re: [NTG-context] beta

2012-08-09 Thread Mojca Miklavec
On Fri, Aug 10, 2012 at 12:35 AM, Hans Hagen wrote:
 On 10-8-2012 00:31, Mojca Miklavec wrote:

 On Thu, Aug 9, 2012 at 11:01 PM, Hans Hagen wrote:

 Hi,

 There is a new feature in mtxrun:

 As I wanted to acccess the help on the wiki, I've added a feature to
 mtxrun
 that can be used in an editor:

 mtxrun
--gethelp
--url=http://www.contextgarden.net/Command/setuplist;


 sh: http://www.contextgarden.net/Command/setuplist: No such file or
 directory


 So what would be the right way? Is there some abstract shortcut to the
 preferred browser?

On Mac OS X it is
open url/file
or
open -a SomeApplicationInCaseYouDontWantDefault url/file.

Mojca
___
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
___


Re: [NTG-context] beta

2012-08-09 Thread Hans Hagen

On 10-8-2012 00:39, Mojca Miklavec wrote:

On Fri, Aug 10, 2012 at 12:35 AM, Hans Hagen wrote:

On 10-8-2012 00:31, Mojca Miklavec wrote:


On Thu, Aug 9, 2012 at 11:01 PM, Hans Hagen wrote:


Hi,

There is a new feature in mtxrun:

As I wanted to acccess the help on the wiki, I've added a feature to
mtxrun
that can be used in an editor:

mtxrun
--gethelp
--url=http://www.contextgarden.net/Command/setuplist;



sh: http://www.contextgarden.net/Command/setuplist: No such file or
directory



So what would be the right way? Is there some abstract shortcut to the
preferred browser?


On Mac OS X it is
 open url/file
or
 open -a SomeApplicationInCaseYouDontWantDefault url/file.


Ah, i remember, so we can adapt

  os.launch

I'll send you a test

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
___


Re: [NTG-context] beta

2012-08-09 Thread Philipp Gesang
···date: 2012-08-10, Friday···from: Hans Hagen···

 On 10-8-2012 00:31, Mojca Miklavec wrote:
 On Thu, Aug 9, 2012 at 11:01 PM, Hans Hagen wrote:
 Hi,
 
 There is a new feature in mtxrun:
 
 As I wanted to acccess the help on the wiki, I've added a feature to mtxrun
 that can be used in an editor:
 
 mtxrun
--gethelp
--url=http://www.contextgarden.net/Command/setuplist;
 
 sh: http://www.contextgarden.net/Command/setuplist: No such file or directory
 
 So what would be the right way? Is there some abstract shortcut to
 the preferred browser?

Hi Hans, there’s the environment variable $BROWSER, as in:

Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 return os.getenvBROWSER
/usr/bin/opera
 

So ``$BROWSER http://www.foo.bar`` launches the browser from a
shell.

Philipp


 
 -
   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
 ___

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments


pgpx6cPvd7rc3.pgp
Description: PGP signature
___
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
___