Help:Wikipedia: The Missing Manual/Formatting and illustrating articles/Creating lists and tables

Lists and tables are two different ways to format multiple, similar items on a page. Lists and HTML tables go back to Wikipedia's early days. The current wikicode tables (see the section about tables), which you can edit more easily and even sort, came later.

You'll find many more lists than tables on Wikipedia. For example, the External links sections that appear in almost every Wikipedia article are lists. Tables are less common, but they're making up ground fast. You'll probably have occasion to edit a table, if not make one. This chapter shows you how to create and edit both lists and tables.

Creating and editing lists
Wikipedia has two kinds of lists: embedded lists (a list within a larger article), and standalone lists (an article that's only a list). An example of the latter is the article List of science fiction novels. Embedded lists are easier to grasp, both conceptually and in terms of formatting, although you won't have trouble understanding articles that are lists.

Bulleted and numbered lists within articles
Lists are easy to create, but sometimes you really shouldn't. Before you make a list, read the first part of this section and think about whether you could present the information in narrative form. When you're ready to make a list, skip to the section about creating lists to see how to create the underlying wikitext.

Presenting information: list, narrative, or neither?
Wikipedia articles are intended to be narratives, not guides or places for stockpiling information, as explained at What Wikipedia is not (shortcut: WP:NOT). So first ask yourself, when you see a list in an article, or when you're considering adding a list to an article, whether that list even belongs in an article. Some cases are very clear: A list of links in the External links section of an article absolutely needs to be there, in list format. But in an article about a nonprofit organization, a full list of the 45 members of its advisory board would be a violation of WP:NOT.

Some editors feel that the more information an article contains, the better. Long lists tend to prove the opposite: They take up valuable editing time to create and maintain, and they're distracting. In the nonprofit organization example, readers who are really interested in who's on the advisory board can find out by going to the organization's Web site. If there are a few notable board members, you can simply mention them in a quick sentence. ("The advisory board includes Michael Dell, Al Gore, and David Hasselhoff.")

If you decide that some or all the items in a list belong in a Wikipedia article, your next decision is whether to use a formal list; that is, one using wiki markup. For example, Figure 14-1 shows two ways of presenting the same information, with a list and without.



Popular opinion at Wikipedia is against lists in articles, particularly numbered lists, if narrative is an alternative. But sometimes a bulleted list can break up what would otherwise be an overly large, gray mass of text, particularly if the topic is dry or complex. (Put differently, sometimes bulleted narrative makes sense.) You'll find a nuanced discussion of bulleted lists versus fully narrative text at the guideline Embedded list (shortcut WP:EMBED).

How to create a list
To create a list in Wikipedia, you add special characters to the text of the list items. The special characters tell the software how to format the list onscreen. The combination of text and formatting characters is called wikitext. In Figure 14-2, you can see the underlying wikitext that creates the bulleted list in Figure 14-1.



To create a list, simply go into edit mode, type or paste the list items (each on a separate line), and then type an asterisk (*) at the beginning of each list item for a bulleted list or a pound sign (#) to create a numbered list. Figure 14-3 shows the same list used in previous examples, this time as a numbered list. Generally, a numbered list should only be used for lists where ordering is important, such as steps in a process, or chronological lists.



Long lists within articles
Lists often begin as sections of an article, and then expand. At some point, a list can become too long to be part of an article, and needs to be spun off as a separate "List of" article. In the section about daughter articles, you can find step by step instructions for spinning off a section into an article of its own (in fact, the example in that section is a list).

Lists as separate articles
Standalone lists are Wikipedia articles that are basically one big list, usually consisting of links to articles in a particular subject area; for example, North American mammals, or economists, or events listed chronologically. The titles of these articles almost always begin with the phrase words "List of" or "Timeline of". (There's an occasional "Glossary of", which is a sort of list, and a few pages called "Graphical timeline of", as well.) Standalone lists, like other articles, are subject to Wikipedia's content policies, including verifiability, no original research, and neutral point of view.

Bad lists
Lists need to be about notable things. Red links (wikilinks to non-existent articles, which show as red instead of blue) are allowed in lists, but only in small amounts. A preponderance of red links probably means that the subject isn't notable enough to be on Wikipedia. For example, an article called List of high school science teachers in New York City, with entries that include only a couple of blue links, would make the article at best a guide and at worst a vanity article, both of which are disallowed by WP:NOT.

Lists that are too general or too broad in scope have little value. For example, a list of brand names would be far too long to be useful (it would also require Herculean efforts by a fairly large number of editors to properly maintain it). Lists that are too specific are also a problem. For example, an article List of one-eyed horse thieves from Montana would be of little interest to anyone except the person making the list.

Lists are prone to suffering from unclear criteria or a non-neutral point of view, which may actually be the same problem. Examples include List of exploitative companies, List of authoritarian leaders, and even List of famous Brazilian people. (Change "famous" in the last example to "notable," and the problem goes away, since Wikipedia has notability criteria for articles about people, for the purposes of determining if they're entitled to a separate article in Wikipedia.)

As with everything else at Wikipedia, there isn't universal agreement about exactly what's acceptable as the subject of a list. One argument, mentioned in the essay Listcruft (shortcut: WP:LC), states that the only legitimate "List of" articles start out as sections of existing narrative articles, and are only broken out when they become disproportionately long for the original article. (Essays are opinions, not policy.)

Good lists
articles have earned the honor of being designated Featured lists (see the section about featured content), with roughly 20 to 40 more lists being so designated each month. Figure 14-4 shows some of the criteria. The full criteria include complying with the Manual of Style (WP:MOS) and standards of any relevant WikiProject, and making sure any images are appropriately captioned and not copyright violations.



Looking at articles designated as Featured lists can show you the variety of formats used for lists, and the astounding quality achieved by some. Figure 14-5 shows one example.



Lists versus categories
A list article in its simplest form consists of an introductory sentence or two, followed by an alphabetized bullet list of links to (mostly) existing Wikipedia articles. It resembles a category page.

Formatting alternatives
If you look at the wikicode for articles that are lists, you find a number of different things:


 * Narrative. The initial section of an article that's a list explains what the list is about, in the usual narrative format. Narrative can also appear in other places—the article in Figure 14-5 has not only a long lead section but also a number of narrative paragraphs at the beginning of sections. Some articles that have a name beginning with "List of", such as List of Pokémon (481-493) are a collection of information that might at some later point become individual articles, and are entirely narrative. (On the other hand, the article could be renamed Pokémon species 481 to 493.)
 * Bulleted lists using asterisks. You saw an example of bulleted lists at the top of Figure 14-1, with wikitext in Figure 14-2. That's an embedded list, but the code is exactly the same for standalone lists. That kind of bulleted list created with asterisks is the oldest form of Wikipedia list, and it's still the most common for standalone lists, since it's so easy to use. You can see an example in Figure 14-6.




 * The bulleted list has a couple of variants. One, called an annotated list, adds a bit of information after each link. If Figure 14-6 were an annotated list, for example, the entry for Diego Abad de Santillán might have "(1897–1983), Spain" after the wikilink. A second variant is a bulleted list with some items indented, as a sort of subcategorization. Figure 14-7 shows an example of a bulleted list with indented items.




 * The formatting for the indented, bulleted paragraphs in Figure 14-7 is straightforward, as shown in Figure 14-8.




 * The bulleted list in Figure 14-6 is alphabetical; the one in Figure 14-7 is chronological. (Lists whose titles begin "Timeline of" are, of course, always chronological.) Bulleted lists can also be hierarchical, as in Figure 14-9.


 * A table is a third kind of wikitext (besides narrative and bulleting) used for lists. Figure 14-10 shows an example. Tables can be the bulk of a list article or just part of a narrative article. ("Editing and creating tables" has the full story.)


 * A fourth kind of formatting for lists uses a graphical timeline. Such lists are usually named "Timeline of X," or "Graphical timeline of X". Figure 14-11 has an example of a graphical timeline that functions as a list.




 * Finally, you can split long lists using a navigational template that lets readers know that though they're looking at just one article, that's part of the a set of related articles that together make up a full list. Figure 14-12 gives an example.



Editing and creating tables
Tables are ideal for presenting information in a row-and-column format. You create Wikipedia tables using wiki markup, which begins with "{|" and ends with "|}". Since you'll edit tables much more often than create them, this section begins with editing. (To see how to create a wikicode table, skip to the section about creating tables.)

Editing tables
Even if you never create a table from scratch, you still need to understand the basic structure to edit a table. Figure 14-13 shows the wikicode underlying a simple table.



Here are the elements of the wikicode that makes up a table:


 * 1 . A table always begins with "{|". In this case, an optional parameter, class="wikitable", has been added. That parameter tells the software to do standard table formatting, such as shading the top row.
 * 2. This line adds an optional caption (starting with "|+").
 * 3 through 6. Each row of a table, including column headings (if any) consists of two or more lines, with the first line essentially saying, "A new row starts here!"
 * 3, 4, 5 and 6 illustrate four different ways that cells in a table can look in wikitext. Each cell must be separated from the previous cell in its row by either inserting two vertical lines between the cells, if the cells are placed on the same line, or putting the second cell on a new line, with one vertical line ("|") at the beginning.


 * In 3, 4, and 5, one or more of the "|" symbols have been replaced by the "!" symbol, which tells Wikipedia to format that cell as a heading. Exactly how that heading appears to the viewer depends on the viewer's browser.


 * Comparing 4 to 5, the reason that cells B3 and B4 are bolded (treated like headings) is because they're on the same line as row heading 2, which has an "!" in front of it. Row 4 is correct; row 5 is wrong.


 * 7. A table must end with "|}" on its own line

When editing a table, you generally want to do one of three things: Change the content of an existing cell, add a row, or delete a row. The first is fairly straightforward: In editing mode, find where the cell starts, and add or change text. Adding a row isn't difficult either: In editing mode, find the row above or below where you want to add a row; copy that row and paste it into the table. Now you have two identical rows; edit one of them with the information you're adding. (Deleting a row is even easier than adding one; just select the lines that make up that row, and delete away.)

To test your understanding of editing tables, see if you can answer the following question: In Figure 14-13, look at the last three rows in the table. How many lines of wikicode are there for each of these three rows? (Do count the first line of each row, the line that begins "|-"; don't count any of the six blank lines inserted in the wikicode to make it easier to read.) The answer: 4 lines, 2 lines, and 2 lines, respectively. If you got that, then you're ready to copy, insert, and even delete rows from any table you find.

Creating tables
In your career as a Wikipedia editor, you'll make lists, as described at the beginning of this chapter, much more often then tables. First off, lists are much easier to create—for most, you just type an asterisk before each list item. Tables involve much more complex wikicode.

You probably don't want to create a table unless your information needs three or more columns. If there's only one column, you can simply display the information in a list, which is much easier to edit than a table. If there are two columns, it's still better to present information as a list (either annotated or indented, as discussed in the section about alternate list formats) unless it would be useful to sort the information by the second column. (Tables can be sorted, lists can't.) For a fuller discussion of when to create a table instead of list, check out the guideline When to use tables (shortcut: WP:TABLE), which is part of Wikipedia's Manual of Style. If you're still sure you want to create a table, read on.

Basics of creating tables
For the most basic table, you can use the edit toolbar's table icon to generate some starter wikicode (Figure 14-14). Then you can expand it and add your information.



You can also use a table to format a multicolumn list. To do so, use the simplified wikicode shown in Figure 14-15.



If neither of the previous two examples meets your needs, you need to create a table from scratch. Here's a quick three-step plan for creating a table:


 * 1) Read the page Help:Table; which has lots of detailed information and examples.
 * 2) Read the tutorial User:Smurrayinchester/Tutorial/Tables and slightly more advanced User:Dcljr/Tables.
 * 3) Find a table in an existing article that's pretty close to what you want, and copy it. Then you only have to tinker with the formatting, add or subtract rows, and edit the contents of the cells in the table, replacing them with whatever you want in your table.

Making tables more usable and accessible
You can make tables more usable to everyone, not just normally sighted people with high resolution monitors, by doing several things:


 * Don't set fixed column widths, unless you're trying to slim down a column where only a few cells have lengthy text. Setting a lot of fixed width columns, even if the total is less than 800 pixels, can cause problems for users with narrow viewports (mobile devices) or those using large text sizes. If you need to, specify a percentage to allow a degree of flexibility. Even then, you may still be better off simply trusting the software to deliver an acceptably viewable table.
 * Put a summary in the top line of the table. The format is simple: summary="..." (you don't need a comma, or any other separator, before or after). A summary (which isn't displayed visually) provides a description of the table's purpose and structure for non-visual browsers, which read the page aloud. For example, a summary might say, "The table is organized with the oldest model of the automobile first, and the latest model last."
 * Use exclamation points ("!") for row and column headings, as shown in Figure 14-13, Figure 14-14, and Figure 14-15, rather than specifying specific formatting for headings (bold, larger font size, or whatever). When you let the software do the work, it can adjust for different browsers and screen sizes and resolution. Also, omitting your own personalized formatting for headings simplifies the table.


 * When voice browsers read a table aloud, they repeat the appropriate column headings when reading a cell. If they can't figure out the column heading, they just read cell information without the context of a column heading.


 * Add an abbreviation for voice browsers if column headings are more than a word or so. For example, if a column heading is Number of edits, change that to abbr="Edits" | Number of edits. The heading stills visually displays "Number of edits", but the voice browser just says, "Edits."
 * Don't code information into the table using only colors or colored symbols. For example, in a table about U.S. politicians, if you color rows about Republicans in one way, and Democrat rows in another way, you should also include text in the rows that specifies party affiliation. Similarly, in a table about subway stations, it's okay to indicate the subway lines that stop at a station by using colored boxes, but you also need to put text in those boxes.


 * Coloring and bolding are good things, not problems, since they provide immediate visual cues. But make the same information available in text form as well, at least subtly: "(R)" for Republican, "(D)" for Democratic, for example, or by putting a "B" or a "BL" inside the blue box that indicates that the Blue Line stops at that station.

Sortable tables
Being able to sort a table—especially a long table—makes it much more valuable to readers. For example, some people may want to look at a list of U.S. presidents in chronological order; others want to see it alphabetically. Whenever you create or edit a table, consider whether you can make it sortable.

Sortable tables have arrows in the cells of the top row that you can click to sort by that column, as shown in Figure 14-10 (see the section about alternative list formats). The code to make a table sortable is straightforward: Instead of class="wikitable", in the first line of the table, use class="wikitable sortable".

In a sortable table, when you click an arrow, the table sorts itself based on the selected column, in ascending order. The arrow's a toggle switch: If you click it again, the table sorts itself in descending order rather than ascending order.

If you create a sortable table or change one to be sortable, you need to understand the software's logic when sorting. First, the software decides which of four types of data is in that column: dates, currency, numbers, or text (what Wikipedia calls strings). Looking down the column, the software finds the first non-blank cell and assumes that everything else in the column is in the same format. But a number of things can go wrong:


 * Mixed types of data in a column don't sort right. For example, in a column that's for calendar dates, don't put "Unknown" where a date isn't known. Just leave the cell blank.
 * Numbers aren't displayed correctly. The sorting algorithm isn't thrown off by commas or decimal places, but it doesn't insert missing commas, or align a column of numbers on the decimal point (rather, columns are aligned left or right, or centered). So make sure to format numbers consistently. Don't put commas in some figures and leave them out of others. Similarly, when you have figures with decimal places, try to have the same number of digits to the right of the decimal point.
 * Dates aren't formatted correctly. The correct format for Wikipedia purposes is "14 June 2007", not "June 14, 2007". If you use the latter, the software thinks you're using text, and alphabetizes the column.