I am currently struggling with the longtable package and horizontal lines that should visually separate rows. The thing is that I do not want to display bottom lines on the last row of each particular page and a top line on the first row of each succeeding page. My question would be if there is any variable or switch of the longtable code that i can use to determine (inside my rowend command) if this is true and then suppress the execution of hdashline? I know of the variable \LT@rows but what I have tried so far didn't give me any results.
MWE:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{longtable}
\usepackage{array}
\usepackage{arydshln}
\newcommand{\rowend}{%
\tabularnewline%
% Determine here if it is the last row of the current page or first row of next page
% If it is the last row of the current page, don't make a bottom dashed line.
% If it is the first row of a succeeding page, don't make a top row (although I have no idea why that line is actually drawn ...
\hdashline%
}
\begin{document}
\begin{longtable}{|l|r|c|p{2cm}|}
\caption{A simple longtable example}\\
\hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\
\hline
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\
\hline
\endhead
\hline \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend 1 & 2 & 3 & 4 \rowend
\end{longtable}
\end{document}
\label{some-generated-name-a}\\\myhline\label{some-generated-name-b}then definemyhlineto do an\hlineunless both the labels -a and -b are defined from the previous run and\pagerefshows they are on separate pages, in which case omit the hline. – David Carlisle Jan 04 '16 at 11:06