- #1
- 2,158
- 2,719
Without further ado, I'll directly put the MWE here:
Please compile with LuaLaTeX. You can find the
The reason there are two
The output looks like this, with the space I am referring to highlighted:
If I use
But using
Any idea how I can insert some space between the two tables without them going into the next page?
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:
If I use
\vfill
above the table environment, the entire table gets shifted down, as expected: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?