LaTeX forum ⇒ Graphics, Figures & TablesProblem with equation in table

Information and discussion about graphics, figures & tables in LaTeX documents.
mexxwel
Posts: 1
Joined: Mon Nov 16, 2015 10:54 am

Problem with equation in table

Postby mexxwel » Mon Nov 16, 2015 10:58 am

Hey there!

I'd like to create a table with two parameters and the corresponding equation.
Somehow Latex gives me the error: '! Missing $ inserted.' and I don't know what that means...

  1. \begin{table}[H]
  2. \centering
  3. \caption{XXX}
  4. \label{tab:XXX}
  5. \begin{adjustbox}{max width=\textwidth}
  6. \begin{tabular}{c c}
  7. \hline\hline
  8. \vspace{0.25cm}
  9. Parameter & Mathematical Equation \\ \hline
  10. \vspace{0.25cm}
  11. Standard Deviation & \sigma=\sqrt{\frac{\sum(X-\mu)$^2$}{N}} \\
  12. \vspace{0.25cm}
  13. Variance & \sigma^2=\frac{\sum(X-\mu)$^2$}}{N} \\
  14. \\ \hline
  15. \end{tabular}
  16. \end{adjustbox}
  17. \end{table}


Thanks for your help!

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3854
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Nov 16, 2015 1:21 pm

Welcome,

you put only the superscript in mathmode, but the whole equation needs to be in mathmode. Below, an example that sets the second column in math mode as a whole.
  1. \documentclass{article}
  2. \usepackage{mathtools}
  3. \usepackage{booktabs}
  4. \usepackage{array}
  5. \setlength{\defaultaddspace}{.75em}
  6. \begin{document}
  7. \begin{tabular}{c >{$\displaystyle}c<{$}}
  8. \toprule
  9. Parameter & $Mathematical Equation$ \\
  10. \midrule
  11. Standard Deviation & \sigma=\sqrt{\frac{\sum(X-\mu)^2}{N}} \\\addlinespace
  12. Variance & \sigma^2=\frac{\sum(X-\mu)^2}{N} \\
  13. \bottomrule
  14. \end{tabular}
  15. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Baidu [Spider] and 7 guests