Re: [NTG-context] mixed English and Arabic using Simplefonts?

2010-10-02 Thread Khaled Hosny
On Sat, Oct 02, 2010 at 06:32:05AM +0200, Wolfgang Schuster wrote:
 
 Am 02.10.2010 um 02:16 schrieb Talal Al-Azem:
 
  My apologies if I'm dumbing down the level of discussion here. But I'm 
  trying to get my head around fonts and bidirectionality using ConTeXt MkIV 
  (as a rather unsophisticated user, not as a developer). 
  
  To begin with, since it's all bit much at once, I'm trying to use 
  simplefonts. I am unclear how to establish English as my language and its 
  font as my main font (using the default font), and Arabic as a secondary 
  language (using Scheherazade).
  
  What would I change in the ara-sty environment found on 
  wiki.contextgarden.net/Arabic_and_Hebrew? Or, if I don't need to use this, 
  should I define my own macro in my tex document for directionality?
  
  I'm probably making a mess of some basic things here, but could use some 
  help. I have working familiarity with Fontspec over on the XeLaTeX side of 
  things, but the sparse documentation of simplefonts is leading to my 
  uncertainty as how to proceed.
 
 \usemodule[simplefonts]
 
 %\setmainfont[Antykwa Poltawskiego]
 \setmainfontfallback[Scheherazade][range={arabic,arabicpresentationformsa,arabicpresentationformsb,arabicsupplement}]

I think there is no need for presentation forms, they are deprecated
symbols not used for entering text.

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
___
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] \structureheadnumber does not work before first section

2010-10-02 Thread Vianney le Clément
Hi,

I'm trying to get the last section number using
\structureheadnumber[section][last]. This works fine inside a section,
but expands to nothing when used at the beginning of the document.

Here is a minimal example:

\starttext
Last: \structureheadnumber[section][last]
\dorecurse{4}
  {\section{Test #1}
   Last: \structureheadnumber[section][last]}
\stoptext

Vianney
___
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] Simple Bibliography

2010-10-02 Thread Elias Oltmanns
Hi there,

in the attempt to stich together a simple bibliography, I don's seem to
get as far as I'd have liked. The layout of the bibliography should look
something like this:

+--+
| authora:   title of book |
| authorb, F.:   opus magnum with a rather |
|   title and ref. details |
| authord, authore: another important book |
+--+

To achieve this, I'm thinking of something along these lines:

\definedescription[bibitem][
  location=left,align=flushright,sample={ longest author},width=broad,
  command=\BibCommand]
\def\BibCommand#1{#1:}
\starttext
\chapter{Bibliography}
\bibitem{authora} title of book

\bibitem{authorb, F.} opus magnum with a rather title and ref. details

\bibitem{authord, authore} another important book
\stoptext

Alas, it doesn't work out as expected. Can someone give a few hints
towards a working example? It should compile under MkII too.

Thanks for your help,

Elias
___
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] Updating ConTeXt using TeX Live 2010 (Linux)

2010-10-02 Thread Daniel Grycman
Hello list,

after updating ConText to beta I get the following error message.

../mtx-context.lua:669: attempt to call field 'locateformat' (a nil value)

Any ideas?

Daniel


___
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] Updating ConTeXt using TeX Live 2010 (Linux)

2010-10-02 Thread Khaled Hosny
On Sat, Oct 02, 2010 at 04:52:37PM +0200, Daniel Grycman wrote:
 Hello list,
 
 after updating ConText to beta I get the following error message.
 
 ../mtx-context.lua:669: attempt to call field 'locateformat' (a nil value)
 
 Any ideas?

Don't update ConTeXt in TeXLive manually, if you want the latest and
greatest beta use minimals.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
___
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] mixed English and Arabic using Simplefonts?

2010-10-02 Thread Talal Al-Azem
Dear Wolfgang and Khaled,

Thank you both for your replies. This has been very helpful. May I ask one 
further newbie question of simplefonts: how do I change the font for just the 
fallback font, without affecting the mainfont? Is there a way to do this by 
setting the size in points, or in scale (percentage), or some other fashion?

In fontspec, i was accustomed to something like:

\newfontfamily{\arfont}[Script=Arabic,Scale=1.66,WordSpace=1.66]{Scheherazade-Regular}

I am sure there are equivalents for these feature (size, scale, wordspace); 
I've seen many features in the simplefonts pdf. But i'm unsure how to define 
something like arfont using simplefonts.

Many thanks,
Talal

 
 \usemodule[simplefonts]
 
 %\setmainfont[Antykwa Poltawskiego]
 \setmainfontfallback[Scheherazade][range={arabic,arabicpresentationformsa,arabicpresentationformsb,arabicsupplement}]
 
 \starttext
 
 \input knuth
 
 \textdir TRT  ???!
 
 \stoptext
 
 Wolfgang
 
 
 
 --
 
 Message: 3
 Date: Sat, 2 Oct 2010 11:25:12 +0200
 From: Khaled Hosny khaledho...@eglug.org
 To: mailing list for ConTeXt users ntg-context@ntg.nl
 Subject: Re: [NTG-context] mixed English and Arabic using Simplefonts?
 Message-ID: 20101002092512.ga1...@khaled-laptop
 Content-Type: text/plain; charset=utf-8
 
 On Sat, Oct 02, 2010 at 06:32:05AM +0200, Wolfgang Schuster wrote:
 
 Am 02.10.2010 um 02:16 schrieb Talal Al-Azem:
 
 My apologies if I'm dumbing down the level of discussion here. But I'm 
 trying to get my head around fonts and bidirectionality using ConTeXt MkIV 
 (as a rather unsophisticated user, not as a developer). 
 
 To begin with, since it's all bit much at once, I'm trying to use 
 simplefonts. I am unclear how to establish English as my language and its 
 font as my main font (using the default font), and Arabic as a secondary 
 language (using Scheherazade).
 
 What would I change in the ara-sty environment found on 
 wiki.contextgarden.net/Arabic_and_Hebrew? Or, if I don't need to use this, 
 should I define my own macro in my tex document for directionality?
 
 I'm probably making a mess of some basic things here, but could use some 
 help. I have working familiarity with Fontspec over on the XeLaTeX side of 
 things, but the sparse documentation of simplefonts is leading to my 
 uncertainty as how to proceed.
 
 \usemodule[simplefonts]
 
 %\setmainfont[Antykwa Poltawskiego]
 \setmainfontfallback[Scheherazade][range={arabic,arabicpresentationformsa,arabicpresentationformsb,arabicsupplement}]
 
 I think there is no need for presentation forms, they are deprecated
 symbols not used for entering text.
 
 -- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer
 
 
 --
 
 ___
 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  : https://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___
 
 
 End of ntg-context Digest, Vol 76, Issue 8
 **

___
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] mixed English and Arabic using Simplefonts?

2010-10-02 Thread Wolfgang Schuster

Am 02.10.2010 um 18:34 schrieb Talal Al-Azem:

 Dear Wolfgang and Khaled,
 
 Thank you both for your replies. This has been very helpful. May I ask one 
 further newbie question of simplefonts: how do I change the font for just the 
 fallback font, without affecting the mainfont?

Try my example and you can see the font set with \setmainfont is used for the 
latin text and the font set with \setmainfontfallback is used for the arabic 
text without any manual font switching.

 Is there a way to do this by setting the size in points, or in scale 
 (percentage), or some other fashion?

\definefontfeature[arabic][mode=node,language=dflt,script=arab,...]

\setmainfontfallback[Scheherazade][scale=1.66,range=arabic,features=arabic]

 In fontspec, i was accustomed to something like:
 
 \newfontfamily{\arfont}[Script=Arabic,Scale=1.66,WordSpace=1.66]{Scheherazade-Regular}
 
 I am sure there are equivalents for these feature (size, scale, wordspace); 
 I've seen many features in the simplefonts pdf. But i'm unsure how to define 
 something like arfont using simplefonts.

Simplefonts is not such a complex package like fontspec, it’s a simple wrapper 
around context’s typescript and fontfallback mechanism with a few options to 
change the typescript and typeface parameters.

A separate typeface can be created with

\definefontfeature[arabic][mode=node,language=dflt,script=arab,...]

\definesimplefonttypeface[arfont][Scheherazade][scale=1.66,features=arabic]

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
___


[NTG-context] Verbatim: Pascal pretty printer

2010-10-02 Thread Stefan Müller

Hi list,

I wrote a custom pretty printer (verbatim) for Free Pascal/Turbo 
Pascal/Delphi source files. It's attached to this mail together with a 
ConTeXt test files that shows the features and some special cases.


The pretty printer can handle:
reserved words (bold)
{...}-, (*...*)- and //...-style comments
{$...} compiler directives
'...' strings
embedded assembler code (asm ... end)

It's based on the Lazarus IDE syntax highlighter (Free Pascal IDE), 
which should be pretty Delphi-like. The main difference to Lazarus 
highlighting is that comments are not bold, but slanted. That looks much 
better when no colors are used.


I'm not experienced in Lua programming, but I hope there are no major 
issues. I'd really appreciate any feedback: comments, suggestions and 
corrections (if necessary). I hope that eventually the Pascal pretty 
printer can make it's way into the ConTeXt distribution.


Best wishes,
Stefan.

PS: Thanks for the Lua pretty printer, which served as a good starting 
point.
if not modules then modules = { } end modules ['pret-pas'] = {
version   = 1.0,
comment   = custom pretty printer for Pascal code,
author= Stefan Müller, Chemnitz DE,
copyright = Stefan Müller,
license   = see context related readme files
}

-- The code formatting is adapted from Lazarus, a Free Pascal RAD IDE, which
-- should be quite similar to the Delphi style. Please note that comments are
-- not typeset with bold fontface but slanted, which improves output when not
-- using colors.
-- http://lazarus.freepascal.org/

local visualizer = buffers.newvisualizer(pas)

-- The list of reserved words is taken from 
-- http://www.freepascal.org/docs-html/ref/refse3.html
visualizer.reservedwords = {
-- Turbo Pascal
absolute, and, array, asm, begin, case, const, 
constructor,
destructor, div, do, downto, else, end, file, for,
function, goto, if, implementation, in, inherited, inline,
interface, label, mod, nil, not, object, of, on, 
operator,
or, packed, procedure, program, record, reintroduce, 
repeat,
self, set, shl, shr, string, then, to, type, unit,
until, uses, var, while, with, xor,

-- Free Pascal
-- these are not bold type (keeping them, just in case)
-- dispose, exit, false, new, true,

-- Object Pascal
as, class, dispinterface, except, exports, finalization,
finally, initialization, inline, is, library, on, out,
packed, property, raise, resourcestring, threadvar, try,

-- Modifiers
-- some of these are only bold in specific places (in the following, 
this is
-- deliberately ignored)
absolute, abstract, alias, assembler, cdecl, cppdecl, 
default,
export, external, far, far16, forward, index, local, 
name, 
near, nostackframe, oldfpccall, override, pascal, private,
protected, public, published, read, register, reintroduce,
safecall, softfloat, stdcall, virtual, write
}

local known_words = { }

for k,v in next, visualizer.reservedwords do
known_words[v] = k
end

local colors = {
prettyone, -- red: compiler directive, symbol
prettytwo, -- green: assembler (dark green)
prettythree, -- blue: comment, number (dark blue)
prettyfour, -- yellow
}

local reserved_style = \{\\bf 
local comment_style = \{\\sl 

local inlongcomment, inlongcomment_alt, incompdirec, inasm = false, 0, false, 
false

local function flush_pas_word(word, state)
if word then
local lword = string.lower(word)
local id = known_words[lword]
if id then
if inasm and (lword == end) then
-- asm mode ends
state = buffers.finishstate(state)
inasm = false
print(leave asm)
end
if not inasm then
tex.sprint(tex.ctxcatcodes, reserved_style)
tex.write(word)
tex.sprint(tex.ctxcatcodes, \})
if lword == asm then
-- asm mode begins
print(enter asm)
inasm = true
state = buffers.changestate(2, state)
end
else
tex.write(word)
end
else
tex.write(word)
end
end
return state
end

local function flush_whatever(str)
if str then
for c in string.utfcharacters(str) do
if c ==   then
tex.sprint(tex.ctxcatcodes, \\obs)
elseif c == \t then

[NTG-context] placing a paragraph with non-standard interlinear spacing onto the grid

2010-10-02 Thread Talal Al-Azem
Dear all,

This is important for anyone working with mixed language (font) texts. In my 
example,  the overall document is Latin-based (e.g. English), with a paragraph 
of Arabic text; I want this Arabic paragraph as a whole to fit onto the grid 
(though obviously the individual Arabic lines of the paragraph would not).

Currently, when I typeset an English paragraph, followed by an Arabic 
paragraph, followed by an English paragraph, the second English paragraph is no 
longer on the grid, having been throw off by the Arabic one. I'm looking for 
some way to automatically calculate and fill in the vspace needed for this.

This is not the same as the issue of an Arabic word or phrase (or mathematic 
formula) being typeset in the midst of Latin text, as discussed 
http://www.mail-archive.com/ntg-context@ntg.nl/msg46163.html. Having read a few 
other matters on the mailing list (largely involving Idris and Hans), I'm sure 
it's possible, but I can't figure it out.

Any help would be most appreciated.

Kind regards,
Talal___
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] Stange behavior of \startluacode

2010-10-02 Thread Aditya Mahajan

Hi,

The following snippet

\startluacode
  -- \undefined why should a comment matter
  a = 10
\stopluacode

fails with

system   error on line 4 in file bug.tex: Undefined control 
sequence ...

  -- \undefined
 why should a comment matt  a = 10
\dodostartluacode ...and \directlua \zerocount {#1
  }}
l.4 \stopluacode


Bug or limitation?

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
___