Troubleshooting Latex Tables in Threads

In summary, the conversation discusses the use of a table generator website to create latex code for a PF post. However, the code does not work when pasted between dollar delimiters. The conversation suggests using two hashes instead of dollars, but it is mentioned that Tabular is not implemented in Mathjax. The conversation then suggests using html or an array instead. The final code provided uses an array to align the text to the left.
  • #1
anorlunda
Staff Emeritus
Insights Author
11,308
8,732
I used a table generator site http://www.tablesgenerator.com/ to create this latex code, but it doesn't work in a thread when I paste it in between dollar dollar delimiters.

Help please.

$$
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{ll}
1 & TW base \\
1 & TW reserves \\
2 & TW total \\
3 & \$/watt utility \\
6 & \$/watt rooftop \\
6.5 & \$trillion storage \\
\$14 & \$trillion total
\end{tabular}
\end{table}
$$
 
Physics news on Phys.org
  • #2
Have you tried two hashes instead of two dollars?
 
  • #3
Here it is with hashes.

##
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{ll}
1 & TW base \\
1 & TW reserves \\
2 & TW total \\
3 & \$/watt utility \\
6 & \$/watt rooftop \\
6.5 & \$trillion storage \\
\$14 & \$trillion total
\end{tabular}
\end{table}
##
 
  • #4
apparently, Tabular is not implemented in Mathjax.
 
  • #5
DrDu said:
apparently, Tabular is not implemented in Mathjax.

Darn. Is there any way to get tables into a PF post?
 
  • #6
Maybe html?
 
  • #7
Use
Code:
\ begin{array}{ll}

\ end{array}

(With no space after \, I put it their because it becomes invisible when I write it the correct way!)
 
  • #8
Yes, thank you @Shyan That got me closer, now I'll try to get rid of centering the cells.

##
\begin{array}{7}
1 & TW base \\
1 & TW reserves \\
2 & TW total \\
3 & \$/watt utility \\
6 & \$/watt rooftop \\
6.5 & \$trillion storage \\
\$14 & \$trillion total
\end{array}
##
 
  • #9
\begin{array}{ll} 1 & TWbase \\ 1 & TWreserves \\ 2 & TWtotal \\ 3 & \$wattutility \\ 6 & \$wattrooftop \\ 6.5 & \$trillionstorage \\ 14 & \$trilliontotal \end{array}

Do you exactly write \ begin{array}{ll} ? The second l is supposed to align the text to the left!

P.S.
This may be helpful.
 
  • Like
Likes Greg Bernhardt
  • #10
Double thanks @Shyan. Got it.
 

1. How do I fix formatting issues in my LaTex table?

To fix formatting issues in a LaTex table, make sure to use the correct syntax and commands for creating the table. Also, check for any missing or extra alignment symbols (&) and make sure to properly close all brackets and curly braces. Utilizing packages such as booktabs and multirow can also help with formatting.

2. Why is my table not displaying as expected?

If your table is not displaying as expected, check for any missing or incorrect table environment declarations. Also, verify that you have included all necessary packages and that the table is within the correct section of your document. Additionally, double check for any typos in your code.

3. How do I add headers and footers to my table in LaTex?

To add headers and footers to your LaTex table, use the \hline command to create a horizontal line at the top and bottom of your table. Then, use the \multicolumn command to merge cells and add header or footer text. You can also use the fancyhdr package to customize your headers and footers.

4. How can I make my LaTex table fit on one page?

If your LaTex table is too wide to fit on one page, you can use the adjustbox package to resize the table. Alternatively, you can split the table into multiple smaller tables and use the \caption* command to add a single caption for all of them. Additionally, adjusting the margins of your document can also help to fit the table on one page.

5. How do I add colors to my LaTex table?

To add colors to your LaTex table, use the \usepackage{xcolor} command and then use the \cellcolor or \rowcolor commands to specify a color for a particular cell or row. You can also use the colortbl package to define custom colors for your table. Make sure to use the correct syntax and placement of these commands within your table code.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
354
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
279
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
Back
Top