Re: [NTG-context] Style file for iPad?
In article <20120306134022.GB29209@khaled-laptop>, Khaled Hosny wrote: > On Tue, Mar 06, 2012 at 10:40:20PM +1100, Alasdair McAndrew wrote: > > Yes, but what ebook formats handle mathematics and diagrams? > > Plus the poor layout support in almost all ebook readers (brain dead > paragraph builder, no hyphenation, no OpenType support etc. etc. they > are usually pieces of junk for any remotely complex text layout job). It's worse than pre-TeX printed books. Which makes me wonder: is anyone in the world addressing this? Are there people in the TeX community involved in the standardization processes (say, Epub3, but also the various W3C specifications), who could push forward ideas from TeX, like minimum requirements for the algorithms that rendering engines should use? These questions (together with sighs) arise every time I see a web page especially with mathematical notation… Nicola ___ 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] Hooking \stoptext
Hello, I'd need to to hook \stoptext by Lua - I'd need to write something right before the end of the text. See the simple example: t-Hook.mkiv \startluacode local stoptext_p = context.stoptext context.stoptext = function(...) context("END") stoptext_p(...) end \stopluacode \starttext \input knuth \stoptext % To be hooked by Lua This code should write "END" right before the end of the document, but it doesn't. How to achieve that? - I'd rather Lua to TeX do the job as I need Lua to do more complicated things (the example above is very simplified). TIA. Best regards, Lukas -- 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 t-Hook.mkiv Description: Binary data t-Hook.pdf Description: Adobe PDF document ___ 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] Hooking \stoptext
2012/3/7 Procházka Lukáš Ing. - Pontex s. r. o. > Hello, > > I'd need to to hook \stoptext by Lua - I'd need to write something right > before the end of the text. > At least \let\Oldstoptext\stoptext \def\stoptext{% \startluacode context("END") \stopluacode \Oldstoptext} \starttext \input knuth \stoptext % To be hooked by Lua But there are several \every* tokens list for this. -- luigi ___ 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] Hooking \stoptext
On Wed, Mar 7, 2012 at 3:39 PM, luigi scarso wrote: > > > 2012/3/7 Procházka Lukáš Ing. - Pontex s. r. o. > > Hello, >> >> I'd need to to hook \stoptext by Lua - I'd need to write something right >> before the end of the text. >> > > At least > \let\Oldstoptext\stoptext > \def\stoptext{% > \startluacode > context("END") > \stopluacode > \Oldstoptext} > > > > \starttext > \input knuth > \stoptext % To be hooked by Lua > > > But there are several \every* tokens list for this. > -- > luigi > > \appendtoks% \startluacode context("END") \stopluacode \to\everylastshipout \starttext \showframe \input knuth \page \input tufte \stoptext % To be hooked by Lua It's hooked by Lua too, but is it what you want ? -- luigi ___ 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] Hooking \stoptext
... OK, your solution works - - But I'd need one which doesn't force user to hook manually; i.e. without: \let\Oldstoptext\stoptext \def\stoptext{% \startluacode context("END") \stopluacode \Oldstoptext } Hooking should be performed in a Lua function and should be "invisible" to the user. More complicated example: t-Hook4.mkiv \startluacode function foo() local stoptext_p = context.stoptext context.stoptext = function(...) context("END") stoptext_p(...) end end \stopluacode \starttext \input knuth \ctxlua{foo()} % This should cause "END" to appear at the end of the document \stoptext In this case, "foo()" is a function which does the hooking; and "foo()" may be placed in another file or Lua toolbox, so user is to call Lua's "require 'my-Lua-toolbox-with-foo' foo()". So user is not forced to know how the function works; once he uses it, the text "END" will appear at the end of the document. - And this doesn't happen to me; and my goal is to make it work. Lukas On Wed, 07 Mar 2012 15:39:23 +0100, luigi scarso wrote: 2012/3/7 Procházka Lukáš Ing. - Pontex s. r. o. Hello, I'd need to to hook \stoptext by Lua - I'd need to write something right before the end of the text. At least \let\Oldstoptext\stoptext \def\stoptext{% \startluacode context("END") \stopluacode \Oldstoptext} \starttext \input knuth \stoptext % To be hooked by Lua But there are several \every* tokens list for this. -- 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 t-Hook4.mkiv Description: Binary data t-Hook4.pdf Description: Adobe PDF document ___ 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] Hooking \stoptext
On 2012-03-07 15:28, Procházka Lukáš Ing. - Pontex s. r. o. wrote: > Hello, > > I'd need to to hook \stoptext by Lua - I'd need to write something right > before the end of the text. > > See the simple example: > > t-Hook.mkiv > \startluacode > local stoptext_p = context.stoptext > > context.stoptext = function(...) > context("END") > stoptext_p(...) > end > \stopluacode > > \starttext > \input knuth > \stoptext % To be hooked by Lua > > > This code should write "END" right before the end of the document, but it > doesn't. context.stoptext() just calls “\stoptext”, not the other way round. Btw CLD are implemented as metatable so afaik you would have to redefine the “__index” attribute. > How to achieve that? \startluacode local old_stoptext = commands.stoptext commands.stoptext = function(...) context"END" old_stoptext(...) end \stopluacode \starttext \input knuth \stoptext % To be hooked by Lua Cf. file.job.mkvi at line 107. Hth Philipp > > - I'd rather Lua to TeX do the job as I need Lua to do more complicated > things (the example above is very simplified). > > TIA. > > Best regards, > > Lukas > > > -- > 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 > ___ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments pgpTUvNSb5rPL.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 ___
Re: [NTG-context] Hooking \stoptext
... Yes, that's it! Thanks a lot! Best regards, Lukas On Wed, 07 Mar 2012 16:50:01 +0100, Philipp Gesang wrote: On 2012-03-07 15:28, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello, I'd need to to hook \stoptext by Lua - I'd need to write something right before the end of the text. See the simple example: t-Hook.mkiv \startluacode local stoptext_p = context.stoptext context.stoptext = function(...) context("END") stoptext_p(...) end \stopluacode \starttext \input knuth \stoptext % To be hooked by Lua This code should write "END" right before the end of the document, but it doesn't. context.stoptext() just calls “\stoptext”, not the other way round. Btw CLD are implemented as metatable so afaik you would have to redefine the “__index” attribute. How to achieve that? \startluacode local old_stoptext = commands.stoptext commands.stoptext = function(...) context"END" old_stoptext(...) end \stopluacode \starttext \input knuth \stoptext % To be hooked by Lua Cf. file.job.mkvi at line 107. Hth Philipp - I'd rather Lua to TeX do the job as I need Lua to do more complicated things (the example above is very simplified). TIA. Best regards, Lukas -- 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 ___ -- 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] Style file for iPad?
On Mar 7, 2012, at 3:34 AM, Nicola wrote: > It's worse than pre-TeX printed books. Which makes me wonder: is anyone in > the > world addressing this? Are there people in the TeX community involved in the > standardization processes (say, Epub3, but also the various W3C > specifications), > who could push forward ideas from TeX, like minimum requirements for the > algorithms that rendering engines should use? These questions (together with > sighs) arise every time I see a web page especially with mathematical > notation… The problem is, since the rendering is based on HTML, people just grab a web browser framework and build on that to make an ebook viewer. Here's a post I wrote up once comparing a specific ePub display on a specific viewing program w/ a hand-tweaked Plain TeX version: http://www.mobileread.com/forums/showpost.php?p=1371218&postcount=7 > those who're curious may find it educational to compare my .pdf w/ this ePub > version to see the sort of typographic infelicities which even in the best > ePub version can't be controlled for --- > - one word last lines > - # of lines on a page constantly changing to prevent widows / orphans > - overly loose line on the middle of pg. 20 > - 3 word stack on pg. 21 (meditation/Meditation) > - 2 word stack on pg. 32 (black) > - 2 word stack on pg. 37 (the) Twice! > - six word river on pg. 40 (the/their/the/the/its/we) > - 2 word stacks on pg. 40 (a & We) > - 3 word stack on pg. 46 (the/the/The) > - 2 word stack on pg. 47 (a) > - awkward break at the bottom of the first page of Chapter VII where the > poem is referred to, but appears on the following page > (when viewed in Sony's ebook viewing program)). In the .pdf I believe there > were only one or two places where I let two word stacks stand (because they > were intractable) --- will have to try again using xetex and margin > protrusion and character expansion (I'd used DEK's macro for hanging > punctuation from _The TeXbook_). William -- William Adams senior graphic designer Fry Communications Sphinx of black quartz, judge my vow. ___ 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] Page Header Text with Two Lines
Hi All, I tried to setup a page header with two lines using a command like this: \setupheadertexts[Left Text][Right Text 1. \crlf Right Text 2] but the \crlf command gets ignored. How do I achieve this? Best regards, Emmanuel ___ 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] Page Header Text with Two Lines
On 2012-03-07 Emmanuel Asante wrote: > I tried to setup a page header with two lines using a command like this: > >\setupheadertexts[Left Text][Right Text 1. \crlf Right Text 2] > > but the \crlf command gets ignored. How do I achieve this? \setupheadertexts [Left Text] [\setups{header:right}] \startsetups header:right \framed [align=broad,frame=off] {Right Text 1. \\ Right Text 2} \stopsetups \starttext Foo Bar \stoptext Marco ___ 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] Page Header Text with Two Lines
On Wed, Mar 7, 2012 at 9:58 AM, Marco wrote: > On 2012-03-07 Emmanuel Asante wrote: > > > I tried to setup a page header with two lines using a command like this: > > > >\setupheadertexts[Left Text][Right Text 1. \crlf Right Text 2] > > > > but the \crlf command gets ignored. How do I achieve this? > > > \setupheadertexts [Left Text] [\setups{header:right}] > > \startsetups header:right >\framed [align=broad,frame=off] >{Right Text 1. \\ Right Text 2} > \stopsetups > > \starttext >Foo Bar > \stoptext > > > Marco > > Thanks, Marco, for the solution. It works. > > > ___ > 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 ___
Re: [NTG-context] Hooking \stoptext
Am 07.03.2012 um 16:57 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > ... Yes, that's it! Thanks a lot! You can also write your own stop/stop-commands for the document like \def\startmydocument {\starttext} \def\stopmydocument {\ctxlua{…}% \stoptext} and use them instead of \starttext and \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] Style file for iPad?
A while ago I grabbed some mathematics book samples for the Kindle. These were books produced by well-known publishing companies, retailing for considerable sums (even in the electronic versions), and in all of them the mathematics typesetting was atrocious. I think that in most (all?) ebook formats, a formula is included as an image, which means that it automatically resizes. This means that formulas may be of all different sized fonts, which gives the result a very scrappy look. At least PDF - even if not designed for ebook reading - provides decent layout. The problem is not just mathematics. I have some ebooks about poetry, and in them the included poems (as set off from the surrounding text), seem to be typeset almost randomly, with regard to layout, font size and spacing. And these are commercial ebooks, for which I paid real Earth dollars! -Alasdair On Thu, Mar 8, 2012 at 3:30 AM, William Adams wrote: > On Mar 7, 2012, at 3:34 AM, Nicola wrote: > > > It's worse than pre-TeX printed books. Which makes me wonder: is anyone > in the > > world addressing this? Are there people in the TeX community involved in > the > > standardization processes (say, Epub3, but also the various W3C > specifications), > > who could push forward ideas from TeX, like minimum requirements for the > > algorithms that rendering engines should use? These questions (together > with > > sighs) arise every time I see a web page especially with mathematical > notation… > > The problem is, since the rendering is based on HTML, people just grab a > web browser framework and build on that to make an ebook viewer. > > Here's a post I wrote up once comparing a specific ePub display on a > specific viewing program w/ a hand-tweaked Plain TeX version: > > http://www.mobileread.com/forums/showpost.php?p=1371218&postcount=7 > > > those who're curious may find it educational to compare my .pdf w/ this > ePub version to see the sort of typographic infelicities which even in the > best ePub version can't be controlled for --- > > > - one word last lines > > - # of lines on a page constantly changing to prevent widows / orphans > > - overly loose line on the middle of pg. 20 > > - 3 word stack on pg. 21 (meditation/Meditation) > > - 2 word stack on pg. 32 (black) > > - 2 word stack on pg. 37 (the) Twice! > > - six word river on pg. 40 (the/their/the/the/its/we) > > - 2 word stacks on pg. 40 (a & We) > > - 3 word stack on pg. 46 (the/the/The) > > - 2 word stack on pg. 47 (a) > > - awkward break at the bottom of the first page of Chapter VII where > the poem is referred to, but appears on the following page > > > (when viewed in Sony's ebook viewing program)). In the .pdf I believe > there were only one or two places where I let two word stacks stand > (because they were intractable) --- will have to try again using xetex and > margin protrusion and character expansion (I'd used DEK's macro for hanging > punctuation from _The TeXbook_). > > William > > -- > William Adams > senior graphic designer > Fry Communications > Sphinx of black quartz, judge my vow. > > > ___ > 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 > > ___ > -- Blog: http://amca01.wordpress.com Web: http://sites.google.com/site/amca01/ Facebook: http://www.facebook.com/alasdair.mcandrew ___ 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] Hooking \stoptext
Am 07.03.2012 um 18:37 schrieb Wolfgang Schuster: > > Am 07.03.2012 um 16:57 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > >> ... Yes, that's it! Thanks a lot! > > You can also write your own stop/stop-commands for the document like > > \def\startmydocument > {\starttext} > > \def\stopmydocument > {\ctxlua{…}% > \stoptext} > > and use them instead of \starttext and \stoptext. Or you use the predefined document environment which has before and after keys. \setupdocument[after={\blank\midaligned{\bf THE END}}] \startdocument \input knuth \stopdocument 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 ___