Need LaTeX commands for tables, I've looked up some but not working

  • LaTeX
  • Thread starter benorin
  • Start date
  • Tags
    latex
In summary, the conversation discusses a problem with a LaTeX table not displaying properly on an online platform. It is suggested that the issue may be caused by a newline in the code. The conversation also mentions a potential insight article about a trick for memorizing trigonometry special angle values.
  • #1
benorin
Homework Helper
Insights Author
1,443
191
I've looked up two different LaTeX references for Table commands and have been lead to believe that this might work but not only does it not appear as a table it doesn't even display greek letters or fractions just spits out commands. Help please?

Code:
|render=<math>
\begin{array}{ l| |c|c|c|c|c }

\theta & 0 & \tfrac{\pi}{6} & \tfrac{\pi}{4} & \tfrac{\pi}{3} & \tfrac{\pi}{2} \\ \sin\theta & 1  & 2  &  3 & 4  & 5   \\ \cos\theta & 6  & 7   & 8   & 9   & 10   \\ \tan\theta & 11   & 12   & 13   & 14  & 15   \\ \end{array} </math>
 
Physics news on Phys.org
  • #2
$$\begin{array}{ l| |c|c|c|c|c }

\theta & 0 & \tfrac{\pi}{6} & \tfrac{\pi}{4} & \tfrac{\pi}{3} & \tfrac{\pi}{2} \\ \sin\theta & 1 & 2 & 3 & 4 & 5 \\ \cos\theta & 6 & 7 & 8 & 9 & 10 \\ \tan\theta & 11 & 12 & 13 & 14 & 15 \\ \end{array}$$

Copied and pasted, only replacing the HTML <math> tags with two dollars, and it seems to work ok here. So your LaTeX is fine. I take it this is an Insight you are writing?
 
  • Like
Likes berkeman and vanhees71
  • #3
I thought it might be appropriate to make it an insight, was just a memory trick for the trig table. My students in Calc always loved it
 
  • Love
Likes Greg Bernhardt
  • #4
So I just tried creating a new Insight and pasting your code in, and sure enough it doesn't work. The problem seems to be the newline after the begin{array} line. The Insights editor treats a newline as a paragraph end and inserts a </p><p>, and that's breaking MathJax, I think. So simply putting the whole table code on to one line fixes it.
 
  • Like
Likes vanhees71, Greg Bernhardt and benorin
  • #5
@Ibix I submitted my article for review but don't see the Request for review post in insight and Blog Development sub forum, I submitted it twice, my bad

edit: it's called "A Trick to Memorizing Trig Special Angle Values Table"
 
  • Like
Likes vanhees71 and Greg Bernhardt
  • #6
Can't help with that, I'm afraid - I'm just a normal user, but was at a bit of a loose end today so played around with your code. See what @Greg Bernhardt says.
 
  • Like
Likes benorin and Greg Bernhardt

FAQ: Need LaTeX commands for tables, I've looked up some but not working

1. Why aren't the LaTeX commands for tables working for me?

It's possible that there could be a few reasons why the LaTeX commands for tables are not working for you. First, make sure that you are using the correct syntax and that you have all the necessary packages loaded. Additionally, check for any typos in your code. It's also possible that your LaTeX editor or compiler may have some compatibility issues. Try using a different editor or compiler to see if that solves the problem.

2. Can you provide me with a list of commonly used LaTeX commands for tables?

Some common LaTeX commands for tables include \begin{tabular}, \hline, \multicolumn, and \cline. However, there are many more commands that can be used depending on the specific formatting and layout of your table. It's always best to consult a comprehensive guide or tutorial for a complete list of LaTeX commands for tables.

3. How can I align my table columns in LaTeX?

To align your table columns in LaTeX, you can use the \begin{tabular}{c|c|c} command and specify the alignment for each column within the curly braces. For example, {l|c|r} would align the first column to the left, the second column to the center, and the third column to the right. You can also use the \centering command before the \begin{tabular} command to center your entire table.

4. I want to add a caption and label to my table in LaTeX. How can I do that?

To add a caption and label to your table in LaTeX, you can use the \caption{} and \label{} commands, respectively. Place these commands right after the \begin{table} command and before the \begin{tabular} command. This will automatically number your table and allow you to reference it in your document.

5. Are there any online tools or resources that can help me create and format tables in LaTeX?

Yes, there are many online tools and resources that can help you create and format tables in LaTeX. Some popular ones include Overleaf, ShareLaTeX, and LaTeX Tables Generator. These tools offer templates, tutorials, and real-time collaboration features to make creating tables in LaTeX easier. Additionally, there are many helpful guides and tutorials available online for creating and formatting tables in LaTeX.

Similar threads

Replies
36
Views
2K
Replies
7
Views
2K
Replies
3
Views
933
Replies
4
Views
3K
Replies
15
Views
25K
Replies
4
Views
4K
Replies
9
Views
3K
Back
Top