bugtex4ht - Bugs: bug #136, #line in output

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #136: #line in output

Submitted by:  Karl Berry <karl>
Submitted on:  Fri Dec 24 19:14:33 2010  
Category: NonePriority: 5 - Normal
Severity: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

(Jump to the original submission Jump to the original submission)

Sun Jul 17 19:43:55 2016, comment #8:

I've just download the changed sources and it seems that the latest commit causes lot of compilation errors, resp. compilation stops with emergency exit. Does it happen only on my machine?

Michal Hoftich <michal_h21>
Project Member
Mon Jul 4 18:26:47 2016, comment #7:

i have (finally) uploaded a new protex release to CTAN.

i went ahead and enabled \CodeLineNo in tex4ht-4ht.tex, thus all *.4ht generated from there will have line numbers now. If it turns out to cause problems, we can disable it. (Michal, please be warned ...)

On the other hand, if nothing crops up soon, we could enable it in common code somewhere (I hope) so that all generated files have the line markers. I find it extremely useful!

Thanks again for doing the work, Deimi. -karl

Karl Berry <karl>
Project Administrator
Fri Jun 3 21:39:23 2016, comment #6:

perfect, thanks so much! i'll see if i can put together a new protex release, at least ...

Karl Berry <karl>
Project Administrator
Fri Jun 3 13:19:24 2016, comment #5:

Hi Karl.

here is a fix.

My changes are mark with "BOC" and "EOC" in ProTex.sty and AlProTex.sty.
I set an option "CodeLineNo" and a macro "\CodeLineNo".
The option is already activated in tex4ht-c.tex and tex4ht-t4ht.tex,
but not in other files. I put a comment in tex4ht-4ht.tex as an example how to enable line numbers.

thank you,

(file #239)

Deimantas Galčius <deimi>
Project Member
Thu Jun 2 21:54:43 2016, comment #4:

hi deimi - thanks for the patch. agreed about protex. i've never imported protex into the tex4ht repository since we hadn't yet needed to make changes there. however, i see no problem in doing so.

what's on CTAN is current as far as i know. maybe you could work up the patch against that, send it here. i'll see about importing protex into our repo and making a release. unless someone else here would like to take that on ...

as for an option: for the C files, I see no need for an option.
but for the TeX-related .4ht and other files, it seems it would be prudent to be able to turn off line numbers at the beginning of a given tex4ht-*.tex literate file, since I can imagine the extra comments causing problems sometimes. we all know about TeX and input parsing ... thanks, k.

Karl Berry <karl>
Project Administrator
Thu Jun 2 07:55:14 2016, comment #3:

Hi Karl, quick patch is attached. The fix is in a separate file.

Probably it would be better to patch ProTex.sty directly.
Eventually I could introduce an option (e.g., "CodeLineNo") in ProTex.sty;
then to generate line numbers would be matter of a setup option:
instead of
The option could be applied for other kind of files (.4ht, .etc) too
(with a different line number format).

But ProTex.sty is not tracked in tex4ht repo. It's on CTAN.
If I submit changes to ProTex.sty on CTAN,
how would tex4ht repo get those changes?

I'm not sure if line numbers should always be in the output or
just under some switch when debugging/developing.

Definetely I'm ok with LPPL.

thank you,

(file #238)

Deimantas Galčius <deimi>
Project Member
Wed Jun 1 22:58:09 2016, comment #2:

hi deimi - wow, that is great! the only (trivial) thing is that the strings should start with "#line ", rather than "// line". #line is what the C preprocessor recognizes.

Can you send me the changes you made to insert those?
(That is, assuming you're ok with them being distributed under the LPPL.)

Just wondering -- is there any chance that perhaps the same code could be done for the generated .4ht and other files? (%line 777 "tex4ht-4ht.tex", etc.) The derivation is so complex, it's often quite hard, at least for me, to track back a given line to the source.


Karl Berry <karl>
Project Administrator
Wed Jun 1 10:23:27 2016, comment #1:

Hi Karl,

I'm attaching two files: tex4ht.c and tex4ht-srclineno.c. Both are generated from sources; the latter is with line numbers. Please can you check if it is something that you want?

Thank you,

(file #237)

Deimantas Galčius <deimi>
Project Member
Fri Dec 24 19:14:33 2010, original submission:

When generating tex4ht.c and t4ht.c, it would be very helpful for debugging if the output included #line directives referring to the original source line (in the .tex files).

The most comparable complete example I can think of is a
hello,world program in CWEB. See source .w and generated .c in attachments.

(If you actually run ctangle, the output will have some additional
comments with CWEB section numbers. That's not relevant to tex4ht so I elided them.)


Karl Berry <karl>
Project Administrator


Attached Files
file #239:  136.diff added by deimi (68kB - text/x-patch)
file #238:  quick-fix-b136.diff added by deimi (2kB - text/x-patch - quick patch for tex4ht-c.tex and tex4ht-t4ht.tex )
file #237:  136.tar.gz added by deimi (104kB - application/gzip)
file #13:  hello.w added by karl (143B - application/octet-stream)
file #14:  hello.c added by karl (132B - text/x-csrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by michal_h21 (Posted a comment)
  • -unavailable- added by deimi (Updated the item)
  • -unavailable- added by karl (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    6 latest changes follow.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Jul 4 18:26:47 2016karlOpen/ClosedOpen=>Closed
    Fri Jun 3 13:19:24 2016deimiAttached File-=>Added 136.diff, #239
    Thu Jun 2 07:55:14 2016deimiAttached File-=>Added quick-fix-b136.diff, #238
    Wed Jun 1 10:23:27 2016deimiAttached File-=>Added 136.tar.gz, #237
    Fri Dec 24 19:14:33 2010karlAttached File-=>Added hello.w, #13
      Attached File-=>Added hello.c, #14
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup+gray