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
    No, the problem is not there – user156344 Apr 20 '19 at 2:53
  • 1
    The problem is Per (dny), if you replace it by \multicolumn{1}{r}{Per (dny)} there is no error. The reason is that you cannot use such stuff in an S column. – user121799 Apr 20 '19 at 2:57
  • 2
    @marmot We only need {Per (dny)}. – user156344 Apr 20 '19 at 2:57
  • 1
    @JouleV Yes, that's simpler. – user121799 Apr 20 '19 at 2:59
  • @marmot It reminded me of this answer :)) – user156344 Apr 20 '19 at 3:08
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.

| improve this answer | |
  • Thank you very much and what is wrong with using \Xhline{1.2pt} in the table? – Lukáš Altman Apr 20 '19 at 3:29
  • 1
    @LukášAltman Nothing wrong. I can use it as usual, but I don't recommend it though. Just remember loading makecell package – user156344 Apr 20 '19 at 3: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!

| improve this answer | |

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.