4

This source:

\starttext
  \startlinenumbering
    \starttyping
      int x;

      int y;
    \stoptyping
  \stoplinenumbering
\stoptext

Renders like this:

1       int x;

2       int y;

How can I make it number the empty line?

1 Answer 1

3

Not sure why linenumbering and typing don't play nice together, but if you just want display-style verbatim to be numbered you can set up the typing environment to do that itself:

\setuptyping[numbering=line]
\starttext
  \starttyping
    int x;

    int y;
  \stoptyping
\stoptext

produces the following.

1       int x;
2
3       int y;
8
  • This only numbers the first line for me.
    – flyx
    Nov 10, 2017 at 14:08
  • @flyx That's odd. This works for me on the version of ConTeXt that shipped with TeX Live 2017, and a more recent Minimals version.
    – 9tTn9B
    Nov 10, 2017 at 14:17
  • I am still on Tex Live 2016 for various reasons. However, it would be strange if this only worked with the most recent version.
    – flyx
    Nov 10, 2017 at 14:20
  • 2
    @flyx: If you don't want to update Tex Live, you can install ConTeXt standalone in a parallel directory without interfering with TL.
    – Aditya
    Nov 10, 2017 at 14:59
  • 2
    @flyx I went through the ConTeXt source to find why it's not working in TL 2016. Unfortunately, the change is on the Lua level, so it's not easy to backport the fix. You'd have to edit the core files and rebuild the format. Therefore I also advise you to either update TL or use Standalone (I recommend Standalone, the TL 2017 snapshot of ConTeXt was a bit broken). Nov 11, 2017 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.