I have the following problem.
Let's define three types of document elements: Titles, Paragraphs and Longtables. The problem is to setup vertical spaces between them independently.
For example, let's denote:
- Vertical space #1 between Titles and Paragraphs.
- Vertical space #2 between Titles and Longtables.
- Vertical space #3 between Paragraphs and Titles.
- Vertical space #4 between Paragraphs and Longtables.
- Vertical space #5 between Longtables and Titles.
- Vertical space #6 between Longtables and Paragraphs.
The general problem is to set: vspace #1 to V1 cm, vspace #2 to V2 cm, ... , vspace #6 to V6 cm. This should be done in preambula to minimize author's efforts in the document part.
Since this problem was too hard for me, I've tried to solve its particular case where V1 = V2 = ... = V6 = 1cm, i.e. all the vertical spaces #1-#6 are the same.
I've managed to find the following variables that affect these vspaces:
\captionsetup[longtable]{
belowskip=1cm % VARIABLE #1
}
\setlength{\LTpre}{1cm} % VARIABLE #2
\setlength{\LTpost}{1cm} % VARIABLE #3
\titlespacing*{\section}{0pt}{1cm}{1cm} % VARIABLES #4, #5
As I've found out, these variables affect:
- belowskip - vspaces 2, 4.
- LTpre - vspaces 2, 4.
- Ltpost - vspaces 5, 6.
- titlespacing-3 - vspaces 3, 5.
- titlespacing-4 - vspaces 1, 2.
You can easily make sure that it is impossible to chose a subset of these variables so that each vspace is covered one and only one time.
Do you have any ideas how to solve this problem (in general or at least in the particular case)?
Here is the code.
\documentclass{book}
\usepackage{titlesec}
\usepackage{longtable}
\usepackage{caption}
\usepackage{lipsum}
\captionsetup[longtable]{
belowskip=1cm % VARIABLE #1
}
\setlength{\LTpre}{1cm} % VARIABLE #2
\setlength{\LTpost}{1cm} % VARIABLE #3
\titlespacing*{\section}{0pt}{1cm}{1cm} % VARIABLES #4, #5
\begin{document}
\section {Title title title title title title}
% Vertical space #1: Title - Paragraph
\lipsum[2] % Paragraph
% Vertical space #3: Paragraph - Title
\section {Title title title title title title}
% Vertical space #2: Title - Longtable
\begin{longtable}{|c|}
\caption{Table Table Table Table Table Table}\\
\hline Something \\ \hline
\end{longtable}
% Vertical space #6: Longtable - Paragraph
\lipsum[2] % Paragraph
% Vertical space #4: Paragraph - Longtable
\begin{longtable}{|c|}
\caption{Table Table Table Table Table Table}\\
\hline Something \\ \hline
\end{longtable}
% Vertical space #5: Longtable - Title
\section {Title title title title title title}
\end{document}