2

enter image description hereso my problem is: when I add more rows in my table, then the whole table jumps down to other page and can't spread to other page. thank you for the help.

\eqref{Tabelle 3.1} definiert.
        \begin{table}[h]
        \caption{Mengen, Parameter und Entscheidungsvariablen des \\ Optimierungsmodells}\label{Tabelle 3.1}
            \begin{tabular}{ll}
                \toprule
                Notation & Beschreibung/Definition\\
                \toprule
                \multicolumn{2}{c}{Mengen}\\
                \midrule
                $A$ & die Menge der Kanten\\
                $V$ & die Menge aller Knoten\\
                $P$ & Menge der Abholungsknoten, $P:=\lbrace 1,...,n \rbrace$\\
                $D$ & Menge der Auslieferungsknoten, $D:=\lbrace n+1,...,n+m \rbrace$ \\
                $K$ & Menge der Fahrzeuge\\
                \multicolumn{2}{c}{Parameter}\\
                \midrule
                $n$   & die Anzahl der Abholungsknoten\\
                $m$   & die Anzahl der Auslieferungsknoten\\
                $q_i$ & Angebot/Nachfrage in Knote $i$; die Abholungsknoten haben positivem\\
                      & Wert, die Auslieferungsknoten haben negativem Wert;\\
                      & im Beginn des Depots $0$ und im Ende des Depots $n + m + 1$ sind die\\ 
                      & Angebote/Nachfrage gleich 0, $q_0 = q_{n+m+1} = 0$\\
                $z_i$ & die Reihenfolge-Nummer bei dem Besuch in einer Tour\\
                $c^k_{ij}$ & Die Distanz der Kante $(i, j)$ mit der Fahrzeuge $k$\\
                $C^k$ & die Kapazit\"at des Fahrzeugs $k$\\
                % $M$ & eine ausreichende gro\"se Zahl, $M = C^k$\\
                \multicolumn{2}{c}{Entscheidungsvariablen}\\
                \midrule
                $x^{k}_{i,j}$ & $= 1$ falls Kanten $(i, j)$ mit Fahrzeug k zur kostenminimaler\\
                    & Rundreis geh\"ort\\
                    & ($0$ sonst)\\
                $Q^k_j$ & die Beladung des Fahrzeugs $k$ beim Verlassen des Knoten $i$\\
                \bottomrule
            \end{tabular}
        \end{table}
4
  • Welcome to TeX.SE! Long table is intended that can be split over several pages, if it longer than one page. Of course, it had not to be enclosed in table float. What is your problem? Question is not very clear ... Please extend provided code fragment to complete small document beginning with \documentclass and ending with \end{document}
    – Zarko
    Nov 17, 2022 at 23:03
  • However, short test show me, that you have problem that table is wider than \textwidth consequently it protrude right text border. Is this a problem?
    – Zarko
    Nov 17, 2022 at 23:26
  • hi i formulated my problem once again. I want that my table stays in this page and it don't jump to other page althrough i add more row in my table.
    – Renxian
    Nov 18, 2022 at 11:29
  • Are you aware that table, which can be fit on one page, can have only limited number of lines (at normal font size about 35)? This limitation cannot be changed by use of longtable . Your question is still unclear. BTW, longtable only enable, that table can be break over several page.
    – Zarko
    Nov 18, 2022 at 13:25

3 Answers 3

0
  • Let me assume, that your code fragment show only part of your table and that real table has much more rows with "Notation" and "Beschreibung/Definition"
  • If above assumption is correct, tha transform table to long table has sense, if not you should care about table width only. -For your table I would rather use xltabular table where the second column id of X type, or rathertabularray table which provide longtblr table with simpler syntax for caption, column headers repetition etc.
  • An example of longtblr use is:
\documentclass{article}
\usepackage[ngerman]{babel}

\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs}

\begin{document}

\begin{longtblr}[
caption = {Mengen, Parameter und Entscheidungsvariablen des Optimierungsmodells},
  label = {Tabelle 3.1}
                ]{colspec={@{} Q[l, mode=math] X[j] @{}},
                 rowhead=1
                 }
    \toprule
Notation    & Beschreibung/Definition       \\
    \midrule
\SetCell[c=2]{c, mode=text}    Mengen              
            &                               \\
    \midrule
A   & die Menge der Kanten                  \\
V   & die Menge aller Knoten                \\
P   & Menge der Abholungsknoten, $P:=\lbrace 1,...,n \rbrace$           \\
D   & Menge der Auslieferungsknoten, $D:=\lbrace n+1,...,n+m \rbrace$   \\
K   & Menge der Fahrzeuge                   \\
    \midrule[dashed]
\SetCell[c=2]{c, mode=text}    Parameter          
            &                               \\
    \midrule
n   & die Anzahl der Abholungsknoten        \\
m   & die Anzahl der Auslieferungsknoten    \\
q_i & Angebot/Nachfrage in Knote i; die Abholungsknoten haben positivem
      Wert, die Auslieferungsknoten haben negativem Wert; 
      im Beginn des Depots 0 und im Ende des Depots $n + m + 1$ sind die 
      Angebote/Nachfrage gleich 0, $q_0 = q_{n+m+1} = 0$    \\
z_i & die Reihenfolge-Nummer bei dem Besuch in einer Tour $c^k_{ij}$ 
      Die Distanz der Kante $(i, j)$ mit der Fahrzeuge $k$  \\
C^k & die Kapazit\"at des Fahrzeugs $k$     \\
% M & eine ausreichende gro\"se Zahl, M = C^k\\
    \midrule[dashed]
\SetCell[c=2]{c, mode=text}    Entscheidungsvariablen           
    &                                       \\
    \midrule
x^{k}_{i,j} 
    & $= 1$ falls Kanten $(i, j)$ mit Fahrzeug k zur kostenminimaler 
      Rundreis geh\"ort (0 sonst)           \\
Q^k_j & die Beladung des Fahrzeugs k beim Verlassen des Knoten $i$    \\
    \midrule[dashed]
\SetCell[c=2]{c, mode=text}    Dummy filler that table is longer than one page
    &                                       \\
    \midrule
x   &   \lipsum[66] \\
y   &   \lipsum[66] \\
z   &   \lipsum[66] \\
    \bottomrule
\end{longtblr}
 
\end{document}

enter image description here

(red lines indicate page layout)

Addendum:

  • From your comment follows that table can be maximum one page long regardless if you add more rows to it.
  • I hope, that you are aware, that table on one page can have a limited number of rows/text lines - number depends on used font size in table (about 35 at 10pt font size).
  • For one page long table can be used above proposed solution too, but you can change table's code as follows:
\documentclass{article}
\usepackage[ngerman]{babel}

\usepackage[skip=0.33\baselineskip,
            hang]{caption}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs}

\begin{document}
    \begin{table}[ht]
\caption{Mengen, Parameter und Entscheidungsvariablen des Optimierungsmodells},
\label{Tabelle 3.1}

\begin{tblr}{colspec={@{} Q[l, mode=math] X[j] @{}},
             row{1} = {mode=text}}
    \toprule
Notation    & Beschreibung/Definition       \\
    \midrule
\SetCell[c=2]{c, mode=text}    Mengen
            &                               \\
    \midrule
A   & die Menge der Kanten                  \\
V   & die Menge aller Knoten                \\
P   & Menge der Abholungsknoten, $P:=\lbrace 1,...,n \rbrace$           \\
D   & Menge der Auslieferungsknoten, $D:=\lbrace n+1,...,n+m \rbrace$   \\
K   & Menge der Fahrzeuge                   \\
    \midrule[dashed]
\SetCell[c=2]{c, mode=text}    Parameter
            &                               \\
    \midrule
n   & die Anzahl der Abholungsknoten        \\
m   & die Anzahl der Auslieferungsknoten    \\
q_i & Angebot/Nachfrage in Knote i; die Abholungsknoten haben positivem
      Wert, die Auslieferungsknoten haben negativem Wert;
      im Beginn des Depots 0 und im Ende des Depots $n + m + 1$ sind die
      Angebote/Nachfrage gleich 0, $q_0 = q_{n+m+1} = 0$    \\
z_i & die Reihenfolge-Nummer bei dem Besuch in einer Tour $c^k_{ij}$
      Die Distanz der Kante $(i, j)$ mit der Fahrzeuge $k$  \\
C^k & die Kapazit\"at des Fahrzeugs $k$     \\
% M & eine ausreichende gro\"se Zahl, M = C^k\\
    \midrule[dashed]
\SetCell[c=2]{c, mode=text}    Entscheidungsvariablen
    &                                       \\
    \midrule
x^{k}_{i,j}
    & $= 1$ falls Kanten $(i, j)$ mit Fahrzeug k zur kostenminimaler
      Rundreis geh\"ort (0 sonst)           \\
Q^k_j & die Beladung des Fahrzeugs k beim Verlassen des Knoten $i$    \\
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

enter image description here

As you can estimate from both results, to this table you can add maximum about 15 rows/text lines. After that, if you still add more text lines, table will protrude out of bottom of the text area or even bottom of page.

4
  • hi i formulated my problem once again. I want that my table stays in this page and it don't jump to other page althrough i add more row in my table.
    – Renxian
    Nov 18, 2022 at 11:32
  • @Renxian, are you aware that table, which can be fit on one page, can have a limited number of lines (at normal font size about 35)? This limitation cannot be changed by use of longtable. BTW, my proposed solution also work for one page long table too (to see this, remove table section "Dummy filler that table is longer than one page"; after that table will occupy about 3/5 of page) . Your question as is, is unclear even misleading, what you are after. Please edit it and clarify, what is your problem.
    – Zarko
    Nov 18, 2022 at 13:17
  • thank you very much for your help. what your solution is exactly what I mean
    – Renxian
    Nov 18, 2022 at 21:35
  • @Renxian, than you may consider to accept answer :-) . This is done by clicking on the check mart at top left side of answer.
    – Zarko
    Nov 18, 2022 at 21:41
3

change

  \begin{table}[h]
        \caption{Mengen, Parameter und Entscheidungsvariablen des \\ Optimierungsmodells}\label{Tabelle 3.1}
            \begin{tabular}{ll}

to

  \begin{longtable}{ll}
        \caption{Mengen, Parameter und Entscheidungsvariablen des  Optimierungsmodells}\label{Tabelle 3.1}\\

and

           \end{tabular}
        \end{table}

to

        \end{longtable}
1

I think that what you need is not a longtable environment but, instead, a table/tabularx combination. Then, be sure to change the column type of the second column from l to X and to let automatic linebreaking occur in the second column.

enter image description here

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{booktabs,tabularx,ragged2e}

\begin{document}

\begin{table}[ht]
\caption{Mengen, Parameter und Entscheidungsvariablen des  Optimierungsmodells \strut}\label{Tabelle 3.1}
\begin{tabularx}{\textwidth}{@{} l >{\RaggedRight}X @{}}
    \toprule
    Notation & Beschreibung/Definition\\
    \midrule[\heavyrulewidth]
    
    \addlinespace
    \multicolumn{2}{@{}l}{Mengen}\\
    \midrule
    $A$ & Menge der Kanten\\
    $V$ & Menge aller Knoten\\
    $P$ & Menge der Abholungsknoten, $P:=\lbrace 1,\dots,n \rbrace$\\
    $D$ & Menge der Auslieferungsknoten, $D:=\lbrace n+1,\dots,n+m \rbrace$ \\
    $K$ & Menge der Fahrzeuge\\
    
    \addlinespace
    \multicolumn{2}{@{}l}{Parameter}\\
    \midrule
    $n$   & Anzahl der Abholungsknoten\\
    $m$   & Anzahl der Auslieferungsknoten\\
    $q_i$ & Angebot/Nachfrage in Knote $i$; die Abholungsknoten haben positivem Wert, die Auslieferungsknoten haben negativem Wert; im Beginn des Depots $0$ und im Ende des Depots $n + m + 1$ sind die Angebote\slash Nachfrage gleich 0, $q_0 = q_{n+m+1} = 0$\\
    $z_i$ & Reihenfolge-Nummer bei dem Besuch in einer Tour\\[0.25ex]
    $c^k_{ij}$ & Distanz der Kante $(i, j)$ zum Fahrzeug $k$\\[0.25ex]
    $C^k$ & Kapazit\"at des Fahrzeugs $k$\\
    % $M$ & eine ausreichende gro\"se Zahl, $M = C^k$\\
    
    \addlinespace
    \multicolumn{2}{@{}l}{Entscheidungsvariablen}\\
    \midrule
    $x^{k}_{i,j}$ & $= 1$ falls Kanten $(i, j)$ mit Fahrzeug $k$ zur kostenminimaler Rundreis geh\"ort  ($0$ sonst)\\
    $Q^k_j$ & Beladung des Fahrzeugs $k$ beim Verlassen des Knoten $i$\\
    \bottomrule
\end{tabularx}
\end{table}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .