Graphics, Figures & Tablesfault in my tabular, but can't find it

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Bakou Mertens
Posts: 1
Joined: Tue Oct 28, 2014 6:03 pm

fault in my tabular, but can't find it

Post by Bakou Mertens »

Hey everyone,
I'm new to Latex, so I can't handle it well, so sorry if my question is silly.
I wrote code for a tabular, but it won't compile. They say there is a fault, but I can't find it. Could one of you help me please?
this is my code:

Code: Select all

\begin{tabular}{| c | c | c | c |}
\hline 
Referentiehoek & \alpha 1 & \alpha 2 & 2 \alpha & \alpha \\
\hline 
0° & 170°32' & 290°44' & 120°12' & 60°06' \\
\hline
5° naar rechts & 175°49' & 315°51' & 140°02' & 70°01' \\
\hline
10° rechts & 180°42' & 301°00' & 120°18' & 60°09' \\
\hline
5° links & 165°12' & 285°07' & 119°55' & 59°57' \\
\hline
10° links & 160°16' & 280°24' & 120°08' & 60°04' \\
\hline
AF & \pm 0,5' & \pm 0,5' & \pm 1' & \pm 0,5' \\
\hline
gemiddelde & / & / & / & 62°03' \\
\hline
AF gemiddelde & / & / & / & \pm 6° \\
\end{tabular}
It says there is a fault right in the beginning after my first horizontal line.
Can you find it?
Thanks
Bakou

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

fault in my tabular, but can't find it

Post by Johannes_B »

Hi and welcome, all the last columns use math mode, so i think package siunitx would be helpful in your case. Additionally, you specified four centered columns (using c), but you have actually five columns.

Code: Select all

\documentclass{article}
\usepackage[english]{babel}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{cSSSS}
	\toprule
	Referentiehoek & {$\alpha 1$} & {$\alpha 2$} & {$2 \alpha$} & {$\alpha$} \\
	\midrule
	0°             &\ang{170;32;}& \ang{290;44;} &\ang{120;12;} &\ang{60;06;} \\
	5° naar rechts &\ang{175;49;}& \ang{315;51;} &\ang{140;02;} &\ang{70;01;} \\
	10° rechts     &\ang{180;42;}& \ang{301;00;} &\ang{120;18;} &\ang{60;09;} \\
	5° links       &\ang{165;12;}& \ang{285;07;} &\ang{119;55;} &\ang{59;57;} \\
	10° links      &\ang{160;16;}& \ang{280;24;} &\ang{120;08;} &\ang{60;04;} \\
	gemiddelde     & /       & /       & /       & 62°03' \\
	AF gemiddelde  & /       & /       & /       & \ang{+-6} \\
	\bottomrule
\end{tabular}
\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.
Post Reply