1

So I have made a table in LaTeX, containing certain values of an angle theta and a radius r. Of course, somewhere I'm missing a $. I have used the table generator from the website http://www.tablesgenerator.com/; this is the code

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{llllllllllllll}
\theta & 0 & $\frac{\pi}{9}$ & $\frac{\pi}{6}$      & $\frac{2\pi}{9}$     & $\frac{\pi}{3}$ & $\frac{4\pi}{9}$     & $\frac{\pi}{2}$      & $\frac{5\pi}{9}$ & $\frac{2\pi}{3}$ & $\frac{7\pi}{9}$ & $\frac{5\pi}{6}$                           & $\frac{8\pi}{9}$                           & $\pi$ \\ \cline{13-13}
r      & 0 & $\frac{1}{2}$   & $\frac{\sqrt{2}}{2}$ & $\frac{\sqrt{3}}{2}$ & 1               & $\frac\{sqrt{3}}{2}$ & $\frac{\sqrt{2}}{2}$ & $\frac{1}{2}$    & 0                & $\frac{-1}{2}$   & \multicolumn{1}{l|}{$-\frac{\sqrt{2}}{2}$} & \multicolumn{1}{l|}{$\frac{-\sqrt{3}}{2}$} & -1    \\ \cline{13-13}
\end{tabular}
\end{table}

I've looked at it for hours and think I'm starting to go crazy.
Anyone wanna be crazy with me and spot what's missing?

4
  • 2
    \theta should be $\theta$ ... (first table cell). welcome to tex.se – Zarko Aug 3 '17 at 14:50
  • 1
    $\frac\{sqrt{3}}{2}$ is wrong! – TeXnician Aug 3 '17 at 14:50
  • 1
    \theta is allowed only in math mode – koleygr Aug 3 '17 at 14:50
  • wow, thanks guys, helped me out tremendously, I've been staring at the screen too long. Cheers! – Paul Heinemans Aug 3 '17 at 15:02
3

Three suggestions:

  • Use an array environment instead of a tabular environment. array environments are designed to contain primarily math-mode material. Making the switch will allow you do get rid of 42 [!] $ signs, significantly de-cluttering the code.

  • Use an \fbox instruction to encase the second-to-last entry in the second row in rectangular gridlines. Don't use two \cline directives and two \multicolumn{1}{}{} "wrappers".

  • \frac\{sqrt{3}}{2} must throw a syntax error. Presumably, it should be \frac{\sqrt{3}}{2}.

enter image description here

\documentclass{article}
\begin{document}
\begin{table}
\setlength\fboxsep{1pt} % default value: 3pt
\centering
\caption{My caption}
\label{my-label}
$\begin{array}{@{}*{14}{c}@{}}
\theta & 0 & \frac{\pi}{9} & \frac{\pi}{6} & \frac{2\pi}{9} 
& \frac{\pi}{3} & \frac{4\pi}{9} & \frac{\pi}{2} & \frac{5\pi}{9} 
& \frac{2\pi}{3} & \frac{7\pi}{9} & \frac{5\pi}{6} & \frac{8\pi}{9} 
& \pi \\[1ex] 
r & 0 & \frac{1}{2} & \frac{\sqrt{2}}{2} & \frac{\sqrt{3}}{2} & 1 
& \frac{\sqrt{3}}{2} & \frac{\sqrt{2}}{2} & \frac{1}{2} & 0 & \frac{-1}{2} 
& \frac{-\sqrt{2}}{2} & \fbox{$\frac{-\sqrt{3}}{2}$} & -1 \\ 
\end{array}$
\end{table}
\end{document}
1
  • If you happen to load the amsmath package, you could replace \fbox{$\frac{-\sqrt{3}}{2}$} with \boxed{\tfrac{-\sqrt{3}}{2}}. – Mico Aug 6 '17 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.