Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to have a table in my latex. If use this code. I am loosing a part of my table. could you please tell me how can I fix this problem?

\documentclass[12pt,ngerman]{report}
\usepackage[a4paper]{geometry}
%\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
%\usepackage{ngerman}{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{float}
\selectlanguage{ngerman}
\begin{document}
Interval wertvolle Informationen extrahiert werden kann, betrachten wir die Spalte 6457, in der die Ereignisse anerkannt worden sind.
\begin{center}
\begin{table}[H]
    \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|}
    \hline
    Spalte & Ereignisse & Spalte & Ereignisse & Spalte & Ereignisse & Spalte & Ereignisse & Spalte & Ereignisse \\ \hline
    6480   & 0          & 6487   & 88         & 6494   & 26         & 6501   & 57         & 6508   & 87         \\ \hline
    6481   & 0          & 6488   & 288        & 6495   & 42         & 6502   & 89         & 6509   & 50         \\ \hline
    6482   & 0          & 6489   & 356        & 6496   & 80         & 6503   & 105        & 6510   & 72         \\ \hline
    6483   & 7          & 6490   & 92         & 6497   & 415        & 6504   & 124        & 6511   & 74         \\ \hline
    6484   & 48         & 6491   & 126        & 6498   & 343        & 6505   & 135        & 6512   & 29         \\ \hline
    6485   & 34         & 6492   & 97         & 6499   & 100        & 6506   & 30         & 6513   & 1          \\ \hline
    6486   & 45         & 6493   & 70         & 6500   & 176        & 6507   & 41         & 6514   & 0          \\ \hline
    \end{tabular}
\end{table}
\end{center}
\end{document}
share|improve this question
1  
You can type a table with more rows and less columns. –  Ignasi May 2 at 14:42
    
If I do that, then I cant have this table in one page –  Kaja May 2 at 14:44
    
You can rotate the table, or you can replace Spalte with S and Ereignisse with E, or you decrease font size, or or... Tell us what you want –  Trefex May 2 at 14:48
    
I mean first column from 6480 to 6491, second 6492 to 6503 and third 6504 to 6514 (one row is missing in last column). –  Ignasi May 2 at 14:49

3 Answers 3

up vote 2 down vote accepted

You can change the font size of your table, just add this line

\scriptsize

after the \begin{table}[H] line.

share|improve this answer
    
thanks, it works now :) –  Kaja May 2 at 14:47

My first suggestion would be to stop repeating columns, and just make a single tabular with two columns, and many more rows. If you’re having a problem because the table spans multiple pages, then you could consider looking at the longtable package.

If you want the tables on a single page, then here’s a suggestion: break it into multiple tables using minipage. The information is still quite compact and neatly laid out, but now it fits on a single page without being too small to read (which would be my concern with using \scriptsize).

Here's the code for my example:

\documentclass[12pt,ngerman]{report}

\usepackage[a4paper]{geometry}
\usepackage{float}
\usepackage{booktabs}

\begin{document}

Interval wertvolle Informationen extrahiert werden kann, betrachten wir die Spalte 6457, in der die Ereignisse anerkannt worden sind.

\newenvironment{mytabular}{
\begin{minipage}[t]{4cm}
  \centering
  \vspace{0pt}
  \begin{tabular}{ll}
    \toprule
    Spalte & Ereignisse \\ \midrule
}{\bottomrule
  \end{tabular}
\end{minipage}}

\begin{table}[H]
  \centering
  \begin{mytabular}
    6480   & 0   \\
    6481   & 0   \\
    6482   & 0   \\
    6483   & 7   \\
    6484   & 48  \\
    6485   & 34  \\
    6486   & 45  \\
    6487   & 88  \\
    6488   & 288 \\
    6489   & 356 \\
    6490   & 92  \\
    6491   & 126 \\
  \end{mytabular}
  \hspace{0.5cm}
  \begin{mytabular}

    6492   & 97  \\
    6493   & 70  \\
    6494   & 26  \\
    6495   & 42  \\
    6496   & 80  \\
    6497   & 415 \\
    6498   & 343 \\
    6499   & 100 \\
    6500   & 176 \\
    6501   & 57  \\
    6502   & 89  \\
    6503   & 105 \\
  \end{mytabular}
  \hspace{0.5cm}
  \begin{mytabular}
    6504   & 124 \\
    6505   & 135 \\
    6506   & 30  \\
    6507   & 41  \\
    6508   & 87  \\
    6509   & 50  \\
    6510   & 72  \\
    6511   & 74  \\
    6512   & 29  \\
    6513   & 1   \\
    6514   & 0   \\
  \end{mytabular}
\end{table}

\end{document}

and here's the result:

enter image description here

Some comments on other changes I made to the code:

  • You can put \centering inside a table environment to centre its contents, rather than wrapping it within another center environment. That is, write

    \begin{table}
      \centering
      \begin{tabular}
        % some tabular code
      \end{tabular}
    \end{table}
    
  • Use the booktabs package, which makes everything look nicer (imo). Feel free to revert, of course.

  • Created a mytabular environment, which contains the table headings and so on. If you need to change something later, you only need to do it once.

    If you’re bound to the idea of having seven rows per table, then this also makes it fairly easy to reshuffle rows as you want.

  • Within the minipage environment, the [t] option and \vspace{0pt} are to ensure that the header of the third table lines up with the first two.

share|improve this answer
    
very nice, thank you –  Kaja May 2 at 15:07

You can rotate the headers or use a smaller font size or have less columns, but more rows.

I'll show the first solution. It makes use of the numprint package to have right-aligned numbers in a centred column and of the rotating package. I also improved (at least to my opinion) the general look of the table with the booktabs package, suppressing vertical lines and using horizontal rules of different thickness.

\documentclass[12pt,ngerman]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier} 
\usepackage[a4paper, showframe]{geometry}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{float}
\selectlanguage{ngerman}

\usepackage{array, booktabs}
\usepackage{rotating}
\newcommand\myhead[1]{\multicolumn{1}{c}{\hskip-1em\rotatebox[origin =lt]{40}{\rlap{#1}}}}
\usepackage{numprint}

\begin{document}
Interval wertvolle Informationen extrahiert werden kann, betrachten wir die Spalte 6457, in der die Ereignisse anerkannt worden sind.

\begin{table}[H]
\setlength\tabcolsep{5pt}\centering%\footnotesize
\begin{tabular}{*{5}{cn{4}{1}}}\addlinespace[5ex]
\myhead{Spalte} &\myhead{ Ereignisse} & \myhead{Spalte} & \myhead{Ereignisse} & \myhead{Spalte} & \myhead{Ereignisse} & \myhead{Spalte} & \myhead{Ereignisse} & \myhead{Spalte} & \myhead{Ereignisse} \\[-0.5ex]
\toprule
6480 & 0 & 6487 & 88 & 6494 & 26 & 6501 & 57 & 6508 & 87 \\
\midrule
6481 & 0 & 6488 & 288 & 6495 & 42 & 6502 & 89 & 6509 & 50 \\
\midrule
6482 & 0 & 6489 & 356 & 6496 & 80 & 6503 & 105 & 6510 & 72 \\
\midrule
6483 & 7 & 6490 & 92 & 6497 & 415 & 6504 & 124 & 6511 & 74 \\
\midrule
6484 & 48 & 6491 & 126 & 6498 & 343 & 6505 & 135 & 6512 & 29 \\
\midrule
6485 & 34 & 6492 & 97 & 6499 & 100 & 6506 & 30 & 6513 & 1 \\
\midrule
6486 & 45 & 6493 & 70 & 6500 & 176 & 6507 & 41 & 6514 & 0 \\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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