Learn English – On listing or in listing

prepositionsword-usage

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,

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;

    // ... 
}

Best Answer

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.

Related Topic