ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: How to hack the lua files
       [not found] <mailman.1195.1370589979.2084.ntg-context@ntg.nl>
@ 2013-06-07 13:00 ` Lance Larsen
  2013-06-07 13:03   ` luigi scarso
  2013-06-07 13:17   ` luigi scarso
  2013-06-07 13:13 ` Lance Larsen
  1 sibling, 2 replies; 16+ messages in thread
From: Lance Larsen @ 2013-06-07 13:00 UTC (permalink / raw)
  To: ntg-context

If I modify a core lua file how do I remake the format file? Is this
something that is done from mtxrun.exe? I would certainly prefer to use a
hook rather than modifying a core file, but how do I identify the hooks that
are available? Is there a list of hooks that are available, or a standard
way that hooks are called from the context code so that I can look for an
appropriate hook? Where do I place my hook scripts? Is there a guide that is
available that might get me started?

What I trying to do is map equation references to the equation number
generated by context. So for example, if I have an equation:

\placeformula \startformula 
\NC F = m a \NC  \NR[eq:newtonslaw]
\stopformula

I need a way to log the fact that 'eq:newton' became something like equation
(2.3). I hoped there was a tracker that printed this out (maybe there is,
but I haven't found it). So I thought maybe I could find where equation
numbers are defined by context and add a tracker. The code in
'strc-ref.mkvi' and 'strc-ref.lua' looked promising. 

Incidentally, is this where equation numbers are created, or should I be
looking in another file? Is there a lua function that gets called
consistently around the time equation numbers are defined where the equation
reference (i.e. eq:newtonslaw) and the associated equation number are both
available and could be logged?

I tried adding a new tracker in strc-ref.lua to see if I could narrow down
where the labels are created, but my tracker did not seem to work.
Therefore, I identified a tracker that was working and tried to modify the
output slightly only to find that this did not work either. It is not clear
to me at present how context loads the lua files. I hoped that it loaded
these directly, so that changes would take effect immediately. 

-Lance Larsen

------------------------------
On 6/7/2013 1:20 AM, Lance Larsen wrote:
> I have a version of context standalone installed, and I am trying to 
> add some functionality I need to strc-ref.lua. As a simple test to see 
> if modifying the file was working, I enabled the 
> ?structures.referencing.identifying? tracker and verified that I was 
> getting messages from this tracker in the log. I then modified the log 
> statement in strc-ref.lua and processed the document again. The 
> changes I made to the lua file did not seem to be active. I verified 
> that there is only one log statement that matches the output I am 
> seeing. Why would my lua code change not be active? Is the lua code 
> cached somehow? (I am running this from windows if that matters).
>
> The code I modified is under the path:
>
> context\tex\texmf-context\tex\context\base\ strc-ref.lua

if you patch files that way you need to remake the format file

I don't know what you patch, but changing something in a core file is no
guarantee for the future. It's not a problem to add functionality (lots of
hooks for that) but best do that in a local module that gets loaded at
runtime then.

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  :
https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
____________________________________________________________________________
_______

End of ntg-context Digest, Vol 108, Issue 19
********************************************

___________________________________________________________________________________
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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 13:00 ` How to hack the lua files Lance Larsen
@ 2013-06-07 13:03   ` luigi scarso
  2013-06-07 15:27     ` Sietse Brouwer
  2013-06-07 13:17   ` luigi scarso
  1 sibling, 1 reply; 16+ messages in thread
From: luigi scarso @ 2013-06-07 13:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 171 bytes --]

On Fri, Jun 7, 2013 at 3:00 PM, Lance Larsen <lance.c.larsen@gmail.com>wrote:

> If I modify a core lua file how do I remake the format file?

context --make



-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 545 bytes --]

[-- Attachment #2: 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] 16+ messages in thread

* Re: How to hack the lua files
       [not found] <mailman.1195.1370589979.2084.ntg-context@ntg.nl>
  2013-06-07 13:00 ` How to hack the lua files Lance Larsen
@ 2013-06-07 13:13 ` Lance Larsen
  2013-06-07 13:48   ` Hans Hagen
  1 sibling, 1 reply; 16+ messages in thread
From: Lance Larsen @ 2013-06-07 13:13 UTC (permalink / raw)
  To: ntg-context

Hans,

Your reply below was very helpful. I looked at the context command line
options and saw 'make'. After running this, the code changes took effect.
Thankyou.

I could still use help in identifying where equation numbers are defined in
the code so that I can add a tracker. Do you have a suggestion of which
function (or at least lua file) I should look in for this?

I am also curious how hooks are defined, so that I can identify them in the
code and see if there is one that would meek my purpose - also where the
hook scripts are placed so that context can find them.

Thanks again for the reply which got me over the first hurdle.

-Lance

------------------------------

Message: 4
Date: Fri, 07 Jun 2013 09:25:36 +0200
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: [NTG-context] How to hack the lua files
Message-ID: <51B18AF0.5010206@wxs.nl>
Content-Type: text/plain; charset=windows-1252; format=flowed

On 6/7/2013 1:20 AM, Lance Larsen wrote:
> I have a version of context standalone installed, and I am trying to 
> add some functionality I need to strc-ref.lua. As a simple test to see 
> if modifying the file was working, I enabled the 
> ?structures.referencing.identifying? tracker and verified that I was 
> getting messages from this tracker in the log. I then modified the log 
> statement in strc-ref.lua and processed the document again. The 
> changes I made to the lua file did not seem to be active. I verified 
> that there is only one log statement that matches the output I am 
> seeing. Why would my lua code change not be active? Is the lua code 
> cached somehow? (I am running this from windows if that matters).
>
> The code I modified is under the path:
>
> context\tex\texmf-context\tex\context\base\ strc-ref.lua

if you patch files that way you need to remake the format file

I don't know what you patch, but changing something in a core file is no
guarantee for the future. It's not a problem to add functionality (lots of
hooks for that) but best do that in a local module that gets loaded at
runtime then.

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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 13:00 ` How to hack the lua files Lance Larsen
  2013-06-07 13:03   ` luigi scarso
@ 2013-06-07 13:17   ` luigi scarso
  2013-06-07 13:48     ` Wolfgang Schuster
  1 sibling, 1 reply; 16+ messages in thread
From: luigi scarso @ 2013-06-07 13:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1078 bytes --]

On Fri, Jun 7, 2013 at 3:00 PM, Lance Larsen <lance.c.larsen@gmail.com>wrote:

> If I modify a core lua file how do I remake the format file? Is this
> something that is done from mtxrun.exe? I would certainly prefer to use a
> hook rather than modifying a core file, but how do I identify the hooks
> that
> are available? Is there a list of hooks that are available, or a standard
> way that hooks are called from the context code so that I can look for an
> appropriate hook? Where do I place my hook scripts? Is there a guide that
> is
> available that might get me started?
>
> What I trying to do is map equation references to the equation number
> generated by context. So for example, if I have an equation:
>
> \placeformula \startformula
> \NC F = m a \NC  \NR[eq:newtonslaw]
> \stopformula
>

\usemodule[newmath]

\setupformulas[way=bytext,prefix=no]
\setupsubformulas[conversion=romannumerals]

\starttext
\placenamedformula[eq:TEST]{Der einfache Test}
\startformula
c^2 = a^2 + b^2.
\stopformula

\stoptext

and look into the tuc file (it's a lua file)


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 1541 bytes --]

[-- Attachment #2: 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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 13:17   ` luigi scarso
@ 2013-06-07 13:48     ` Wolfgang Schuster
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2013-06-07 13:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1018 bytes --]


Am 07.06.2013 um 15:17 schrieb luigi scarso <luigi.scarso@gmail.com>:

> 
> 
> 
> On Fri, Jun 7, 2013 at 3:00 PM, Lance Larsen <lance.c.larsen@gmail.com> wrote:
> If I modify a core lua file how do I remake the format file? Is this
> something that is done from mtxrun.exe? I would certainly prefer to use a
> hook rather than modifying a core file, but how do I identify the hooks that
> are available? Is there a list of hooks that are available, or a standard
> way that hooks are called from the context code so that I can look for an
> appropriate hook? Where do I place my hook scripts? Is there a guide that is
> available that might get me started?
> 
> What I trying to do is map equation references to the equation number
> generated by context. So for example, if I have an equation:
> 
> \placeformula \startformula
> \NC F = m a \NC  \NR[eq:newtonslaw]
> \stopformula
> 
> \usemodule[newmath]


From the log-file:

resolvers       > modules > 'newmath' is not found

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1959 bytes --]

[-- Attachment #2: 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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 13:13 ` Lance Larsen
@ 2013-06-07 13:48   ` Hans Hagen
  0 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2013-06-07 13:48 UTC (permalink / raw)
  To: ntg-context

On 6/7/2013 3:13 PM, Lance Larsen wrote:
> Hans,
>
> Your reply below was very helpful. I looked at the context command line
> options and saw 'make'. After running this, the code changes took effect.
> Thankyou.
>
> I could still use help in identifying where equation numbers are defined in
> the code so that I can add a tracker. Do you have a suggestion of which
> function (or at least lua file) I should look in for this?
>
> I am also curious how hooks are defined, so that I can identify them in the
> code and see if there is one that would meek my purpose - also where the
> hook scripts are placed so that context can find them.
>
> Thanks again for the reply which got me over the first hurdle.

It's not that trivial as numbers are not stored like 2.1.2 and so, but 
as abstractions with optional rendering directives so that they can be 
generated on demand, depending on circumstances. For instance a formula 
number can be formatted differently in a list, reference, formula or 
wherever needed.

So, in principle, there can be \in{formula}[a] references rendered in 
one place as 1.2.1 with the 1 being green and slanted and another place 
as 2.1 with the 1 being red and bold.

So .. if a tracing feature like yours is needed for some reason, it has 
to be hooked into several places but in a consistent way (quite doable 
but takes time and no one needed it). The reason is that there is not 
one list of references but for efficiency reasons references are picked 
up from several 'tables'. For instance, currently, formula references 
come from structure lists (which also indicates that there can be lists 
of formulas).

The following demonstrates this.

\setupbodyfont[pagella]

\starttext

\placeformula[a] \startformula a \stopformula

see \in{formula}[a]

\placeformula[b] \startformula b \stopformula

see \in{formula}[b]

\startformula c \stopformula

\startluacode
     local list = structures.lists.collected
     for i, l in ipairs(list) do
      -- if l.metadata.name == "formula" then
             logs.report("references",string.formatters["%s: %.t"](
                 l.references.reference,
                 l.numberdata.numbers
             ))
      -- end
     end
\stopluacode

\stoptext



-----------------------------------------------------------------
                                           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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 13:03   ` luigi scarso
@ 2013-06-07 15:27     ` Sietse Brouwer
  2013-06-07 15:36       ` Hans Hagen
                         ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Sietse Brouwer @ 2013-06-07 15:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Lance Larsen wrote:
>> If I modify a core lua file how do I remake the format file?

luigi scarso <luigi.scarso@gmail.com> wrote:
> context --make

Now documented on the page about the `context` script. I've added a
page about formats, too, which also mentions how to remake them. (MkIV
only. Don't know how to remake the MkII format.)

http://wiki.contextgarden.net/Context
http://wiki.contextgarden.net/Format

To make this more discoverable, I've added a redirect from
[[Recompiling ConTeXt]]. Any other pages that ought to mention or
redirect to this?

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
___________________________________________________________________________________


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

* Re: How to hack the lua files
  2013-06-07 15:27     ` Sietse Brouwer
@ 2013-06-07 15:36       ` Hans Hagen
  2013-06-07 15:36       ` Wolfgang Schuster
  2013-06-07 15:42       ` luigi scarso
  2 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2013-06-07 15:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 6/7/2013 5:27 PM, Sietse Brouwer wrote:
> Lance Larsen wrote:
>>> If I modify a core lua file how do I remake the format file?
>
> luigi scarso <luigi.scarso@gmail.com> wrote:
>> context --make
>
> Now documented on the page about the `context` script. I've added a
> page about formats, too, which also mentions how to remake them. (MkIV
> only. Don't know how to remake the MkII format.)
>
> http://wiki.contextgarden.net/Context
> http://wiki.contextgarden.net/Format
>
> To make this more discoverable, I've added a redirect from
> [[Recompiling ConTeXt]]. Any other pages that ought to mention or
> redirect to this?

fyi: one can do

   context --touch --expert

in which case formats will be made automatically at a next run (luatex 
and luajittex)

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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 15:27     ` Sietse Brouwer
  2013-06-07 15:36       ` Hans Hagen
@ 2013-06-07 15:36       ` Wolfgang Schuster
  2013-06-07 15:42       ` luigi scarso
  2 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2013-06-07 15:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 07.06.2013 um 17:27 schrieb Sietse Brouwer <sbbrouwer@gmail.com>:

> Lance Larsen wrote:
>>> If I modify a core lua file how do I remake the format file?
> 
> luigi scarso <luigi.scarso@gmail.com> wrote:
>> context --make
> 
> Now documented on the page about the `context` script. I've added a
> page about formats, too, which also mentions how to remake them. (MkIV
> only. Don't know how to remake the MkII format.)

The MkII formats are generated with “texexec --make”.

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
___________________________________________________________________________________


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

* Re: How to hack the lua files
  2013-06-07 15:27     ` Sietse Brouwer
  2013-06-07 15:36       ` Hans Hagen
  2013-06-07 15:36       ` Wolfgang Schuster
@ 2013-06-07 15:42       ` luigi scarso
  2013-06-07 15:49         ` Sietse Brouwer
  2 siblings, 1 reply; 16+ messages in thread
From: luigi scarso @ 2013-06-07 15:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 156 bytes --]

On Fri, Jun 7, 2013 at 5:27 PM, Sietse Brouwer <sbbrouwer@gmail.com> wrote:

>
>   Don't know how to remake the MkII format.
>
> texexec --make


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 520 bytes --]

[-- Attachment #2: 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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 15:42       ` luigi scarso
@ 2013-06-07 15:49         ` Sietse Brouwer
  2013-06-07 16:21           ` luigi scarso
  0 siblings, 1 reply; 16+ messages in thread
From: Sietse Brouwer @ 2013-06-07 15:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang and Luigi wrote:
> texexec --make

Thanks, guys. Technical question:

* Does `texexec --make` create only the mkii formats, and `context
--make` create only the mkiv formats;
* Or is it so that both commands create both the mkii *and* the mkiv formats?

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
___________________________________________________________________________________


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

* Re: How to hack the lua files
  2013-06-07 15:49         ` Sietse Brouwer
@ 2013-06-07 16:21           ` luigi scarso
  0 siblings, 0 replies; 16+ messages in thread
From: luigi scarso @ 2013-06-07 16:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 563 bytes --]

On Fri, Jun 7, 2013 at 5:49 PM, Sietse Brouwer <sbbrouwer@gmail.com> wrote:

> Wolfgang and Luigi wrote:
> > texexec --make
>
> Thanks, guys. Technical question:
>
> * Does `texexec --make` create only the mkii formats, and `context
> --make` create only the mkiv formats;
> * Or is it so that both commands create both the mkii *and* the mkiv
> formats?
>
>
mkii
texexec --make


mkii
context --engine=pdftext --make

mkii
mtxrun --script texexec --make


mkiv
context --make

mkiv
mtxrun --script context  --make


so context is enough for both mkii and mkiv .

[-- Attachment #1.2: Type: text/html, Size: 1080 bytes --]

[-- Attachment #2: 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] 16+ messages in thread

* Re: How to hack the lua files
  2013-06-07 14:01 ` Lance Larsen
@ 2013-06-07 14:10   ` Hans Hagen
  0 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2013-06-07 14:10 UTC (permalink / raw)
  To: ntg-context

On 6/7/2013 4:01 PM, Lance Larsen wrote:
> luigi,
>
> When I started exploring how to map equation references (eq:name) to
> equation numbers (4.2), I noticed that the 'tuc' file included the equation
> reference (eq:name), but I was not able to identify anywhere where it
> indicates the actual equation label specified in the document. Below is an
> example of the tuc output. 'eq:DVOL_RVI_17' is equation (4.28) in the
> document:
>
> {
>    ["metadata"]=142,
>    ["numberdata"]=237,
>    ["prefixdata"]=11,
>    ["references"]={
>     ["block"]="bodypart",
>     ["internal"]=122,
>     ["realpage"]=47,
>     ["reference"]="eq:DVOL_RVI_17",
>     ["section"]=79,
>    },
>   }
>
> There is nowhere in the tuc file that contains 4 and 28 near each other. I
> checked this for other equations as well and concluded that the tuc file
> does not contain the actual equation numbers that are used.

because there are indirect references to for instance 'numberdata' where 
this info sits

> If I am missing something or you have any other suggestions that might help
> me to extract this info, I would sure appreciate the help.

see previous mail

btw, if you just want to use references in another tex doc, this will do 
the trick:

\usereferences[somedoc]

\starttext

     \in{formula}[somedoc::a]

     \in{formula}[somedoc::b]

\stoptext



-----------------------------------------------------------------
                                           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] 16+ messages in thread

* Re: How to hack the lua files
       [not found] <mailman.1201.1370610850.2084.ntg-context@ntg.nl>
@ 2013-06-07 14:01 ` Lance Larsen
  2013-06-07 14:10   ` Hans Hagen
  0 siblings, 1 reply; 16+ messages in thread
From: Lance Larsen @ 2013-06-07 14:01 UTC (permalink / raw)
  To: ntg-context

luigi,

When I started exploring how to map equation references (eq:name) to
equation numbers (4.2), I noticed that the 'tuc' file included the equation
reference (eq:name), but I was not able to identify anywhere where it
indicates the actual equation label specified in the document. Below is an
example of the tuc output. 'eq:DVOL_RVI_17' is equation (4.28) in the
document:

{
  ["metadata"]=142,
  ["numberdata"]=237,
  ["prefixdata"]=11,
  ["references"]={
   ["block"]="bodypart",
   ["internal"]=122,
   ["realpage"]=47,
   ["reference"]="eq:DVOL_RVI_17",
   ["section"]=79,
  },
 }

There is nowhere in the tuc file that contains 4 and 28 near each other. I
checked this for other equations as well and concluded that the tuc file
does not contain the actual equation numbers that are used.

If I am missing something or you have any other suggestions that might help
me to extract this info, I would sure appreciate the help.

-Lance

P.S. Thanks for the tip on using 'context --make' to rebuild the files. I
figured this out by guesswork before I got your response, but I have
appreciated how helpful many of you have been on this list.

------
On Fri, Jun 7, 2013 at 3:00 PM, Lance Larsen <lance.c.larsen at
gmail.com>wrote:

> If I modify a core lua file how do I remake the format file? Is this
> something that is done from mtxrun.exe? I would certainly prefer to use a
> hook rather than modifying a core file, but how do I identify the hooks
> that
> are available? Is there a list of hooks that are available, or a standard
> way that hooks are called from the context code so that I can look for an
> appropriate hook? Where do I place my hook scripts? Is there a guide that
> is
> available that might get me started?
>
> What I trying to do is map equation references to the equation number
> generated by context. So for example, if I have an equation:
>
> \placeformula \startformula
> \NC F = m a \NC  \NR[eq:newtonslaw]
> \stopformula
>

\usemodule[newmath]

\setupformulas[way=bytext,prefix=no]
\setupsubformulas[conversion=romannumerals]

\starttext
\placenamedformula[eq:TEST]{Der einfache Test}
\startformula
c^2 = a^2 + b^2.
\stopformula

\stoptext

and look into the tuc file (it's a lua file)

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


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

* Re: How to hack the lua files
  2013-06-06 23:20 Lance Larsen
@ 2013-06-07  7:25 ` Hans Hagen
  0 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2013-06-07  7:25 UTC (permalink / raw)
  To: ntg-context

On 6/7/2013 1:20 AM, Lance Larsen wrote:
> I have a version of context standalone installed, and I am trying to add
> some functionality I need to strc-ref.lua. As a simple test to see if
> modifying the file was working, I enabled the
> ‘structures.referencing.identifying’ tracker and verified that I was
> getting messages from this tracker in the log. I then modified the log
> statement in strc-ref.lua and processed the document again. The changes
> I made to the lua file did not seem to be active. I verified that there
> is only one log statement that matches the output I am seeing. Why would
> my lua code change not be active? Is the lua code cached somehow? (I am
> running this from windows if that matters).
>
> The code I modified is under the path:
>
> context\tex\texmf-context\tex\context\base\ strc-ref.lua

if you patch files that way you need to remake the format file

I don't know what you patch, but changing something in a core file is no 
guarantee for the future. It's not a problem to add functionality (lots 
of hooks for that) but best do that in a local module that gets loaded 
at runtime then.

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] 16+ messages in thread

* How to hack the lua files
@ 2013-06-06 23:20 Lance Larsen
  2013-06-07  7:25 ` Hans Hagen
  0 siblings, 1 reply; 16+ messages in thread
From: Lance Larsen @ 2013-06-06 23:20 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 785 bytes --]

I have a version of context standalone installed, and I am trying to add
some functionality I need to strc-ref.lua. As a simple test to see if
modifying the file was working, I enabled the
'structures.referencing.identifying' tracker and verified that I was getting
messages from this tracker in the log. I then modified the log statement in
strc-ref.lua and processed the document again. The changes I made to the lua
file did not seem to be active. I verified that there is only one log
statement that matches the output I am seeing. Why would my lua code change
not be active? Is the lua code cached somehow? (I am running this from
windows if that matters).

 

The code I modified is under the path:

context\tex\texmf-context\tex\context\base\ strc-ref.lua

 

-Lance Larsen

 


[-- Attachment #1.2: Type: text/html, Size: 2576 bytes --]

[-- Attachment #2: 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] 16+ messages in thread

end of thread, other threads:[~2013-06-07 16:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1195.1370589979.2084.ntg-context@ntg.nl>
2013-06-07 13:00 ` How to hack the lua files Lance Larsen
2013-06-07 13:03   ` luigi scarso
2013-06-07 15:27     ` Sietse Brouwer
2013-06-07 15:36       ` Hans Hagen
2013-06-07 15:36       ` Wolfgang Schuster
2013-06-07 15:42       ` luigi scarso
2013-06-07 15:49         ` Sietse Brouwer
2013-06-07 16:21           ` luigi scarso
2013-06-07 13:17   ` luigi scarso
2013-06-07 13:48     ` Wolfgang Schuster
2013-06-07 13:13 ` Lance Larsen
2013-06-07 13:48   ` Hans Hagen
     [not found] <mailman.1201.1370610850.2084.ntg-context@ntg.nl>
2013-06-07 14:01 ` Lance Larsen
2013-06-07 14:10   ` Hans Hagen
2013-06-06 23:20 Lance Larsen
2013-06-07  7:25 ` Hans Hagen

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).