ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* line numbers in margin from xml in context mkiv
@ 2011-04-26 23:26 Jon Crump
  2011-04-27 11:28 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Crump @ 2011-04-26 23:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

All,

After being away from my project for a while I returned to find that
something that worked now no longer does. I updated the minimals on my
Mac and context is running as I would expect:

jjc% context --version
mtx-context     | main context file:
/Users/jjc/context/tex/texmf-context/tex/context/base/context.mkiv
mtx-context     | current version: 2011.04.24 15:15

But now, while running my environment.tex file against my target
TEI/xml file context complains:

! Undefined control sequence.
l.77 \defineinmargin
                     [lineNumbers] [normal]
?

My own fragile understanding of what I'm doing may well be at fault,
but perhaps something relevant has changed with the minimals?

I had an environment file that I'd arrived at by much trial and error
that renders page/line numbers encoded in the xml/TEI source in the
margins of my pdf output:

\startxmlsetups xml:pb
	\def\svopage{\xmlatt{#1}{n}.}
    \xmlflush{#1}
\stopxmlsetups

\startluacode
 function filter(lb)
   if math.mod(lb,5) == 0 then
     context.svopage()
     context(lb)
   end
 end
\stopluacode

\define[1]\MyNumber%
 {\ctxlua{filter(#1)}\endgraf}

\startxmlsetups xml:lb
	\xmldoifelse{#1}{ancestor::head[@type='diarytitle']}
		{\\}
		{\lineNumbers{\tfxx\MyNumber{\xmlatt{#1}{n}}}}
		\xmlflush{#1}
\stopxmlsetups

\defineinmargin [lineNumbers] [normal]


Any suggestions would be gratefully received.
Jon
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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


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

* Re: line numbers in margin from xml in context mkiv
  2011-04-26 23:26 line numbers in margin from xml in context mkiv Jon Crump
@ 2011-04-27 11:28 ` Hans Hagen
       [not found]   ` <BANLkTintKaT5XVKbfr5hqKHCCt3u4JHL3g@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2011-04-27 11:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 27-4-2011 1:26, Jon Crump wrote:
> All,
>
> After being away from my project for a while I returned to find that
> something that worked now no longer does. I updated the minimals on my
> Mac and context is running as I would expect:
>
> jjc% context --version
> mtx-context     | main context file:
> /Users/jjc/context/tex/texmf-context/tex/context/base/context.mkiv
> mtx-context     | current version: 2011.04.24 15:15
>
> But now, while running my environment.tex file against my target
> TEI/xml file context complains:
>
> ! Undefined control sequence.
> l.77 \defineinmargin
>                       [lineNumbers] [normal]
> ?

see typo-mar.mkiv ... more control over margindata and new commands

Hans

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

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


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

* line numbers in margin from xml in context mkiv
       [not found]   ` <BANLkTintKaT5XVKbfr5hqKHCCt3u4JHL3g@mail.gmail.com>
@ 2011-05-27 16:51     ` Jon Crump
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Crump @ 2011-05-27 16:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 3547 bytes --]

Hans, et alia,

Thanks for mentioning typo-mar.mkiv. Once I found it, and figured out
what to do with it (put it in my texmf-local directory), it appears
to, as you say, "offer more control over margindata". My (rather
belated) thanks for offering this extended functionality, though my
grasp of context is still too fragile to really understand how to use
it.

typo-mar.mkiv appears to introduce a bug in my Arabic typesetting. In
my bilingual text, my margin data (pg/lb numbers) are placed correctly
in the margin of the English text, but the margins of the Arabic text
appear to be miscalculated and the margindata overwrites the
beginnings of the lines (or disappears beyond the edge if I set margin
'left'). My tyronic fooling around may certainly be at fault, but if
you could offer any observations on the following, I'd be grateful.

ConTeXt  ver: 2011.04.24 15:15 MKIV
My environment file is included below, stripped down as far as I could
to its essentials. I've attached the ara-style.tex file setting up
ScheherazadeRegOT; a stripped down example of my tei/xml source; and
the pdf output I'm getting. I hope I violate no convention of the list
in attaching these files, but in my naivete I'm not sure how much
information is too much.

\startxmlsetups xml:teisetups
       \xmlsetsetup{#1}{*}{-}
       \xmlsetsetup{#1}{body|p|pb|lb|}{xml:*}
       \xmlsetsetup{#1}{div[@xml:id='apr_arab']}{xml:div:arab}
       \xmlsetsetup{#1}{div[@xml:id='apr_engl']}{xml:div:engl}
               \xmlsetsetup{#1}{pb}{xml:pb}
               \xmlsetsetup{#1}{lb}{xml:lb}
\stopxmlsetups

\xmlregistersetup{xml:teisetups}
\environment ara-sty
\usetypescript[palatino]
\setupbodyfont[palatino,10pt]

\startxmlsetups xml:body
   \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
       \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:pb
   \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:lb
       \MarText{\tfxx{xml pb/lb numbers}}
       \xmlflush{#1}
\stopxmlsetups

\definemargindata [MarText][right][color=red]

\startxmlsetups xml:div:arab
       \setarabic{\switchtobodyfont[Arabic] \xmlflush{#1}}
\stopxmlsetups

\startxmlsetups xml:div:engl
       \setlatin{\switchtobodyfont[palatino, 12pt] \xmlflush{#1}}
\stopxmlsetups


On Wed, Apr 27, 2011 at 4:28 AM, Hans Hagen <pragma@wxs.nl> wrote:
> On 27-4-2011 1:26, Jon Crump wrote:
>>
>> All,
>>
>> After being away from my project for a while I returned to find that
>> something that worked now no longer does. I updated the minimals on my
>> Mac and context is running as I would expect:
>>
>> jjc% context --version
>> mtx-context     | main context file:
>> /Users/jjc/context/tex/texmf-context/tex/context/base/context.mkiv
>> mtx-context     | current version: 2011.04.24 15:15
>>
>> But now, while running my environment.tex file against my target
>> TEI/xml file context complains:
>>
>> ! Undefined control sequence.
>> l.77 \defineinmargin
>>                      [lineNumbers] [normal]
>> ?
>
> see typo-mar.mkiv ... more control over margindata and new commands
>
> 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
> -----------------------------------------------------------------
>

[-- Attachment #2: ara-sty.tex --]
[-- Type: application/x-tex, Size: 1907 bytes --]

[-- Attachment #3: eng-arab-test.xml --]
[-- Type: text/xml, Size: 1966 bytes --]

<?xml version="1.0" encoding="utf-8"?>
<body>
  <div type="month" xml:id="apr_arab">
    <pb n="001" />
    <lb n="01" />
    <p>
    <lb n="04" />فقد صممنا على السفر الى اورباو ممشانا من هنا سيكون 
    <lb n="05" />نهار الاربعاء صباحاًاعني في ١٣ من هدا الشهر۔ فقد كرينا الدواب 
    <lb n="06" />و تختروانورتبنا كل شيء و ما بقي سوى ان نضع بغدادورائنا ۔ 
    <lb n="07" />من الايام الثلاثة الفاتت الى الآن جملة خطار عماليجون يودعونا 
    <lb n="08" />و بالاخص الاهل جملة امراريجون عندنا ۔ فنسافر صحبة كرنل 
    <lb n="09" />مكلر باليوزالانكليزي الذي معتمديروح الى لندرةفنأخذ درب 
    <lb n="10" />البر اعني الى الدير و الشامو بيروتو من هناك الى القاهرةاذا 
    <lb n="11" />سهل المولى ۔</p>
    <lb n="12" />
  </div>
  <div type="month" xml:id="apr_engl">
    <pb n="001" />
    <lb n="01" />
    <p>
    <lb n="04" />And so, we decided to travel to Europe. Our departure from here will be 
    <lb n="05" />on Wednesday morning, that is, on the 13th of this month. We have already hired the riding animals 
    <lb n="06" />and a mule-litter and have arranged everything, nothing is left but to put Baghdad behind us. 
    <lb n="07" />For the past three days till now, many visitors have come and are still coming to bid us goodbye, 
    <lb n="08" />especially our family who are coming often to visit us. We are traveling in the company of the English Consul-General 
    <lb n="09" />Colonel Mockler who has decided to go to London. Therefore, we shall take 
    <lb n="10" />the land road that is to ad-Dayr, Damascus and Beirut, and thence to Cairo, 
    <lb n="11" />God willing.</p>
    <lb n="12" />
  </div>
</body>

[-- Attachment #4: eng-arab-test.pdf --]
[-- Type: application/pdf, Size: 27628 bytes --]

[-- Attachment #5: Type: text/plain, Size: 485 bytes --]

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

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

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

end of thread, other threads:[~2011-05-27 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26 23:26 line numbers in margin from xml in context mkiv Jon Crump
2011-04-27 11:28 ` Hans Hagen
     [not found]   ` <BANLkTintKaT5XVKbfr5hqKHCCt3u4JHL3g@mail.gmail.com>
2011-05-27 16:51     ` Jon Crump

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