I have a big Table with long equations and references in some of the entries which overflow the margin. I want to decrease the column width in the table and fit the table better on the page. I decrease font size to decrease complications but it is not sustainable.
Pseudocode
- Normal size font.
- Have more vertical space in the table.
- Decrease the column width.
- More rows per cell entry.
- Extra spacing.
Fig. 1 .tex file, Fig. 2 The big table with long equations looks where I would like the table to take more vertical space and fit the page better, Fig. 3 Output of Masi's first code and my edit for long equations, Fig. 4 Output of Zarko's first code and my edit for long equations.
MWE1 with easier-to-manage cases
\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\hspace*{-2cm}
\begin{tabular}{| l | l | l | l | l |}
\hline
CountVars & Description & Basis & Count of elements & Count of Monomials \\
\hline
1 & system 1 & 0 & 0 & 0 \\
2 & system 2 & 0 & 0 & 0 \\
2 & system 3 & 1 & 1 & 2 \\
3 & series system with 3 vertices & 1+3 & 1 & 6 \\
5 & See Figure 15. & medium size equation & 0 & 0 \\
7 & See Figure 28. & $long equation+ long long- long long long long- long* long long= long equation$ & 9 & 20 \\
36 & PP & $very long =equation 1+2 stereo aloe nag rouen haosteu +saohu natoehs untaose thaoetu saothe staehosun haotnh saonthe + snatohu snthaosun thaosnth oanteuh+ snoathu sntoahe - snthoasen thoastn hosatnh soah sntohaent hoasnu hsonatheu * toha snahous$ & 899 & 2222 \\
\hline
\end{tabular}
\end{sidewaystable}
\end{document}
MWE2 by Masi
\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\begin{document}
\begin{sidewaystable}
\centering
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\hspace*{-2cm}
% http://tex.stackexchange.com/a/31681/13173
\bgroup
\def\arraystretch{1.5}% 1 is the default, change whatever you need
\begin{tabular}{| l | p{3cm} | p{3cm} | p{3cm} | p{3cm} |}
\hline
CountVars & Description & Basis & Count of elements & Count of Monomials \\ \hline
1 & system 1 & 0 & 0 & 0 \\ \hline
2 & system 2 & 0 & 0 & 0 \\ \hline
2 & system 3 & 1 & 1 & 2 \\ \hline
3 & series system with 3 vertices & 1+3 & 1 & 6 \\ \hline
5 & See Figure 15. & medium size equation & 0 & 0 \\ \hline
7 & See Figure 28. & $long equation = long long +long long- long long *long long *long+long$ & 9 & 20 \\ \hline
36 & PP & $very long equation = stereo- aloe+nag - rouen *haosteu saohu natoehs -untaose thaoetu +saothe staehosun haotnh saonthe snatohu +snthaosun thaosnth oanteuh snoathu sntoahe +snthoasen thoastn hosatnh soah sntohaent hoasnu hsonatheu -toha snahous$ & 899 & 2222 \\ \hline
\end{tabular}
\egroup
\end{sidewaystable}
\end{document}
where the equations entries do not get nicely presented in the columns but go over other columns, how to fix this by making the equations to continue on the next line?
MWE3 with Zarko
\documentclass[english]{article}
\usepackage{amsmath, amsfonts,rotating}
\usepackage{makecell,tabularx}
\usepackage[showframe]{geometry}
\begin{document}
\begin{sidewaystable}
\centering
\renewcommand\arraystretch{1.2}
\setlength\tabcolsep{3pt}% 1 is the default, change whatever you need
\caption{Ideals computed with basis and lexicographic}
\label{GroebnerRHR}
\begin{tabularx}{\textwidth}{| r |p{8em} | X | l | l |}
\hline
\thead[b]{Count\\Vars}
& \thead[b]{Description}
& \thead[b]{Basis}
& \thead[b]{Count of\\ elements}
& \thead[b]{Count of\\ Monomials} \\ \hline
1 & system 1
& 0 & 0 & 0 \\ \hline
2 & system 2
& 0 & 0 & 0 \\ \hline
2 & system 3
& 1 & 1 & 2 \\ \hline
3 & series system with 3 vertices
& 1+3 & 1 & 6 \\ \hline
5 & See Figure 15.
& medium size equation
& 0 & 0 \\ \hline
7 & See Figure 28.
& $long equation = if *it is longer +than is column width - then it hed to be set * as multi line equation + with help of `asmmath` or `mathtool` math environments$
& 9 & 20 \\ \hline
36 & PP
& $very long equation = stereo +aloe nag rouen haosteu - saohu natoehs untaose thaoetu +saothe staehosun haotnh saonthe snatohu - snthaosun thaosnth -oanteuh snoathu sntoahe snthoasen thoastn hosatnh soah sntohaent +hoasnu hsonatheu toha snahous$
& 899 & 2222 \\ \hline
\end{tabularx}
\end{sidewaystable}
\end{document}
Best Answer
Fig. 1 Output without long equations, Fig. 2 Output with long equations
Codes
Code 1 without long equations
Code 2 with long equations and with Andrew's fix here about the environment
Optional remarks
\hspace*{-2cm}
because negative spacing may not be needed anymore, at least, I think the third column looks funny in Fig. 1. See here about general\hspace
spacing