Help talk:Table

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Wikipedia Help Project (Rated NA-class, Mid-importance)
WikiProject icon This page is within the scope of the Wikipedia Help Project, a collaborative effort to improve Wikipedia's help documentation for readers and contributors. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks. To browse help related resources see the Help Menu or Help Directory. Or ask for help on your talk page and a volunteer will visit you there.
 NA  This page does not require a rating on the project's quality scale.
 Mid  This page has been rated as Mid-importance on the project's importance scale.
 

An entire cell as a link?[edit]

Is it possible for an entire cell in a table to be a link itself, so rather than using [[A]] inside the cell, is there code that lets the whole cell from top to bottom, left to right be one big link? -- AxG /  10 years of editing 12:36, 24 September 2016 (UTC)

AFAIK, only in the usual way, by placing the cell's text to the right of a pipe after the intended link target:
no links here This will link to EN Wikipedia's Main Page – Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-- Michael Bednarek (talk) 12:45, 24 September 2016 (UTC)

Better way to do decimal point alignment?[edit]

While working on Atomic clock#Secondary representations of the second, I wanted to do decimal point alignment of a column to emphasize the order-of-magnitude differences between microwave and optical frequencies, and the nested table recommendation at Help:Table#Decimal point alignment is very awkward because you have to specify an explicit column width.

So I played around with CSS and came up with the following. (The example here is simplified by removing references and irrelevant columns.)

Atomic clock operating frequencies
Atom Frequency (Hz)
133Caesium 9 192 631 770  exactly
87Rubidium 6 834 682 610 .904 324
1Hydrogen 1 420 405 751 .766 7
87Strontium 429 228 004 229 873 .4

The column is actually two. The header cell specifies colspan=2, while the body cells specify style="text-align:right; border-right:none; padding-right:0;" and style="text-align:left; border-left:none; padding-left:0;", respectively.

This seems obviously superior to the nested-table construct, in particular letting the browser choose appropriate column widths, but before I go in and change the recommendation, can anyone see any reasons why it's not? E.g. should I leave the existing more awkward suggestion for some special cases? 71.41.210.146 (talk) 14:03, 27 September 2016 (UTC)

I just saw your edit on Atomic clock and found your formatting solution way more elegant than the previous nested table. I see no reason for not changing the recommendation. — Edgar.bonet (talk) 15:25, 27 September 2016 (UTC)
Okay, thanks, I'll WP:Be bold and change it. It's not like an edit is irreversible. 71.41.210.146 (talk) 17:13, 27 September 2016 (UTC)
It seems like a lot of code to use directly. I have made (not documented yet) {{alignd}} to align decimal numbers with the suggested code, and {{alignd column}} to be placed in other cells of the column. The below table looks the same as above but has simpler code. Templates also mean implementation details could be changed later. PrimeHunter (talk) 00:54, 28 September 2016 (UTC)
Atomic clock operating frequencies
Atom Frequency (Hz)
133Caesium 9 192 631 770  exactly
87Rubidium 6 834 682 610 .904 324
1Hydrogen 1 420 405 751 .766 7
87Strontium 429 228 004 229 873 .4
That's much neater, but "alignd" looks like a misspelling of "aligned". Perhaps something like "aligndp" would be clearer? -- John of Reading (talk) 06:17, 28 September 2016 (UTC)
I haven't tried it, but inspecting this code, and the previous, suggests to me that the full numbers cannot be sorted. If so, this should be mentioned in the documentation. If I needed decimal point alignment and sorting, I would use a right-aligned fixed-width font and a fixed number of decimals (which doesn't work well for vastly different orders of magnitude). -- Michael Bednarek (talk) 08:33, 28 September 2016 (UTC)
Sorting works surprisingly well when it just gets data-sort-type="number" in the header. My limited tests like the below sort correctly by the full number including decimals. PrimeHunter (talk) 10:15, 28 September 2016 (UTC)
Atomic clock operating frequencies
Atom Frequency (Hz)
133Caesium 9 192 631 770  exactly
87Rubidium 834 682 610 .904 324
1Hydrogen 1 420 405 751 .766 7
87Strontium 429 228 004 229 873 .4
1Hydrogen 1 420 405 751 .78
1Hydrogen 1 420 405 751 .7
Wow, I'm indeed surprised, and withdraw my previous uninformed remarks unreservedly. -- Michael Bednarek (talk) 12:24, 28 September 2016 (UTC)
Presenting {{Decimal cell}}, which takes the value as an actual decimal number, rather than two separate parameters for integer and fractional components as {{alignd}}. That makes it easier to upgrade existing cell values and generally minimizes the surprise or special knowlege required to read/edit the wikitext. And it also takes an optional CSS string that propagates into both subcells. DMacks (talk) 06:26, 25 February 2017 (UTC)

Help on table creation[edit]

Hello,

What's the right way to create a table for production figures?

I'd like to create a new monthly production table for the T-34 article. However, the tables on Soviet combat vehicle production during World War II gave me a rough idea, thought, I want it closer to the orginial as depicted in the book. Have a look on the picture: http://i.imgur.com/QCCHaRi.jpg

I've started with some tryouts on my sandbox, but, I'm not sure if I'm doing it right: https://en.wikipedia.org/wiki/User:Dircovic/sandbox

Would love to have some help! Thanks in advance. Dircovic (talk) 07:26, 12 November 2016 (UTC)

Diagonal split header[edit]

Hi, I have a quick question regarding the {{diagonal split header}} template: is there a similar template for the diagonal line going "the other way" (i.e. top-right to bottom-left)? Skewb? (talk) 23:53, 2 January 2017 (UTC)

@Skewb?: I don't think so but it could be made. What is it for? PrimeHunter (talk) 00:32, 3 January 2017 (UTC)
@PrimeHunter: It's not for anything important (though maybe it could be useful in the future). I just want to experiment with different shapes of tables on my sandbox, but I don't think there's any way of creating a diagonal split (either in the header or anywhere else) except for the above template. Skewb? (talk) 21:17, 3 January 2017 (UTC)
@Skewb?: A similar template to the above could certainly be made, or the type of code it uses could be written directly in a table. But the template uses an ugly hack to achieve it and diagonal "splits" in the other direction seem far less useful. The generated html is one cell with a diagonal line where the template just tries to guess how to position two different texts so they end up on each side of the line without an unnatural position in their triangle. Users of the template may have to add additional blankspace to avoid crossing the line. Other browsers, font settings, printers and so on may render it differently, and I imagine it's confusing to screen readers (see MOS:DTAB). Without a good use case I don't think it should be done. PrimeHunter (talk) 11:15, 4 January 2017 (UTC)
@PrimeHunter: Fair enough, I personally don't have an issue with writing the code itself directly into the table. I'm not very good at coding though, so could you please let me know what the code for diagonal lines (in both directions) would look like? Skewb? (talk) 12:55, 4 January 2017 (UTC)
@Skewb?: You can try Special:ExpandTemplates to see the code {{diagonal split header}} generates and then tinker with it. PrimeHunter (talk) 01:28, 5 January 2017 (UTC)

Indent a table[edit]

Hi there. How can an indent be introduced to move a simple table a bit to the right? Diceypoo (talk) 10:25, 25 February 2017 (UTC)

@Diceypoo: Place one or more colons before {|. PrimeHunter (talk) 10:38, 25 February 2017 (UTC)
@PrimeHunter: thanks. I had tried that, not sure why it didn't work! Any tips to make this easier to find / searchengine-friendlier? Diceypoo (talk) 13:05, 25 February 2017 (UTC) Indent Table Wiki Wikipedia
1 2
row1cell1 row1cell2
row2cell1 row2cell2

Rowspan in Aux1[edit]

Is it possible to use rowspan="number" in Aux column? The example of table used is the one for anime episodes --Yukinotane (talk) 23:02, 12 April 2017 (UTC)

@Yukinotane: Your question is about the Aux1 parameter of Template:Japanese episode list in for example One Room (anime)#Episode list. The table formatting is done by the template which has no support for adding a rowspan. PrimeHunter (talk) 23:48, 12 April 2017 (UTC)

Autonumbering[edit]

This could be added to the page. Thoughts? Anna Frodesiak (talk) 18:36, 20 April 2017 (UTC)

I agree that Module:Autonumber should be mentioned overleaf. This feature has also been mentioned at User:Pee Tern/Sandbox/Template/autonumbered list/doc. -- Michael Bednarek (talk) 06:08, 21 April 2017 (UTC)