Created
November 7, 2016 07:04
-
-
Save metzenseifner/4585fa73435ca506e308e5e4056bf328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{fontspec} | |
\usepackage{longtable} | |
\usepackage{array} | |
\usepackage{booktabs} | |
\usepackage{xparse} | |
\usepackage{fontawesome} | |
\usepackage{lipsum} | |
% | |
\makeatletter | |
\def\myfillcols{\LT@cols} | |
\makeatother | |
% | |
\newcolumntype{:}{>{\global\let\currentrowstyle\relax}} | |
\newcolumntype{-}{>{\currentrowstyle}}% optionally \raggedright\arraybackslash after \currentrowstyle | |
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}% | |
#1\ignorespaces | |
} | |
\NewDocumentEnvironment{mytab}{ m } | |
{\begin{longtable}{:#1}} | |
{\end{longtable}} | |
%\newcommand\mybeginheadrow[1]{#1\gdef\myheadrowtokens{#1}} | |
\def\mybeginheadrow#1\myendheadrow{% | |
\toprule% must go here to avoid \noalign error | |
\rowstyle{\bfseries} | |
\gdef\myheadrowtokens{#1}% | |
\myheadrowtokens% | |
\midrule% | |
\endfirsthead%%%%%%%%%%%%% First page heading | |
\midrule | |
\multicolumn{\myfillcols}{r}{\small\faMailForward\quad\faTable\space\faHandODown} \\ | |
\endfoot%%%%%%%%%%%%%%%%%% First page ending | |
\multicolumn{\myfillcols}{r}{\small\faMailForward\quad\faTable\space\faHandOUp} \\ | |
\midrule% | |
\myheadrowtokens | |
\midrule% | |
\endhead%%%%%%%%%%%%%%%%%% Intermediate heading | |
\bottomrule | |
\endlastfoot%%%%%%%%%%%%%% Last page ending | |
}% | |
\newcommand\myendheadrow{} | |
\begin{document} | |
\begin{mytab}{l-l-l} | |
\mybeginheadrow | |
hea1 & hea2 & hea3 \\ | |
\myendheadrow | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
\end{mytab} | |
\begin{mytab}{l-l-p{.4\textwidth}} | |
\mybeginheadrow | |
hea1 & hea2 & hea3 \\ | |
\myendheadrow | |
col1 & col2 & \lipsum[1] \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
col1 & col2 & col3 \\ | |
\end{mytab} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment