I'm trying to change the longtable
environment to always produce this row as a first row of cells:
\begin{tabular}
\textcolor{blue}{\textbf{R}} code & Syntax & Gebruik & Is vector & Link \\
\\
\hline
\end{tabular}
What I'm trying to achieve is shown below, using the tabular
environment instead of longtable
.
\documentclass{ltxdoc}
\usepackage{xcolor}
\usepackage{geometry}
\newcommand{\tabpageskip}{
\end{tabular}%
\newpage%
\noindent \begin{tabular}[h]{l p{5cm} p{5cm} c c}
\textcolor{blue}{\textbf{R}} code & Syntax & Gebruik & Is vector ? & Link \\%
\\%
\hline%
}%
\begin{document}
\noindent \begin{tabular}[h]{l p{5cm} p{5cm} c c}
\textcolor{blue}{\textbf{R}} code & Syntax & Gebruik & Is vector & Link \\
\\
\hline
\\
\texttt{?} & \texttt{?\textcolor{blue}{<commando>}} & {Het opzoeken van \textcolor{blue}{\textbf{R}} commando's} && {$\leftarrow$}
\\
\\
\texttt{apropos()} & \texttt{\textcolor{blue}{apropos(}"\textcolor{cyan}{<commando>}"\textcolor{blue}{)}} & {(Deel van een) commando opzoeken} & & {$\leftarrow$} \\
\\
\\
\texttt{as.table()} & \texttt{\textcolor{blue}{as.table(}\textcolor{cyan}{<array>}\textcolor{red}{)}} & {\textbf{\textcolor{blue}{R}} vertellen dat je de gegevens als een tabel wil lezen: read \texttt{as.table()}!} & $\surd$ & {$\leftarrow$} \\
\\
\\
\texttt{barplot()} & {\texttt{\textcolor{blue}{barplot(}\textcolor{cyan}{<functie>},} \texttt{\textcolor{green}{col=c(}\textcolor{red}{"<kleur>",...}\textcolor{green}{)}\textcolor{blue}{)}}} & {Barplot maken (histogram, maar dan kolommen {apart}) Verschillende kleuren\label{anchor.kleurspec} instellen met de \textbf{engelse} namen, bijv.: \texttt{"brown"}} & & \\
\\
\\
\texttt{binom.test()} & {\texttt{\textcolor{blue}{binom.test(}\textcolor{cyan}{<tabel>},} \texttt{\textcolor{green}{p=<waarde>}\textcolor{blue}{)}}} & {Gesorteerde data tabel onderwerpen aan binomiaal test Hypothetische kans op succes (nulhypothese)} & $\surd$ & {$\leftarrow$} \\
\\
\\
\texttt{c()} & \texttt{\textcolor{blue}{c(}\textcolor{cyan}{<getal>},\textcolor{cyan}{ <getal>},\textcolor{red}{...}\textcolor{blue}{)}} & {Handmatig een array maken. Voor langere getallen, gebruik \texttt{array()}} & $\surd$ & {$\leftarrow$} \\
\tabpageskip
\\
\texttt{colSums()} & {\texttt{\textcolor{blue}{colSums(}\textcolor{cyan}{<functie>}\textcolor{blue}{)}}} & {Optellen van kolommen van een matrix. Voor rijen, gebruik: {\texttt{rowSums()}$\rightarrow$}} & $\surd$ & \\
\\
\\
\texttt{dbinom()} & {\texttt{\textcolor{blue}{dbinom(}\textcolor{cyan}{<getal>},} \texttt{\textcolor{green}{size=<waarde>},} \texttt{\textcolor{red}{prob=<waarschijnlijkheid>}\textcolor{blue}{)}}} & {Kans op deze waarde bij zovaak proberen kans op succes} & $\surd$ & {$\leftarrow$} \\
\\
\\
\texttt{expand.grid()} & {\texttt{\textcolor{blue}{expand.grid(}} \texttt{\textcolor{cyan}{<getal>}:\textcolor{green}{<getal>},\textcolor{red}{...}\textcolor{blue}{)}}} & {Aftellen meerdere dobbelstenen Minimale en maximale getal voor je `dobbelsteen'} & & {$\leftarrow$} \\
\\
\\
\texttt{file.choose()} & \texttt{\textcolor{blue}{file.choose(}"\textcolor{cyan}{<bestand>}"\textcolor{blue}{)}} & {Bestanden laden in \textcolor{blue}{\textbf{R}}} && {$\leftarrow$} \\
\\
\\
\texttt{help()} & \texttt{\textcolor{blue}{help(}\textcolor{cyan}{<commando>}\textcolor{blue}{)}} & {Het opzoeken van \textcolor{blue}{\textbf{R}} commando's} && {$\leftarrow$} \\
\\
\\
\texttt{hist()} & {\texttt{\textcolor{blue}{hist(}\textcolor{cyan}{<functie>},} \texttt{\textcolor{green}{breaks=}\textcolor{red}{<getal>},} \texttt{\textcolor{violet}{freq=}\textcolor{purple}{<logische waarde>}\textcolor{blue}{)}} } & {Histogram tekenen Grootte van de balkjes aangeven, zie {$\leftarrow$} \texttt{\textcolor{purple}{TRUE}}: plot de frequenties en \texttt{\textcolor{purple}{FALSE}}: plot verhouding tot geheel} & & {$\leftarrow$} \\
\\
\\
\texttt{layout()} & \texttt{\textcolor{blue}{layout(}\textcolor{cyan}{<matrix>}\textcolor{blue}{)}} & {Aanpassen van je grafische interface met de vorm van deze matrix} & & {$\leftarrow$} \\
\end{tabular}
\end{document}
I have checked longtable.dtx
and believe here is where the magic happens (lines 63-74):
\let\LT@@tabarray\@tabarray
\let\LT@@hl\hline
\def\@tabarray{%
\let\hline\LT@@hl
\let\multicolumn\LT@mcol
\LT@@tabarray}%
\let\\\LT@tabularcr\let\tabularnewline\\%
\def\newpage{\noalign{\break}}%
\def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}%
\def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}%
\let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
\@tempdima\ht\strutbox
\let\@endpbox\LT@endpbox
How can I and where should I add my line here? And as part of what argument? I tried \def\newpage{...\<mycode>}
, but that wouldn't fly so well.
tabular
looks in my OP, except I want to do it automated withlongtable
, instead oftabular
. I don't want to redefinelongtable.dtx
, I just want to maybe "hack" it to include that extra cell row.