2

How to set \hline to be appropriate for the table?

\documentclass[12pt,a3paper]{report}
\usepackage{booktabs, makecell,amsmath, graphicx}
\usepackage[output-decimal-marker={,}]{siunitx}
\NewDocumentCommand{\anote}{}{\makebox[0pt][l]{$^*$}}
\usepackage[margin=0.25in]{geometry}
\usepackage{pdflscape}
\usepackage{lscape}

\begin{document}
\begin{landscape}
\begin{table}[h!!]
\tiny
\renewcommand{\arraystretch}{1.45}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}  
  r|ccccccccccccccccccccc
}
Fit&&   1&  2&  3&  4&  5&  6&  7&  8&  9&  10& 11& 12& 13& 14& 15& 16& 17&\\
\hline
A&  54867,608227&   54867,600478&   54867,597004&   54867,598053&   54867,598004&   54867,597391&   54867,597323&   54867,595745&   54867,59403&    54867,595847&   54867,594425&   54867,595113&   54867,59502&    54868,48386&    54867,591154&   54867,591663&   54867,592885&   \\

\end{tabular*}
\end{table} 

\end{landscape}
\end{document}  

enter image description here

  • 2
    Why do you make your table so wide and the font size too small? It is very hard to read the numbers. – user156344 Mar 24 at 7:15
  • I have lots of number and I pretend reading on the computer with zoom. I make it bigger after maybe, but I am confused about hline now. – Lukáš Altman Mar 24 at 7:20
  • I should remove the \extracolsep and increase the font size. – user156344 Mar 24 at 7:21
  • How please? This doesn't work \begin{tabular*}{\textwidth}{ r|ccccccccccccccccccccc } – Lukáš Altman Mar 24 at 7:28
  • 1
    @koleygr it does understand it, but (as documented) it maintains it meaning the original portrait width so that page head and foot (which the package keeps in portrait orientation) work correctly. – David Carlisle Mar 24 at 9:43
1

This?

\documentclass[12pt,a3paper]{report}
\usepackage{booktabs, makecell,amsmath, graphicx}
\usepackage[margin=.25in]{geometry}
\usepackage{pdflscape}
\usepackage{lscape}
\begin{document}
\begin{landscape}
\begin{table}[h!!]
\tiny
\renewcommand{\arraystretch}{1.45}
\begin{tabular*}{\linewidth}{r|ccccccccccccccccccccc}
Fit&&   1&  2&  3&  4&  5&  6&  7&  8&  9&  10& 11& 12& 13& 14& 15& 16& 17&\\
\hline
A&  54867,608227&   54867,600478&   54867,597004&   54867,598053&   54867,598004&   54867,597391&   54867,597323&   54867,595745&   54867,59403&    54867,595847&   54867,594425&   54867,595113&   54867,59502&    54868,48386&    54867,591154&   54867,591663&   54867,592885&   \\

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

which goes to the right margin

enter image description here

or this?

\documentclass[12pt,a3paper]{report}
\usepackage{booktabs, makecell,amsmath, graphicx}
\usepackage[margin=.25in]{geometry}
\usepackage{pdflscape}
\usepackage{lscape}
\begin{document}
\begin{landscape}
\begin{table}[h!!]
\tiny
\renewcommand{\arraystretch}{1.45}
\begin{tabular}{r|ccccccccccccccccccccc}
Fit&&   1&  2&  3&  4&  5&  6&  7&  8&  9&  10& 11& 12& 13& 14& 15& 16& 17&\\
\hline
A&  54867,608227&   54867,600478&   54867,597004&   54867,598053&   54867,598004&   54867,597391&   54867,597323&   54867,595745&   54867,59403&    54867,595847&   54867,594425&   54867,595113&   54867,59502&    54868,48386&    54867,591154&   54867,591663&   54867,592885&   \\

\end{tabular}
\end{table} 
\end{landscape}
\end{document} 

which is better I think

enter image description here

  • It's poor form to use \begin{tabular*}{\linewidth}{...} but not set @{\extracolsep{\fill}} as well. – Mico Mar 24 at 8:29
  • 2
    using tabular* without \extracolsep is like using tabularx without X you are specifying a target width but giving TeX no way to achieve it. If you just have rcccc columns you should use tabular not tabular* – David Carlisle Mar 24 at 9:38
  • also why suggest [h!!] using two ! does nothing, and using h on its own is usually an error and latex warns about it and changes it to ht but htp is better still. but in this case the optional argument does nothing at all, as landscape does a \clearpage so you get p positioning even though you have used the option to prevent p – David Carlisle Mar 24 at 9:42
4

It's not good practice to employ a tabular* environment, set its width to \textwidth (or some other specific length), but then not let LaTeX adjust the amount of intercolumn whitespace via an @{\extracolsep{\fill}} directive, at the start of the second argument of the tabular* environment, in order to achieve the desired overall width.

There is no need to shrink the font size all the way to \tiny -- \footnotesize will do just fine. The difference, in terms of legibility, of shrinking something 20% linearly (aka footnotesize) or 50% linearly (aka tiny) is enormous.

enter image description here

\documentclass[12pt]{report}
\usepackage{rotating} % for "sidewaystable" environment
\usepackage[margin=0.25in,a3paper]{geometry}
\begin{document}

\begin{sidewaystable}
\setlength\tabcolsep{0pt}
\footnotesize % no need for "\tiny"
\renewcommand{\arraystretch}{1.45}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r *{17}{c}}
Fit& 0&  1&  2&  3&  4& 5&  6&  7&  8&  9& 10& 11& 12& 13& 14& 15& 16\\
\hline
A&  
54867,608227&   54867,600478&   54867,597004&   54867,598053&   54867,598004&   
54867,597391&   54867,597323&   54867,595745&   54867,59403 &   54867,595847&   
54867,594425&   54867,595113&   54867,59502 &   54868,48386 &   54867,591154&   
54867,591663&   54867,592885 \\
\end{tabular*}
\end{sidewaystable} 
\end{document}  
  • 2
    +1 "not good practice" could perhaps be better phrased as "it's utterly completely wrong" :-) – David Carlisle Mar 24 at 9:39
  • @DavidCarlisle - :-) :-) :-) :-) – Mico Mar 24 at 10:29

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.