El comando entra en vigor antes que el entorno.

El comando entra en vigor antes que el entorno.

¿Es posible agregar un \vspace{-\baselineskip}interior, por ejemplo, longtable (u otro entorno} para que surta efecto antes de que comience el entorno? MWE que no tiene ningún efecto.

\documentclass{article}
\usepackage{longtable}
\usepackage{blindtext}

\begin{document}

\blindtext

\begin{longtable}{ll}
\vspace{-\baselineskip} \\ % this has no effect
                           % why \\ are really needed since caption has them?
\caption{testing table} \\
\hline
aaaa & bbbb \\
cccc & dddd \\
\hline
\end{longtable}

\end{document}

Hay un MWE con el problema de tener una referencia desordenada en el LOT.

\documentclass[captions=tableheading]{scrartcl}

\usepackage{blindtext}

\usepackage{hyperref}
\usepackage{tabu,longtable}
%\usepackage{threeparttable} % the package below already loads it
\usepackage[referable]{threeparttablex}
\usepackage{booktabs}
\usepackage{caption}


\usepackage{etoolbox}
\makeatletter
\chardef\TPT@@@asteriskcatcode=\catcode`*
\catcode`*=11
\expandafter\patchcmd\csname\string\threeparttable\endcsname
    {\TPT@hookin{tabular}}
    {\TPT@hookin{tabular}\TPT@hookin{tabu}} % allow threeparttable with tabu
    {}{}
\catcode`*=\TPT@@@asteriskcatcode
\makeatother

\makeatletter % fix referencing of LOT while using longtabu
    \newcounter{dummy}
    \newcommand{\setdummy}{\refstepcounter{dummy} \\}
    \let\oldlongtabu\longtabu\def\dummytabu{\vspace{-\baselineskip}\oldlongtabu} % correct the \\ in \setdummy
    \def\enddummytabu{\endlongtabu}
    \def\dummycap{\setdummy\caption}
\makeatother



\begin{document}

\listoftables

\bigskip

\blindtext

% LOT reference does not work
\begin{ThreePartTable}
\begin{TableNotes}
\footnotesize
\item[a] \label{tn:aa} A note
\item[b] Another note
\end{TableNotes}
\begin{longtabu}{ll}
\caption{A long table 1}
\label{tab:test1} \\
\toprule
Column 1 & Column 2 \\
\midrule
\endfirsthead
\toprule
Column 1 & Column 2 \\
\midrule
\endhead
\cmidrule{2-2}
\multicolumn{2}{r}{\textit{continued}}
\endfoot
\bottomrule
\insertTableNotes
\endlastfoot
% the contents of the table
A& B\tnotex{tn:aa} \\
\midrule
%\newpage % just testing page break
C\tnote{b} & D \\
\end{longtabu}
\end{ThreePartTable}

\blindtext

% LOT reference works fine
\begin{ThreePartTable}
\begin{TableNotes}
\footnotesize
\item[a] \label{tn:bb} A note
\item[b] Another note
\end{TableNotes}
\begin{longtable}{ll}
\caption{A long table 2}
\label{tab:test2} \\
\toprule
Column 1 & Column 2 \\
\midrule
\endfirsthead
\toprule
Column 1 & Column 2 \\
\midrule
\endhead
\cmidrule{2-2}
\multicolumn{2}{r}{\textit{continued}}
\endfoot
\bottomrule
\insertTableNotes
\endlastfoot
% the contents of the table
A& B\tnotex{tn:bb} \\
\midrule
%\newpage % just testing page break
C\tnote{b} & D \\
\end{longtable}
\end{ThreePartTable}

\blindtext

% LOT reference works fine (with vskip correction)
\begin{ThreePartTable}
\begin{TableNotes}
\footnotesize
\item[a] \label{tn:cc} A note
\item[b] Another note
\end{TableNotes}
\begin{dummytabu}{ll}
\dummycap{A long table 3}
\label{tab:test3} \\
\toprule
Column 1 & Column 2 \\
\midrule
\endfirsthead
\toprule
Column 1 & Column 2 \\
\midrule
\endhead
\cmidrule{2-2}
\multicolumn{2}{r}{\textit{continued}}
\endfoot
\bottomrule
\insertTableNotes
\endlastfoot
% the contents of the table
A& B\tnotex{tn:cc} \\
\midrule
%\newpage % just testing page break
C\tnote{b} & D \\
\end{dummytabu}
\end{ThreePartTable}

\blindtext

\end{document}

Respuesta1

Solo usa

\begin{ThreePartTable}
\begin{TableNotes}
\footnotesize
\item[a] \label{tn:aa} A note
\item[b] Another note
\end{TableNotes}
\begin{longtabu}{ll}
\noalign{\phantomsection}
\caption{A long table 1}
\label{tab:test1} \\
\toprule
...

Los enlaces parecen funcionar y no se agrega ningún espacio adicional.

Respuesta2

longtableinserta un vskip de la longitud \LTpre(predeterminado en \bigskipammount) antes de la tabla para cambiar el espacio vertical antes de que la tabla altere esta longitud con \setlengtho \addtolength. Usar \vspaceen la posición que muestra lo coloca en la primera celda de la primera fila, que es una lentrada, por lo que es un cuadro horizontal en el que un salto vertical no hace nada. Entonces el efecto es simplementeagregaruna línea en blanco antes de la tabla a pesar de especificar nominalmente un salto negativo.

información relacionada