# Apparent hyperref conflict with datatool and longtabu col vertical alignment?

Only when I turn on hyperref do I get a weird vertical alignment problem in the first column of a datatool-driven longtabu. Without hyperref, the rows of the first column are vertically aligned to the top just like the other columns. With hyperref turned on, the first column rows are acting like they have a built-in line break and drop down one line within the wrapped column.
MWE -- compare hyperref commented to uncommented:

\documentclass[12pt]{article}

\usepackage{filecontents}
\begin{filecontents}{actionitems.csv}
ID|Project|Opened|Due|Issue|From|Lead|Closed|Note
1|Area 51|2012/12/12|2012/12/21|Prepare for the ending of the world|A. Crackpot|So Crazy||12/12 Survived the trial day \DTLpar 12/22 Bored now -- go on to the next thing
2|Roswell|2012/12/12|2012/12/21|Prepare for alien abduction|Tinfoil Hat|I.M. Gullible||12/21 Where are they? \DTLpar 12/22 Left Behind!
\end{filecontents}

\usepackage{datatool}
\DTLsetseparator{|}
\DTLloaddb{actionitems}{actionitems.csv}

\usepackage{fullpage}
\usepackage{booktabs,longtable,tabu}
\usepackage{pdflscape}

% Note difference in vertical alignment of ID column with package hyperref commented or not:
\usepackage{hyperref}

\begin{document}
\pagestyle{empty}
\tabulinesep=1mm
\begin{landscape}
\begin{longtabu}{ X[1,r] X[2,l] X[2,l] X[2,l] X[5,l] X[3,l] X[5,l] }

\caption*{Open Action Items}\\
\toprule

ID & Project & Opened & Due & Issue & Lead & Note\\ \hline
\endhead

\DTLforeach*{actionitems}
{\id=ID,\project=Project,\opened=Opened,\due=Due,\issue=Issue,\lead=Lead,\note=Note}
{\id & \project & \opened & \due & \issue & \lead & \note\\ \hline}

\end{longtabu}
\end{landscape}
\end{document}
-
I get Runaway argument? \@nil \let \@dtl@line =\@dtl@trmstr \ifx \@dtl@line \@longempty \@dtl@condition – David Carlisle Dec 22 '12 at 20:58
The MWE compiled fine on my system (Windoz 7 and MikTeX 2.9). I.e: with the same strange interference with hyperref. – Sveinung Dec 22 '12 at 21:53
@Sveinung ah thanks yes, I had DL2012 but datatool was updated recently, just did a tlmgr update and now I see the described behaviour – David Carlisle Dec 23 '12 at 0:04

## 1 Answer

The behaviour is typical of the behaviour when a \special or other whatsit node appears in vertical mode. The document grfguide discusses this in the context of colour specials but it is a general problem.

The solution is the same as for colour, avoid the problem by getting in to horizontal mode.

This seems to work OK

\begin{longtabu}{ >{\mbox{}}X[1,r] X[2,l] X[2,l] X[2,l] X[5,l] X[3,l] X[5,l] }
%                 ^^^^^^^^^^
-
While I can't really confess to understand, the solution does work. Thanks! – Donnie Dec 23 '12 at 1:02
hyperref places an "anchor" where the label is set so that it can jump there from any reference, but the anchor is a node so in a \parbox[t] or similar table cell aligning on the top aligns on the invisible node above the first row. By getting \mbox in first you start the row before the whatsit node so that is inside the first line of text, so the first item in the parbox is again the first line of text so top alignment works. – David Carlisle Dec 23 '12 at 11:14
Interestingly, in the real-life document which the MWE modeled, there are actually four very similar tables one right after the other, and inserting the \mbox in only the first one cured the other three as well. – Donnie Dec 26 '12 at 19:19