I use XeTeX Version 3.14159265-2.6-0.99992 (TeX Live 2015/W32TeX). I am typesetting a book with lots of sloppypar with longtables. I followed this thread to use \LTpre
and \LTpost
to reduce spacing before and after a longtable. I still face three issues:
1) Setting \LTpre
to 0pt results in less space before the longtable than the line spacing.
2) Setting \LTpost
to 0pt results in more space after the longtable than the line spacing.
3) Some longtables are needed to be typeset entirely in boldface. For this I enclose the entire longtable inside a \textbf{}. This adds some additional space before the table which would otherwise not be present without boldface
Here is an MWE
\documentclass[12pt]{book}
\usepackage{ragged2e}
\raggedbottom
\usepackage{polyglossia}
\usepackage{longtable}
\usepackage{lipsum}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}
\begin{document}
\begin{sloppypar}\hyphenrules{nohyphenation}\lipsum[2]\end{sloppypar}
{\centering
\begin{longtable}{ll} C11 & C12\\C21 & C22 \end{longtable}
}
\begin{sloppypar}\hyphenrules{nohyphenation}\lipsum[2]\end{sloppypar}
{\centering\textbf{
\begin{longtable}{ll} C11 & C12\\C21 & C22 \end{longtable}
}}
\end{document}
And the output
EDIT 1 on 2015-12-19 0450 IST
The solution by @daleif solves issue 3. But issues 1 and 2 are still there. For better clarity, I added a grid on the page with this code:
\documentclass[12pt]{book}
\usepackage{ragged2e}
\raggedbottom
\usepackage[top=0pt,left=0pt,bottom=0pt,right=0pt,width=396pt,height=612pt]{geometry}
\usepackage[step=18pt]{pagegrid}
\pagegridsetup{top-left}
\usepackage{polyglossia}
\usepackage{longtable}
\usepackage{lipsum}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}
\begin{document}
\fontsize{12}{18}\selectfont
\vspace*{6.5pt}
\begin{sloppypar}\hyphenrules{nohyphenation}
\lipsum[2]
\end{sloppypar}
\begin{longtable}{ll} C11 & C12\\C21 & C22 \end{longtable}
\begin{sloppypar}\hyphenrules{nohyphenation}
\lipsum[2]
\end{sloppypar}
{\bfseries
\begin{longtable}{ll} C11 & C12\\C21 & C22 \end{longtable}
}
\begin{sloppypar}\hyphenrules{nohyphenation}
\lipsum[2]
\end{sloppypar}
\end{document}
And here is the output. Note how the rows of the longtable are shifted up slightly, ie their baselines are not on the grid whose unit is same as the line spacing.
{\centering ... }
contruction, that has no effect onlongtable
anyway. Plus removing thesloppypar
then things look fine{\centering ... }