How do I make use of this space after the table?

  • #1
Wrichik Basu
Science Advisor
Insights Author
Gold Member
2,158
2,719
Without further ado, I'll directly put the MWE here:
LaTeX code:
\documentclass[a4paper, 11pt, draft]{article}

\usepackage{fontspec}
\usepackage{mathsettings}
\usepackage{geometry}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{layout}
\usepackage{makecell}
\usepackage[none]{hyphenat}
\usepackage{longtable}
\usepackage{pifont}
\usepackage{graphicx}
\usepackage{nicematrix}
\usepackage{xcolor}
\usepackage{makecell}
\usepackage{tablefootnote}
\usepackage{lipsum}

\definecolor{yellowbg}{HTML}{ffd966}
\definecolor{greybg}{HTML}{cccccc}

\setlength{\parindent}{0pt}
\newgeometry{top=2cm,
    bottom=2.5cm,
    left=2.5cm,
    right=2.5cm
}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\arraystretch}{1.5}

\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{20pt}
\fancyhead[C]{\includegraphics[scale=0.2]{Logo}}
\fancyfoot[L]{XYZ 2024}
\fancyfoot[R]{\footnotesize Page~\thepage~of~\pageref*{LastPage}}

\begin{document}

    \newgeometry{top=2cm, bottom=1.5cm, left=1.5cm, right=1.5cm}
    \setlength{\headheight}{10pt}
   
    \subsection{Analysis}
       
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
       
        \begin{table}[h]
%          
            \scriptsize\centering
%          
            \caption{\label{table:sensitivity_reduce}Analysis considering a decrease by 7\%.}
            \vspace*{0.5em}
%          
            \begin{NiceTabular}[corners, hvlines, first-row, code-for-first-row=\bfseries]{lrrrrr}
%              
                & Year 1 & Year 2 & Year 3 & Year 4 & Year 5 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%          
            \end{NiceTabular}
%
            \caption{\label{table:sensitivity_increase}Analysis considering an increase by 7\%.}
            \vspace*{0.5em}
%          
            \begin{NiceTabular}[corners, hvlines, first-row, code-for-first-row=\bfseries]{lrrrrr}
%                  
                & Year 1 & Year 2 & Year 3 & Year 4 & Year 5 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxxxxx xxxxxxx (\textwon) & 111,111,111 & 222,222,222 & 333,333,333 & 444,444,444 & 555,555,555 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
                Xxxxx xxxxxx (\%) & 11.11 & 22.22 & 33.33 & 44.44 & 55.55 \\
%              
            \end{NiceTabular}
%          
    \end{table}

\end{document}

Please compile with LuaLaTeX. You can find the mathsettings package here. (If using Overleaf, you can ask Overleaf to directly pull from GitHub.) For the image, please see the third attached image.

The reason there are two NiceTabular environments inside one table environment is that I want to fit both the tables in this page. If I separate them, one table is always going to the second page.

The output looks like this, with the space I am referring to highlighted:

1727121641956.png

If I use \vfill above the table environment, the entire table gets shifted down, as expected:

1727121746099.png

But using \vspace{} or \vspace*{} anywhere between the two NiceTabular environments results in the entire thing going to the next page, even if the space is tiny, like 7pt. The existing space looks far greater than 7pt, though.

Any idea how I can insert some space between the two tables without them going into the next page?
 

Attachments

  • Logo1.png
    Logo1.png
    4.1 KB · Views: 9
Physics news on Phys.org
  • #2
I am not set up to try out this idea - but can you include a \baselineskip to the "Table" lines?
 
  • #3
.Scott said:
I am not set up to try out this idea - but can you include a \baselineskip to the "Table" lines?
Sorry for the late response. Did you mean at the end of every line in the table, after the //? Or the table environment? If the latter, how should I add it?
 
  • #4
I was suggesting adding it in two places: lines 53 and 96. in both cases, just before the \label.
I offer no guarantees. I have worked with rtf files, but not specifically what you are doing. Nor have I tried anything out.
Also, this will take 1 parameter. So, for example, you might try \baselineskip=40pt.
 

Similar threads

Replies
4
Views
2K
Back
Top