Re: [NTG-context] How to Determine the Current File Name and Line Number AND PAGE NUMBER in the ConTeXt Source?
![](https://secure.gravatar.com/avatar/8344afd4bffe759d7d3ae86e933fb29e.jpg?s=120&d=mm&r=g)
is there also a way to determine the current output page number on which typesetting is currently being made? (I know this is a difficult problem in LaTeX, and I presume the same is the case for ConTeXt, because it uses the same underlying TeX engine.) /iaw
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
ivo welch wrote:
is there also a way to determine the current output page number on which typesetting is currently being made? (I know this is a difficult problem in LaTeX, and I presume the same is the case for ConTeXt, because it uses the same underlying TeX engine.)
\realpageno \userpageno \subpageno of course it depends on the pagebreak so the other ways is to use the referencing mechanism ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
Hello, Did you take a look at the thread "How to Determine the Current File Name and Line Number in the ConTeXt Source?" from yesterday? On Wed, Jul 1, 2009 at 20:18, ivo welch wrote:
Current File Name There's \jobname, but if you read from other files this won't help you.
Line Number I don't know of any way, but TeX sometimes complains on errors and outputs the line number along. I could imagine an ugly hack: to trigger an artificial error, read the line number, ignore that number and continue ... but I don't know if that's doable. Another ugly hack would be "talking to synctex". SyncTeX definitely knows the current line number and file name, but I don't know if there's a way to fetch those variables back to TeX. In any case it's probably something that's equally difficult in ConTeXt than in plain TeX.
On the other hand, in LuaTeX there might exist elegant solutions.
AND PAGE NUMBER in the ConTeXt Source?
What do you mean by "page number in ConTeXt source"?
is there also a way to determine the current output page number on which typesetting is currently being made?
See Hans' response.
(I know this is a difficult problem in LaTeX, and I presume the same is the case for ConTeXt, because it uses the same underlying TeX engine.)
... but LuaTeX simplifies matters a lot. In LuaTeX that should be doable. Mojca
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Mojca Miklavec wrote:
Line Number I don't know of any way, but TeX sometimes complains on errors and outputs the line number along.
There is \inputlineno in TeX, so \the\inputlineno or the lua equivalent \ctxlua{tex.inputlineno} will work. Best wishes, Taco
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 3, 2009 at 8:56 AM, Taco Hoekwater
Mojca Miklavec wrote:
Line Number
I don't know of any way, but TeX sometimes complains on errors and outputs the line number along.
There is \inputlineno in TeX, so \the\inputlineno or the lua equivalent \ctxlua{tex.inputlineno} will work.
The problem is exactly locate the error in source . Sometimes the errorline of the log are in someway imprecise , ie. "the errors is (are) around here " . -- luigi
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
luigi scarso wrote:
On Fri, Jul 3, 2009 at 8:56 AM, Taco Hoekwater
mailto:taco@elvenkind.com> wrote: Mojca Miklavec wrote:
Line Number
I don't know of any way, but TeX sometimes complains on errors and outputs the line number along.
There is \inputlineno in TeX, so \the\inputlineno or the lua equivalent \ctxlua{tex.inputlineno} will work.
The problem is exactly locate the error in source . Sometimes the errorline of the log are in someway imprecise , ie. "the errors is (are) around here " .
Yeah, that can't be helped (unless you don't do multi-line paragraphs nor macros) Best wishes, Taco
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 3, 2009 at 9:14 AM, Taco Hoekwater
luigi scarso wrote:
On Fri, Jul 3, 2009 at 8:56 AM, Taco Hoekwater
mailto:taco@elvenkind.com> wrote: Mojca Miklavec wrote:
Line Number
I don't know of any way, but TeX sometimes complains on errors
and
outputs the line number along.
There is \inputlineno in TeX, so \the\inputlineno or the lua equivalent \ctxlua{tex.inputlineno} will work.
The problem is exactly locate the error in source . Sometimes the errorline of the log are in someway imprecise , ie. "the errors is (are) around here " .
Yeah, that can't be helped (unless you don't do multi-line paragraphs nor macros)
we need something like a stack trace; also a lua "try/except" construct should be nice . -- luigi
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 3, 2009 at 9:33 AM, Taco Hoekwater
luigi scarso wrote:
we need something like a stack trace; also a lua "try/except" construct should be nice .
stack trace of tex?
No no, sorry -- I mean traceback, something like this Traceback (innermost last): Module ZPublisher.Publish, line 119, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 42, in call_object Module OFS.ObjectManager, line 569, in manage_exportObject Module OFS.XMLExportImport, line 56, in exportXML Module OFS.XMLExportImport, line 31, in XMLrecord Module Shared.DC.xml.ppml, line 263, in load Module pickle, line 872, in load Module Shared.DC.xml.ppml, line 418, in load_binput AttributeError: 'unicode' object has no attribute 'id' -- luigi
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 3, 2009 at 9:47 AM, Taco Hoekwater
luigi scarso wrote:
No no, sorry -- I mean traceback, something like this Traceback (innermost last):
Yeah, I though so.
ok
Repeat question: for TeX (macros)?
Is it impossible ? -- luigi
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 3, 2009 at 10:06 AM, Taco Hoekwater
luigi scarso wrote:
Repeat question: for TeX (macros)?
Is it impossible ?
Right now: yes. Later: doable.
So doable . Given that I like to lost in code, where should I start to look ? -- luigi
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
luigi scarso wrote:
On Fri, Jul 3, 2009 at 10:06 AM, Taco Hoekwater
mailto:taco@elvenkind.com> wrote: luigi scarso wrote: > > Repeat question: for TeX (macros)? > > Is it impossible ?
Right now: yes. Later: doable.
So doable . Given that I like to lost in code, where should I start to look ?
Not now, you will need a bit of luatex interfacing that is not programmed yet.
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Fri, Jul 3, 2009 at 10:18 AM, Taco Hoekwater
Not now, you will need a bit of luatex interfacing that is not programmed yet.
ok -- stop here . Eventually at eurotex . -- luigi
participants (5)
-
Hans Hagen
-
ivo welch
-
luigi scarso
-
Mojca Miklavec
-
Taco Hoekwater