4

I have problems when I try to use the tabbing environment within a fancyhdr footer and using a longtabu table within the document.

The error message is: ! LaTeX Error: Undefined tab position.

I tried to use \linebreak, \newline and \let\ORInewline\\ but without success.

What should I do?

Here is my code example:

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{ngerman}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{fancyhdr}

\begin{document}
\pagestyle{fancyplain}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{
    \begin{tabbing}
        aaaaaaaaaaaaaaaaa\=bbbbbbbbb\\
        ccccc\>dddddddddddddddddd\\
    \end{tabbing}
}

\begin{longtabu} to 3cm {|X|X|}
    A\vspace{40cm} & B \\ % vspace needed to create table bigger than one page
\end{longtabu}
\end{document}

Thanks for your help.

3 Answers 3

3

use a tabular instead of a tabbing environment:

\fancyfoot[L]{%
    \begin{tabular}{@{} l l @{}}
        aaaaaaaaaaaaaaaaa & bbbbbbbbb\\
        ccccc & dddddddddddddddddd\\
    \end{tabular}%
}

However, using longtable makes more sense, because tabu is no longer supported.

2

It's a bug in tabu.

tabu makes many changes to LaTeX commands and does not restore them in the output routine, so things go wrong in headers and footers.

Here it patches trivlist (so more or less all LaTeX display environments, including tabbing) adding \tabu@normalcrbackslash to its definition.

So locally within the footer you need to redefine this command to do nothing so that normal behaviour is restored.

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{ngerman}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{fancyhdr}

\begin{document}
\pagestyle{fancyplain}
\fancyhf{}
\makeatletter
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{\let\tabu@normalcrbackslash\relax
        \begin{tabbing}
        aaaaaaaaaaaaaaaaa\=bbbbbbbbb\\
        ccccc\>dddddddddddddddddd\\
    \end{tabbing}%
}
\makeatother


\begin{longtabu} to 3cm {|X|X|}
    A\vspace{40cm} & B \\ % vspace needed to create table bigger than one page
\end{longtabu}
\end{document}
2

The output routine redefined by tabu seems to conflict with the workings of tabbing. You can use an indirect method:

\newsavebox{\footbox}
\sbox{\footbox}{% <-- Look out for spaces
  \begin{minipage}{\textwidth}
  \begin{tabbing}
  aaaaaaaaaaaaaaaaa\=bbbbbbbbb\\
  ccccc\>dddddddddddddddddd\\
  \end{tabbing}
  \end{minipage}% <-- Look out for spaces
}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{\usebox{\footbox}}

This is clearly a bug of tabu, but the author has announced he won't look at bug reports for the current version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .