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

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Wikipedia: The Missing Manual (Discuss)

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[edit]

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 colors. 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[edit]

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?[edit]

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.

Figure 14-1. Shown are two ways of including the same information in an article: in list format (top) and narrative format (bottom). In this case, narrative is better. It maintains the article's flow and takes up less space.

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 Wikipedia:Embedded list (shortcut WP:EMBED).

Note:
Sometimes the term "list" refers to something more complicated—a presentation of similar, multiple items in a multi-column format. That's actually a table, and you can read about them in the section about editing and creating tables.

How to create a list[edit]

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.

Figure 14-2. The wikitext for the bulleted list in Figure 14-1 is very simple—an asterisk at the beginning of each item in the list.

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.

Figure 14-3. Putting pound (#) signs at the beginning of a line of text will number that line. Numbering is rare in articles, but it's handy (and common) on discussion pages. Typos can wreak havoc in wikitext numbered lists. For example, if you put a blank line between items, the numbering starts over.
Tip:
The technical page Help:List describes more than a dozen ways to modify lists: You don't need to know any of them for editing articles. You might see the more fancy options on discussion pages, but rarely even there.

Long lists within articles[edit]

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[edit]

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[edit]

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.) A related problem—of point of view—occurs when an article consists of lists of arguments for and against some particular contention or position. Such articles are not acceptable per the guideline Wikipedia:Pro and con lists (shortcut: WP:PACL).

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 Wikipedia: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.)

Note:
As an editor, treat problematical lists exactly like other problem articles, as described in Chapter 19: Deleting existing articles. If you see what looks like a bad list, you might want to post a question on the talk page of the guideline Wikipedia:Stand-alone lists (shortcut: WP:SAL) before formally proposing the list for deletion.

Good lists[edit]

As of late 2015, nearly 3000 articles had 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.

Figure 14-4. The criteria for evaluating whether an article gets to be a Featured list is at Wikipedia:Featured list criteria (shortcut: WP:WIAFL). You can use the criteria as a checklist to improve a list that interests you. When you think your list is good enough, you can submit it to a review to see if it earns the Featured list designation.

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.

Figure 14-5. The article List of wild mammal species in Florida has been designated as a Featured list. It's an amazing collection of sortable lists, with pictures and well over a hundred footnotes for those interested in more information. The star in the upper-right corner indicates that it's a Wikipedia featured page. The same star appears on Featured Articles and Featured Portals.

Lists versus categories[edit]

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.

Note:
Wikipedia:Categories, lists, and navigation templates (shortcut: WP:CLN) discusses the differences between list articles and category pages. Chapter 18: Better articles: A systematic approach goes into detail about the advantages and disadvantages of the two approaches.

Formatting alternatives[edit]

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.
Figure 14-6. The article List of economists is a simple bulleted list of wikilinks. It resembles a category page (see Chapter 17: Categorizing articles) so much that pages like this one have been the subject of fights between proponents of categories (who want to delete lists like this) and those arguing that lists are just as good, if not superior. For more information, see the section about categories versus lists.
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.
Figure 14-7. Here's the beginning of the article List of winners and shortlisted authors of the Booker Prize for Fiction. It's an example of indented bulleted paragraphs within articles.
The formatting for the indented, bulleted paragraphs in Figure 14-7 is straightforward, as shown in Figure 14-8.
Figure 14-8. You indent bulleted paragraphs simply by putting two asterisks at the beginning of a line, rather than one. This arrangement looks nicer than colon indenting, but it's more fragile. If you make a mistake and have a blank line just above the double asterisks, then the viewable version of the page shows two bullets at the beginning of the line, not one indented bullet.
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.
Figure 14-9. The article List of finance topics is arranged hierarchically. This scheme is a bit more challenging for editors, but it helps readers comprehend what otherwise might be a long alphabetized list. It also helps readers find related articles that wouldn't be obvious in an alphabetical list.
  • 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.)
Figure 14-10. The article List of social networking websites consists primarily of a sortable table, which lets readers reorganize the table to better find what they want. (For more on sorting tables, see the section about sortable tables.)
  • 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.
Figure 14-11. Here's one of three timelines that make up the article Timeline of architectural styles. It uses the <timeline> tag syntax, sometimes called EasyTimeline syntax. Graphical timelines are relatively rare, but you can read about them at Wikipedia:Timeline (shortcut: WP:TIMEL) and Help:EasyTimeline syntax.
Note:
Timelines also appear in non-list articles, often as navigation templates. (Some of these timelines actually are templates, with a different syntax from the newer <timeline> tag syntax.)
  • 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.
Figure 14-12. The article List of places in Alabama: D-H. The box near the top of the article, with text that begins "Places in Alabama", is there because the underlying wikitext includes the template {{List of places in Alabama}}. That template also appears at the top of the other five lists (A-C, I-K, L-N, O-R, and S-Z) that comprise a single list. This navigational template makes it easy for the reader to get to any of these six parts, although they're separate articles.
Note:
Figure 14-12 is another example of a list that's basically a table. Unlike Figure 14-10, however, this table isn't sortable.

Editing and creating tables[edit]

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[edit]

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.

Figure 14-13. Here's a table (top) and its underlying wikicode (bottom). The wikicode is split into seven chunks by six blank lines, for ease of understanding. You don't usually find blank lines in the wikicode between rows of a table, as is the case here. (These blank lines make no difference in what the reader sees.)

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.)

Note:
Figure 14-13 makes it clear where a row starts and ends, but in real life you don't see the blank lines that clearly separate one row from another. The first line of a row has "|-" at the beginning; the row is always two or more lines long; and a row continues until you see another line that starts "|-", indicating that the next row's starting.

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[edit]

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 Wikipedia: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.

Note:
If you know HTML, you may be tempted to create tables using the <table> tag. But don't. Although the <table> tag still works (it used to be the only way to create tables in Wikipedia), wikicode tables are more flexible, sortable, and easier to edit.

Basics of creating tables[edit]

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.

Figure 14-14. On the edit toolbar, if you click the "table" icon, in editing mode, the software generates a basic table for you. It may not be much, but it's a start if you're creating a table from scratch.

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

Figure 14-15. This table arranges a list of information into three columns. In some sense, this isn't a true table because it doesn't have rows (or, to be exact, it's formatted as if it had only one row), and the information in one column doesn't necessarily line up with information in the other columns. (Notice that the center column has four entries, versus three entries for the left and right columns.) Still, it can be useful for getting a long list to fit into much less space.

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.
Table classes

Specifying a class for a table, such as class="wikitable", tells Wikipedia to use predefined formatting for the table. An extreme example would be putting class="wikitable sortable collapsible collapsed" into the first line of a table. That makes it a standard wikitable (governing things like how headings are formatted); sortable by clicking on a column heading; collapsible to a single row, with just a click, if a reader wants to get it out of the way; and initially displayed as a single row (collapsed) rather than fully visible when the page first opens. The collapsed option is the least common. If a table's worth adding to an article, why hide it?

You can learn more about sorting tables in the section about sortable tables. Collapsing is less common. If you really want to learn how to do it, see Help:Collapsing.

Making tables more usable and accessible[edit]

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[edit]

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".

Note:
If you've never seen a sortable table in Wikipedia, go to Help:Sorting and check some of the examples there. If you can't get any tables there to sort themselves, then you don't have JavaScript turned on in your browser. (See the section about enabling JavaScript for how to do so.)

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.

Note:
Just because a table is sortable is no reason for you to just add new rows at the bottom of the table. Some readers won't understand the table is sortable, and folks viewing via a mobile device, or via a screen reader, or on a printed page, won't be able to. Sorting should always be an option for a reader who wants to see a table in a different way, not a requirement to see it in the correct sequence.

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.
Tip:
Avoid using a format like "05-01-2007"; in some countries that date would be May 1, 2007, in others it would be January 5, 2007.
Importing tables from Microsoft Word and Excel

Three tools let you transfer non-wiki text into wiki code without knowing wiki code. The first two preserve the formatting of tables and their contents, but you should use them only if you're well-versed in Word or Excel or if you have a large number of offline documents that you plan to convert into Wikipedia content.

(If you do have a lot of documents to add to Wikipedia en masse, make sure that they follow Wikipedia's rules about content being notable, verifiable, and not original research, as discussed in Chapter 4: Creating a new article.)