3

What is wrong with this table? I think there is something wrong with $\si{\degree}$.

\documentclass[a4paper]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{siunitx}
\begin{document}
\begin{table}[h!!]
\small
\renewcommand{\arraystretch}{1.2}

\setlength\tabcolsep{3pt}
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}c c cS[table-format=3.1]c}

De  &V (km) &S ($\si{\degree}$)     &P (min)    &Per (dny)\\
\hline
A &                 840     &   98,7&   101,5&  0,07048\\
B &                 785     &   98,7&   101,4&  0,07041\\
C   &   775-790&    98,6&   100,4&  0,06972\\
D       &   612-640&    98,0&   97,1&   0,06743\\

\end{tabular*}
\end{table}
\end{document}

2 Answers2

5

You are making the last column of your table as a SI (S) column, so you must wrap non-number contents in that column inside braces. Btw h!! is nonsense.

\documentclass[a4paper]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{siunitx}
\begin{document}
\begin{table}[h!]
\small
\renewcommand{\arraystretch}{1.2}

\setlength\tabcolsep{3pt}
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}c c c S[table-format=3.1]c}
De  & V (km) & S (\si{\degree}) & P (min)    &{Per (dny)}\\
\hline
A & 840     & 98,7 & 101.5 & 0,07048\\
B & 785     & 98,7 & 101.4 & 0,07041\\
C & 775-790 & 98,6 & 100.4 & 0,06972\\
D & 612-640 & 98,0 & 97.1  & 0,06743
\end{tabular*}
\end{table}
\end{document}

However it will change the commas to dots in the last column. To avoid this, read this question.

It seems to me that you are trying to make the second last column to be a SI column, so you should place S[table-format=3.1] somewhere else. My final answer:

\documentclass[a4paper]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage[locale=FR]{siunitx}
\begin{document}
\begin{table}[h!]
\small
\renewcommand{\arraystretch}{1.2}
\setlength\tabcolsep{3pt}
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}c c S[table-format=3.1]c c}
De  & V (km) & S (\si{\degree}) & {P (min)}    & Per (dny)\\
\hline
A & 840     & 98,7 & 101,5 & 0,07048\\
B & 785     & 98,7 & 101,4 & 0,07041\\
C & 775-790 & 98,6 & 100,4 & 0,06972\\
D & 612-640 & 98,0 & 97,1  & 0,06743
\end{tabular*}
\end{table}
\end{document}

enter image description here

However, take care of the last column. I intentionally keep it, but you may want to reduce its size.

  • Thank you very much and what is wrong with using \Xhline{1.2pt} in the table? – Lukáš Altman Apr 20 '19 at 03:29
  • 1
    @LukášAltman Nothing wrong. I can use it as usual, but I don't recommend it though. Just remember loading makecell package –  Apr 20 '19 at 03:33
3

i would wrote your table narrower:

enter image description here

and for last three columns use S column type:

\documentclass[a4paper]{article}
\usepackage{amsthm, amssymb, mathtools}% mathtools load `amsmath
\usepackage[locale=FR]{siunitx}

\begin{document}
    \begin{table}[h!]
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{l c
                S[table-format=2.1]
                S[table-format=3.1]
                S[table-format=1.5]}
De  & V (km) & S {(\si{\degree})} & {P (min)}    & {Per (dny)}\\
    \hline
A & 840     & 98,7 & 101,5 & 0,07048\\
B & 785     & 98,7 & 101,4 & 0,07041\\
C & 775-790 & 98,6 & 100,4 & 0,06972\\
D & 612-640 & 98,0 & 97,1  & 0,06743
\end{tabular}
    \end{table}
\end{document}

note curly braces around column headers in S columns!

Zarko
  • 296,517