## Inserting Tables in Posts

Welcome to the net's high quality science forum, philosophy forum, and live chatrooms! Please read the rules and enjoy your stay.

### Inserting Tables in Posts

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:

 row1 column1 row1 column2 row2 column1 row3 column1 row3 column2 row3 column3

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.

BioWizard

Posts: 12346
Joined: 24 Mar 2005
Location: United States
Blog: View Blog (3)

### Re: Inserting Tables in Posts

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

$\begin{array}{|c|cc|}\hline a & b & c \\\hline d & e & f \\ g & h & i \\ \hline \end{array}$

is written using

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

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
$$\begin{array}{|c|cc|}\hlinea & b & c \\\hlined & e & f \\g & h & i \\\hline\end{array}$$

results in
$\begin{array}{|c|cc|}
\hline
a & b & c \\
\hline
d & e & f \\
g & h & i \\
\hline
\end{array}$

Nick
Resident Expert

Posts: 1954
Joined: 18 Jun 2006
Location: Oxford
Blog: View Blog (4)

### Re: Inserting Tables in Posts

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
$$\begin{array}{|c|cc|}\hlinea & b & c \\\hlined & e & f \\g & h & i \\\hline\end{array}$$

results in
$\begin{array}{|c|cc|}
\hline
a & b & c \\
\hline
d & e & f \\
g & h & i \\
\hline
\end{array}$

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.

BioWizard