0

I know that when it comes to graphical elements (such as figures, pictures, photos) you should always use in, for instance:

  1. in the picture,
  2. in figure 4,
  3. ...

But what about code listing? Should I write "on listing 3" or "in listing 3"?

I would like to say something like this:

As it can be seen on/in listing 3, the variable needs to be initialized with the value of 1024.

I meant the source code listing. The code of the computer program, given in text.

On/in listing below, the port variable is initialized with the value of 1024:

int main(int argc, char **argv)
{
    char * ip_addr;
    int port = 1024;

    // ... 
}
3
  • What is "code listing" / "listing 3"? More detail is needed.
    – user3169
    Commented Feb 26, 2017 at 19:13
  • Do you mean "line 3" instead of "listing 3"?
    – Laurel
    Commented Feb 26, 2017 at 20:50
  • Is "listing" a self-contained set of lines of code, such as an example function? Commented Feb 26, 2017 at 22:08

1 Answer 1

1

In the listing is what this native US English speaker would say, and Google Ngrams shows in to be much more common.

In general, we use in for anything printed, and anything that something else could literally be inside of:

Have you seen the article in today's newspaper?
As it says in the Bible...
The details are in the latest report.

On is used more with means of broadcast communication:

I saw it on the internet.
The president will be on TV today.

But there are some exceptions. We say something is on a page, like

You will find the recipe on page five.
perhaps because the information is literally printed on top of the page. And we also say that something is on the menu, maybe because menu doesn't necessarily refer just to the literal printed menu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .