| advertise add site services publishers database health videos | ![]() | about toolbar stats live show health store more stuff JOIN/LOGIN |
Industry Leader for Spinal Decompression Tables and Advanced Back Care... advancedbackcare.net | Madeline MBASE Database Table Format eyegene.ophthy.med.umich.... | intersegmental tables,ist table,ist tables,roller massage table,roller... chirocity.com |
This essay, Wikipedia:Advanced table formatting describes some techniques to improve the display or editing of wikitables in Wikipedia. Most of the tips involve use of standard text-editors. While some special software packages exist, to allow customized editing, they are typically not available when travelling to other computers for wiki-editing. Some techniques here are beyond the basics described in the Wikipedia help-page "Help:Table" which explains almost all basic options of table formatting, also showing examples of each.
[edit] A quick multi-column table with spacingThe quickest way to create multiple columns of text is as follows:
However, readers often prefer a vertical listing of data, down each column.
Note that the default background color is lighter, so a shade of light-bluegreen can be specified on each row, using hex-color code "#fafeff" (or "#FAFEFF"), although the color might not matter in large lists:
[edit] Lists in multi-column tables
Even though the coding might seem a little awkward, the results are easily controlled for spacing and alignment. The width of the table will, by default, remain the same for wider or narrowed windows, retaining the alignment with the left-side text (or section titles) outside the table. [edit] Compressing to one-line row formatEach row can be compressed, as a single line, by joining columns with double-bars "||" between them and ending each row with "<tr>".
This is done sometimes because it can be easier to re-arrange or preview rows that are coded as separate lines of text. Multiple columns are joined by double-bars "||" between them, while each single-bar "|" along a line allows a format-specifier before each data-item which ends at a double-bar. However, the wikitable code for a new row, bar-dash ("|-"), must be omitted by adding "<tr>" at the end of the prior row above it. The final row does not need an ending "<tr>". [edit] Floating images in the centerA table can be used to wrap an image, so that the table can float towards the center of the page (such as using: style="float: right;"). However, the table margins, border and font-size must be precisely set to match a typical image display. The Image-spec parameter "thumb|" (although auto-thumbnailing to user-preference width) forces a wide left-margin that squeezes the nearby text, so the parameter "center|" can be added to suppress the left-margin padding. However, "center" sometimes shoves the caption to a 2nd line (under a centered box "[]"), so "thumb|" could be omitted and just hard-code the image size, adding a gray (#BBB) border. Using precise parameters to match other images, a floating-image table can be coded as follows: {| style="float:right; border:1px solid #BBB;margin:.46em 0 0 .2em" |- style="font-size:86%" | valign="top" |[[Image:DuraEuropos-TempleOfBel.jpg|180px]]<!-- --><br> Temple of [[Bel (mythology)|Bel]] (floating). |} The text inside the floating-table is sized by style="font-size:86%". That floating-image table floats a typical image-box, but allows adjusting the left-hand margin of the image (see temple-example floating below).
The caption-text can be omitted, or remove the parameter "thumb|" so the caption is hidden until "mouse-over display". Unfortunately the parameter "thumb|" (used for displaying the caption) also controls the auto-thumbnailing to re-size images by user-preferences size. In April 2009, it was not possible to have auto-thumbnail sizing while also concealing the caption: parameter "thumb|" triggers both actions and forces the caption to display. An image set with parameter "left|" will gain a wide right-side margin (opposite margin of parameter "right|"), so floating toward the left would require an image set as "center|" inside a table with style="float:left; margin:0.46em 0.2em". Recall that, outside an image-table, the parameter "right|" causes an image to align (either) above or below an infobox, but would not float alongside the infobox. Note the order of precedence: first come infoboxes or images using "right|", then come the floating-tables, and lastly, any text will wrap that can still fit. If the first text-word is too long, no text will fit to complete the left-hand side, so beware creating a "ragged left margin" when not enough space remains for text to fit alongside floating-tables. If multiple single image-tables are stacked, they will float to align across the page, depending on page-width. The text will be squeezed to allow as many floating-tables as can fit, as auto-aligned, then wrap whatever text (can still fit) at the left-hand side.
That auto-aligning feature can be used to create a "floating-gallery" of images: a set of 20 floating-tables will wrap (backward, right-to-left) as if each table were a word of text to wrap across and down the page. To wrap in the typical direction (wrapping left-to-right) define all those floating-tables, instead, as left-side tables using the top parameter style="float:left; margin:0.46em 0.2em". Multiple floating-images empower more flexible typesetting of images around the text. [edit] Undenting/bracketing of textReal typesetting software, for over 30 years, typically has had simple directives to trigger alignments as left, right, center, or undented (beyond the left-margin line). However, for decades, HTML has had only limited options for easy alignment (one: <center>). A method for undenting the first word of a paragraph is to put the paragraph into a text-table, where the first word (or syllable) is (alone) in column 1, while the other text is in column 2.
Note the use of both "cellspacing=0 cellpadding=0" so as to not separate the spacing between the first syllable "Bee" and "thoven". A third column can be used to enclose text in outside brackets, then putting the closing-bracket "]" in column 3, as follows:
Again, the designers of the HTML language had only limited knowledge of typesetting (such as: font size=1 to 5!), so the only alignment directive was "<center>". However, the currently invalid options "<left>" and "<right>" could be added someday, as a trivial implementation, because to handle "center" then left/right must already be known to the computer. The pitfalls of HTML, developed with little knowledge of typesetting (or even of computer languages), are typical when amateurs (or college dropouts) try to create a new technology. Note that there are some examples of the opposite effect: such as an opera singer (Luciano Pavarotti) learning to sing well without being able to read music. However, in general, most attempts by hacks are botched failures. It is important to seek the knowledge of experts, but hacks might not even understand the basics that experts know, so some humility is needed in such discussions. [edit] Tiny tables within a text lineFor years in HTML, a table has always forced an implicit line-wrap (or line-break), so to keep a table within a line, the work-around is to put the whole line into a table, then imbed a table-within-a-table, using the outer table to force the whole line to stay together. Consider the following examples:
Use style="font-size:60%" to shrink the text within the box. However, the small text could be replaced with small images (aligned inside the inner table). The outer table is for 1 line only, so to make a 2nd line appear even, the exact length of line 1 must be pre-determined, to match the length of other lines. [edit] Moving or exchanging columnsSometimes columns of data need to be listed in a different order, such as different contents in the 2nd column. Yet, because a wikitable is coded in markup language, the columns cannot simply be dragged across the screen as with a column-oriented editor. Instead, the harsh reality is that the tedious hand-editing of each cell, within a row, is often required as the fastest solution, in the long run. However, some text editors do allow a repetition-loop to be defined to locate and shift every 7th line or such, as a repeated pattern that could re-arrange the columns in a large table. In another method sometimes used, every data-item is first prefixed with an alphabetic code, hand-coded for the eventual sequence, then those lines are sorted, and afterward all the leading-text prefixes are removed. Sorting can be done in separate files, such as using a DOS-prompt command: SORT myfile.DAT > myfile2.DAT, or else use a text-editor such as Notetab, which has a modify-lines-sort option. Edit-tricks are most useful when multiple tables must be changed, then the time needed to develop complex edit-patterns can be applied to each table. For each table, insert an alpha-prefix on each column (making each row-token "|-" to sort as column zero, like prefix "Row124col00"), then sort into a new file, and then de-prefix the column entries. Again, bear in mind, the tedious hand-editing of items, in each row, is often faster, than the potential of automated edits gone awry. If just 2 columns are being swapped, within 1 table, then cut/paste editing (of those column entries) is typically faster than column-prefixing, sorting & de-prefixing. [edit] See also[edit] Notes
| ||||||||||||||||||||||||||||||||||||||||||||||||||
| ↑ top of page ↑ | about thumbshots |