Inserting Tables in Posts

For general announcements by the administration and forum management team.

Inserting Tables in Posts

Postby BioWizard on May 10th, 2009, 3:31 pm 

I added some BBcode to allow tables in posts. For it to work properly, every table must contain at least one row and every row must contain at least one column (even if left empty, the tags should be there). Here's an example:

Code: Select all
[table][row][column]row1 column1[/column][column]row1 column2[/column][/row][row][column]row2 column1[/column][/row][row][column]row3 column1[/column][column]row3 column2[/column][column]row3 column3[/column][/row][/table]


Output:

[table] row1 column1 row1 column2 row2 column1 row3 column1 row3 column2 row3 column3 [/table]

I don't think it will be properly aligned for big tables or if the content of your columns is too long (such as a long string of characters without spaces), but for most simple purposes where you just want to align a small list of things, it should work fine.
User avatar
BioWizard
SCF Admin
 
Posts: 9699
Joined: 24 Mar 2005
Location: United States
Likes received: 12
Blog: View Blog (4)


Re: Inserting Tables in Posts

Postby Nick on May 24th, 2009, 8:35 am 

OK, I've worked out how to do actual tables. You can use the tex \arrray{}{} function, for example:



is written using

Code: Select all
[tex]\begin{array}{|c|cc|}\hline a & b & c \\\hline d & e & f \\ g & h & i \\ \hline \end{array}[/tex]
.

Unfortunately it appears that due to technical complications you need to write the array out as a single line. Writing it in a clearer way, such as:

Code: Select all
[tex]
\begin{array}{|c|cc|}
\hline
a & b & c \\
\hline
d & e & f \\
g & h & i \\
\hline
\end{array}
[/tex]


results in
User avatar
Nick
Active Member
 
Posts: 1959
Joined: 18 Jun 2006
Location: Oxford
Likes received: 4
Blog: View Blog (4)


Re: Inserting Tables in Posts

Postby BioWizard on May 24th, 2009, 8:38 am 

Nick wrote:Unfortunately it appears that due to technical complications you need to write the array out as a single line. Writing it in a clearer way, such as:

Code: Select all
[tex]
\begin{array}{|c|cc|}
\hline
a & b & c \\
\hline
d & e & f \\
g & h & i \\
\hline
\end{array}
[/tex]


results in


The exact reason is that phpbb does not allow HTML within posts, so the <br> tags inserted by Tex for new lines don't get rendered. Good to know that putting everything on a single line fixes that.
User avatar
BioWizard
SCF Admin
 
Posts: 9699
Joined: 24 Mar 2005
Location: United States
Likes received: 12
Blog: View Blog (4)



Return to Announcements

Who is online

Users browsing this forum: No registered users and 0 guests