Re: [NTG-context] Example ConTeXt document: PS output

2010-07-12 Thread Hans Hagen

On 11-7-2010 7:39, luigi scarso wrote:

2010/7/11 Ivo Solnickýivo.solni...@gmail.com:


Now (not addressed to Mojca), please don't be a smartarse and tell me
(again) that this is all volunteer work and to send in patches, a new
Device Independent file definition and implementation for Unicode.
I'm full of admiration for you guys with the giant IQs who have
created ConTeXt in tea breaks and at night, never taken a second of
time from the employer, publishing house or university or hairdressing
salon proprietor that pays you.  But I don't pretend to be in that
class.  I'm just a mental midget.  And I have other things to do.  It
ain't my project.  Something else is.



Maybe LuaLaTeX should work for you.

But even so there is a dvi-to-ps step to do,
which is pratically the same of pdf-to-ps
in context mkiv.


one of the reasons behind pdf is that it takes the programming language 
out of ps which means (1) better portability, (2) faster rendering


in addition to that pdf provides a couple of goodies irrelevant to 
printers (annotations and such)


dvi as outputformat is fine, but you then need to inject extra code for 
each (fundamentally) different backend


tex + specials - dvi - ps - pdf
tex + specials - dvi - pdf
tex + literals - pdf (pdftex)

now, as ps is seldom needed as final format it makes no sense generate 
it (and going from pdf - ps is easy)


using specials (inlined code) is no fun but has alway sbeen supported in 
mkii (spec-* files) using an intermediate layer


in mkiv we have

tex - pdf

so no specials and hardly any literals at the tex which is much cleaner; 
of course there can be more backends but a ps one is unlikely


although in principle mkiv could be made to provide dvi to be fed in 
some backend driver i see no advantage in that


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
___


[NTG-context] How to sort in Lua using locale?

2010-07-12 Thread Mojca Miklavec
Hello,

I would like to create a document using some functionality that is
pretty close to creating an index, but the built-in index creation
code doesn't suffice. My main question is: how do I sort strings using
the built-in sorting rules for the current language?

Here is an example with a table of names:

names = {
{first=Hans, last=Hagen},
{first=Hartmut, last=Henkel},
{first=Taco, last=Hoekwater},
{first=Caron, last=Haček}
{first=Ančka, last=Car}
{first=Ana, last=Car}
{first=Anita, last=Car}
{first=Matija, last=Čop}
}

and I want to print out the following:

\section{C}
\person{Car}{Ana}
\person{Car}{Ančka}
\person{Car}{Anita}

\section{Č}
\person{Čop}{Matija}

\section{H}
\person{Haček}{Caron}
\person{Hagen}{Hans}
\person{Henkel}{Hartmut}
\person{Hoekwater}{Taco}

The following code works for English and needs a fix to respect local
sorting rules. I would be grateful for any hint before reinventing the
wheel (the hint can also be a pointer to the right line of ConTeXt
source code that does the sorting; I was a bit lost in the code).

\mainlanguage[sl]
\setuphead[section][style=\bf,before=\blank,after=,number=no]
\def\person#1#2{\hbox{{\sc #1}, #2}}

\starttext

Code that needs fixing:

\startluacode

names = {
{first=Hans,last=Hagen},
{first=Hartmut, last=Henkel},
{first=Taco,last=Hoekwater},
{first=Caron,   last=Haček},
{first=Ančka,   last=Car},
{first=Ana, last=Car},
{first=Anita,   last=Car},
{first=Matija,  last=Čop},
}

-- this should sort with local sorting rules; how?
function sort_names(a,b)
if (a.last == b.last) then
return a.firstb.first
else
return a.lastb.last
end
end

-- this is extremely ugly and needs to be fixed
-- with some UTF-8 library
function first_letter(str)
if (string.byte(str,1)127) then
return string.sub(str,1,2)
else
return string.sub(str,1,1)
end
end

table.sort(names, sort_names)

for k,v in pairs(names) do
-- nested tables would also be an option; but are not required
if (k==1) or (k1 and (first_letter(names[k-1].last) ~=
first_letter(v.last))) then
tex.print(string.format('\\section{%s}', first_letter(v.last)))
end
tex.print(string.format('\\person{%s}{%s}', v.last, v.first))
end

\stopluacode

\crlf\crlf

Desired result:

\section{C}
\person{Car}{Ana}
\person{Car}{Ančka}
\person{Car}{Anita}

\section{Č}
\person{Čop}{Matija}

\section{H}
\person{Haček}{Caron}
\person{Hagen}{Hans}
\person{Henkel}{Hartmut}
\person{Hoekwater}{Taco}

\stoptext

Thanks a lot,
   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] How to sort in Lua using locale?

2010-07-12 Thread Hans Hagen

On 12-7-2010 12:30, Mojca Miklavec wrote:

Hello,

I would like to create a document using some functionality that is
pretty close to creating an index, but the built-in index creation
code doesn't suffice. My main question is: how do I sort strings using
the built-in sorting rules for the current language?


\startluacode
document.whatever =  { names = { } }

function document.whatever.sortnames()
local names = document.whatever.names
local split = sorters.splitters.utf
for i=1,#names do
local name = names[i]
name.split = {
split(name.last),
split(name.first),
}
end
sorters.sort(names, sorters.comparers.basic)
end

function document.whatever.flushnames()
local names = document.whatever.names
local previous = false
for i=1,#names do
local name = names[i]
local letter, current = sorters.firstofsplit(name)
if previous ~= current then
previous = current
context.section(letter)
end
context.person(name.last,name.first)
end
end

document.whatever.names = {
{ first = Hans,last = Hagen },
{ first = Hartmut, last = Henkel },
{ first = Taco,last = Hoekwater },
{ first = Caron,   last = Haček },
{ first = Ančka,   last = Car },
{ first = Ana, last = Car },
{ first = Anita,   last = Car },
{ first = Matija,  last = Čop },
}

sorters.setlanguage(sl)
document.whatever.sortnames()
document.whatever.flushnames()
\stopluacode

-
  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] parsing issue with \math{} inside natural table

2010-07-12 Thread Hans Hagen

On 9-7-2010 10:12, Brian R. Landy wrote:

Hi, I ran into a case where a natural table has an issue when it
contains inline math and an alignment character is used. Here's a small
example which triggers the problem:

\starttext
\bTABLE
\bTABLEbody
\bTR
\bTD[alignmentcharacter={.},aligncharacter=yes]{\le 4.0\math{-}}\eTD
\eTR
\eTABLEbody
\eTABLE
\stoptext

However, if I replace \math{-} with $-$, the file works. Am I correct
that $-$ and \math{-} should be interchangeable?


side effect of alignmentcharacter that triggers expansion of cell 
content, so just use $ here


-
  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] Better support for Croatian in lang-sla.tex (patch included)

2010-07-12 Thread Hans Hagen

On 11-7-2010 11:46, Vedran Miletić wrote:

Here is a better patch, with new strings translated and v!appendix
commented as in lang-ger.tex.

I could also add support for Serbian latin, but I have no idea how to
add new language that will allow both latin and cyrilic.


we need to define what that means then ... as i can imagine only 
combining multiple languages with respect to hyphenation


in that case it's not so much a new language as more a matter of 
defining patterns


in mkii this is not feasible due to the relationship between fonts and 
languages etc but in mkiv it's quite doable


i actually have a mkiv prototype for that but as it breaks a few things 
i have to redo it so it it will show up some time soon


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] Serbian: Latin vs. Cyrillic

2010-07-12 Thread Vedran Miletić
Datuma 11. srpnja 2010. 13:24 Mojca Miklavec
mojca.miklavec.li...@gmail.com je napisao/la:
 It would be great if ConTeXt supported:

 \mainlanguage
    [serbian]
    [script=latin | cyrillic]

 as well as

 \mainlanguage
    [english]
    [variant=american | british]

 etc. This is what Polyglossia does and I find it nice.

+1. How hard would it be to implement that?

-- 
Vedran Miletić
___
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] Serbian: Latin vs. Cyrillic

2010-07-12 Thread Hans Hagen

On 12-7-2010 4:00, Vedran Miletić wrote:

Datuma 11. srpnja 2010. 13:24 Mojca Miklavec
mojca.miklavec.li...@gmail.com  je napisao/la:

It would be great if ConTeXt supported:

\mainlanguage
[serbian]
[script=latin | cyrillic]

as well as

\mainlanguage
[english]
[variant=american | british]

etc. This is what Polyglossia does and I find it nice.


+1. How hard would it be to implement that?


i have no clue what it means but we have already inheritance in place 
since ages


so effectively we have:

\installlanguage [usenglish]   [en-us]
\installlanguage [ukenglish]   [en-gb]
\installlanguage [english] [en-us]

and adding

\installlanguage [brittish][en-uk]

is no big deal

i see no advantage in adding yet another mechanism for that

with regards to script ... not sure how that relates as the language 
mechanism does two things


- labels and conventions (time, date, numbering, quoting, ...)
- hyphenation control

-
  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] Better support for Croatian in lang-sla.tex (patch included)

2010-07-12 Thread Mojca Miklavec
2010/7/12 Hans Hagen pra...@wxs.nl:
 On 11-7-2010 11:46, Vedran Miletić wrote:

 Here is a better patch, with new strings translated and v!appendix
 commented as in lang-ger.tex.

 I could also add support for Serbian latin, but I have no idea how to
 add new language that will allow both latin and cyrilic.

 we need to define what that means then ... as i can imagine only combining
 multiple languages with respect to hyphenation

In case of Serbian it's in fact about dealing with two completely
different languages in terms of TeX. Latin script and Cyrillic
script require different patterns, different font encodings and
different labels.

The \mainlanguage[serbian][script=latin] and [script=cyrillic] would
only be a more elegant/proper way as opposed to
\mainlanguage[serbian-latn] and \mainlanguage[serbian-cyrl] (or
serbian-latin or serbianl or sr-latn or ...). In reality the two
should be two different languages, the second parameter would only be
a more elegant way, like for German. Polyglossia has
[german][spelling=old/new] (or something similar).

If you simply choose two names for language (for example sr-latn and
sr-cyrl), it should be straightforward to add both languages to MKII
as well.

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] Better support for Croatian in lang-sla.tex (patch included)

2010-07-12 Thread Hans Hagen

On 12-7-2010 6:01, Mojca Miklavec wrote:

2010/7/12 Hans Hagenpra...@wxs.nl:

On 11-7-2010 11:46, Vedran Miletić wrote:


Here is a better patch, with new strings translated and v!appendix
commented as in lang-ger.tex.

I could also add support for Serbian latin, but I have no idea how to
add new language that will allow both latin and cyrilic.


we need to define what that means then ... as i can imagine only combining
multiple languages with respect to hyphenation


In case of Serbian it's in fact about dealing with two completely
different languages in terms of TeX. Latin script and Cyrillic
script require different patterns, different font encodings and
different labels.

The \mainlanguage[serbian][script=latin] and [script=cyrillic] would
only be a more elegant/proper way as opposed to
\mainlanguage[serbian-latn] and \mainlanguage[serbian-cyrl] (or
serbian-latin or serbianl or sr-latn or ...). In reality the two
should be two different languages, the second parameter would only be
a more elegant way, like for German. Polyglossia has
[german][spelling=old/new] (or something similar).


so that would eventually expand to

\mainlanguage[serbian-\languageparameter{script}-\languageparameter{spelling}-..-\languageparameter{whoknowswhat}]

the danger of that approach is that we end up with as many keys as 
languages because most are only used (ok, they are probably then also 
misused) for one case (and no one knows what's used for what then)


in mkiv i'd like to follow another route also because we might want to 
bring more typographical issues in the game


for instance, although not yet interfaced there is a difference between

labellanguage
headlanguage
mathlabellanguage

that takes care of labels but we migth need something country related 
for dates, maybe


conversioncountry

and for patterns we can just use

patternset

when setting up a specific language we then choose a preset i.e. a 
combination of settings and serbian-latin is quite ok then


this all is something i'm working on and is also influenced by 
discussions in the oriental tex team



If you simply choose two names for language (for example sr-latn and
sr-cyrl), it should be straightforward to add both languages to MKII
as well.


in mkii one can mix font encodings and multiple font encodings can be 
set up per language; so, it should be possible to define a language with 
two encodings and then when a font switch takes place the right ones 
will be chosen. But anyhow, mkii will not be extended and certainly not 
in areas were there was never any demand.


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] parsing issue with \math{} inside natural table

2010-07-12 Thread Brian R. Landy
Thanks for the reply.  I'm actually generating TeX from an application 
that interprets $ in it's own code and occasionally this causes me 
trouble in passing the $ through to TeX to use in math mode (I think 
they have a bug and am hoping I can get that fixed).  So I tend to use 
\math{}  to avoid complications with escaping $, but was stuck in this 
case because I couldn't use $ or \math{}.


Anyway, I just now solved my problem in the other application and am 
able pass through $ appropriately so it's no longer an issue for me.


Thanks,
Brian

On Mon, 12 Jul 2010, Hans Hagen wrote:


On 9-7-2010 10:12, Brian R. Landy wrote:

Hi, I ran into a case where a natural table has an issue when it
contains inline math and an alignment character is used. Here's a 
small

example which triggers the problem:

\starttext
\bTABLE
\bTABLEbody
\bTR
\bTD[alignmentcharacter={.},aligncharacter=yes]{\le 4.0\math{-}}\eTD
\eTR
\eTABLEbody
\eTABLE
\stoptext

However, if I replace \math{-} with $-$, the file works. Am I correct
that $-$ and \math{-} should be interchangeable?


side effect of alignmentcharacter that triggers expansion of cell 
content, so just use $ here


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



___
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] parsing issue with \math{} inside natural table

2010-07-12 Thread Aditya Mahajan

On Mon, 12 Jul 2010, Brian R. Landy wrote:

Thanks for the reply.  I'm actually generating TeX from an application that 
interprets $ in it's own code and occasionally this causes me trouble in 
passing the $ through to TeX to use in math mode (I think they have a bug and 
am hoping I can get that fixed).  So I tend to use \math{}  to avoid 
complications with escaping $, but was stuck in this case because I couldn't 
use $ or \math{}.


With expansion problems, sometimes using \noexpand\math{...} works.

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
___


[NTG-context] \frac with Cambria

2010-07-12 Thread luigi scarso
\usetypescript[cambria]
\setupbodyfont[cambria,8pt]
\starttext
\inlinemath{\displaystyle\frac{(1-0.1) -
0.89803921568627}{1-0.1}}%
{\switchtobodyfont[modern,8pt] \inlinemath{\displaystyle\frac{(1-0.1) -
0.89803921568627}{1-0.1}}}
\stoptext

IMO the numerator with cambria is too much distant from fraction's
line: the same with LatinModern looks better.
Denominator looks ok.
-- 
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] Better support for Croatian in lang-sla.tex (patch included)

2010-07-12 Thread Vyatcheslav Yatskovsky

On 12.07.2010 21:23, ntg-context-requ...@ntg.nl wrote:

we need to define what that means then ... as i can imagine only
combining multiple languages with respect to hyphenation


Much anticipated!

--
Best Regards,
Vyatcheslav Yatskovsky
___
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
___