在 fancyhead 上使用 tabu 时遇到的 longtabu 问题

在 fancyhead 上使用 tabu 时遇到的 longtabu 问题

我正在尝试使用该longtabu环境,但出现以下错误:

Not in outer par mode. \end{longtabu}
Undefined control sequence.\end{longtabu}
Missing number, treated as zero. \end{longtabu}

我也在标题中使用禁忌环境fancy,并且我注意到当我注释我的fancyhdr代码时,错误就消失了。

我不知道如何才能成功拥有这两张桌子。

这是我的代码

\documentclass{TN_tmp}

\usepackage[main=spanish,english]{babel}    % Paquetes de idioma y codificación
\usepackage[utf8x]{inputenc}                % Entrada de acentos
\usepackage[ddmmyyyy,12hr]{datetime} %para insertar fecha y hora

\begin{document}

\pagenumbering{roman}
\title{Titulo del documento}
\maketitle

\newpage
\tableofcontents

\pagenumbering{arabic}
\setcounter{page}{1}

{
\tabulinesep=5pt
\taburulecolor {naranjaSaveTrack}
\newtabulinestyle { punt=1pt on 2pt off 1pt}
\arrayrulewidth=2pt

\begin{longtabu} to \linewidth [c] {|[2pt]X[l]|[punt]X[c]|[2pt]}

    \tabucline [2pt]\hline
    \rowfont[c]{\footnotesize\bfseries\color{naranjaSaveTrack}}
%   \cellcolor{black!70}Dependencia (\textit{shared object}) & \cellcolor{black!70}Licencia\\
%   \rowfont[c]{\normalsize\bfseries\cellcolor{lightgray}}
    linux-vdso.so.1 & GPL \\
    libasound.so.2 & LGPL \\
    libopencv\_video.so.2.4 & BSD \\
    libopencv\_objdetect.so.2.4 & BSD \\
    libopencv\_imgproc.so.2.4 & BSD \\
    libopencv\_highgui.so.2.4 & BSD \\
    libopencv\_core.so.2.4 & BSD \\
    libopencv\_calib3d.so.2.4 & BSD \\
    libTracker.so & Comercial \\
    libgtop-2.0.so.7 & GPLv2+ \\
    libdropbox.so & MIT \\
    libfuzzylited.so & APLv2 \\
    libstdc++.so.6 & GPLv3 \\
    libcurl.so.4 & BSD \\
    libjansson.so.4 & MIT \\
    libcairo.so.2 & LGPLv2.1 \\
    libdl.so.2 & LGPLv3 \\
    libm.so.6 & LGPLv3 \\
    libpthread.so.0 & \\
    libX11.so.6 & LGPLv3 \\
    libgcc\_s.so.1 & GPL+ \\
    libc.so.6 & LGPL \\
    librt.so.1 & LGPL \\
    libtbb.so.2 & Intelv2 \\
    libGL.so.1 & \\
    libjpeg.so.8 & GPLv2 \\
    libpng12.so.0 & The zlib/libpng Lic \\
    libtiff.so.5 & Similar BSD \\
    libjasper.so.1 & Similar MIT \\
    libIlmImf.so.6 & \\
    libHalf.so.6 & \\
    libdc1394.so.22 & LGPL \\
    libv4l1.so.0 & LGPLv2.1 \\
    libavcodec.so.54  & LGPL \\
    libavformat.so.54 & LGPL \\
    libavutil.so.52 & LGPL \\
    libswscale.so.2 & GPL \\
    libQtOpenGL.so.4 & GPLv2+ \\
    libQtGui.so.4 & GPLv2+ \\
    libQtTest.so.4 & GPLv2+ \\
    libQtCore.so.4 & GPLv2+ \\
    libz.so.1 & MIT \\
    libopencv\_flann.so.2.4 & BSD \\
    libopencv\_features2d.so.2.4 & BSD \\
    libXau.so.6 & X11 \\
    libglib-2.0.so.0 & GPLv2+ \\
    libcurl-gnutls.so.4 & LGPL \\
    liboauth.so.0 & MIT \\
    libidn.so.11 & LGPLv2.1 \\
    librtmp.so.0 & LGPL \\
    libssl.so.1.0.0 & similar BSD \\
    libcrypto.so.1.0.0 & LGPLv2.1 \\
    libgssapi\_krb5.so.2 & \\
    liblber-2.4.so.2 & \\
    libldap\_r-2.4.so.2 & \\
    libpixman-1.so.0 & MIT \\
    libfontconfig.so.1 & \\
    libfreetype.so.6 & Similar BSD, compatible con GPLv3 \\
    libxcb-shm.so.0 & MIT \\
    libxcb-render.so.0 & MIT \\
    libxcb.so.1 & MIT \\
    libXrender.so.1 & AGPLv3+ \\
    libXext.so.6 & MIT \\
    libglapi.so.0 & \\
    libXdamage.so.1 & MIT \\
    libXfixes.so.3 & MIT \\
    libX11-xcb.so.1 & MIT \\
    libxcb-glx.so.0 & MIT \\
    libxcb-dri2.so.0 & MIT \\
    libxcb-dri3.so.0 & MIT \\
    libxcb-present.so.0 & MIT \\
    libxcb-sync.so.1 & MIT \\
    libxshmfence.so.1 & MIT \\
    libXxf86vm.so.1 & MIT \\
    libdrm.so.2 & MIT \\
    liblzma.so.5 & LGPLv2.1 \\
    libjbig.so.0 & GPL \\
    libIex.so.6 & \\
    libIlmThread.so.6 & \\
    libraw1394.so.11 & LGPL v2 \\
    libusb-1.0.so.0 & LGPL v2.1 \\
    libv4l2.so.0 & LGPL v2.1 \\
    libxvidcore.so.4 & \\
    libx264.so.142 & GPL \\
    libvpx.so.1 & liberal lic \\
    libvorbisenc.so.2 & Similar BSD \\
    libvorbis.so.0 & Similar BSD \\
    libtheoraenc.so.1 & LGPL v2.1 \\
    libtheoradec.so.1 & LGPL v2.1 \\
    libspeex.so.1  & BSD \\
    libschroedinger-1.0.so.0 & MIT, LGPL v2, GPL v2 \\
    libopus.so.0 & BSD \\
    libopenjpeg.so.2 & BSD \\
    libmp3lame.so.0 & \\
    libgsm.so.1 & Sin especificar \\
    libva.so.1 & MIT \\
    libgnutls.so.26 & LGPLv2.1+ \\
    libbz2.so.1.0 & Similar BSD \\
    libaudio.so.2 & APLv2 \\
    libgobject-2.0.so.0 & \\
    libSM.so.6 & MIT \\
    libICE.so.6 & MIT \\
    libXi.so.6 & MIT \\
    libpcre.so.3 & BSD \\
    libgcrypt.so.11 & LGPL \\
    libnss3.so & Mozilla License \\
    libkrb5.so.3 & AGPLv3+ \\
    libk5crypto.so.3 & \\
    libcom\_err.so.2 & MIT \\
    libkrb5support.so.0 & \\
    libresolv.so.2 & \\
    libsasl2.so.2 & GPLv2+ \\
    libgssapi.so.3 & GPLv1+ \\
    libexpat.so.1 & MIT \\
    libXdmcp.so.6 & \\
    libudev.so.1 & GPL v2 \\
    libv4lconvert.so.0 & LGPL v2.1 \\
    libogg.so.0 & BSD \\
    liborc-0.4.so.0 & BSD / Motorola Lic \\
    libtasn1.so.6 & LGPL v2.1 \\
    libp11-kit.so.0 & \\
    libXt.so.6 &  \\
    libffi.so.6 & liberal lic \\
    libuuid.so.1 & BSD \\
    libgpg-error.so.0 & GPLv2 / LGPLv2.1  \\
    libnssutil3.so & MPLv2.0 \\
    libplc4.so & \\
    libplds4.so & \\
    libnspr4.so & \\
    libkeyutils.so.1 & \\
    libheimntlm.so.0 & \\
    libkrb5.so.26 & GPL \\
    libasn1.so.8 & \\
    libhcrypto.so.4 & BSD \\
    libroken.so.18 & \\
    libcgmanager.so.0 & LGPLv2.1+ / GPLv2 \\
    libnih.so.1 & \\ 
    libnih-dbus.so.1 & \\
    libdbus-1.so.3 & Similar BSD \\
    libwind.so.0 & \\
    libheimbase.so.1 & Similar BSD \\
    libhx509.so.5 & Similar BSD \\
    libsqlite3.so.0 & Public Domain \\
    libcrypt.so.1 & MIT \\ \hline
\end{longtabu}
}

\end{document}

接下来是 Document 类:

% Copyright note: This package defines how titles should
% be typeset at the columbidae University
% Please check for updates


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{TN_tmp}[2015/11/18 v.01 a general package]
\LoadClass{article}

%\RequirePackage[main=spanish,english]{babel}   % Paquetes de idioma y codificación


%===========================================
% NEW COMMANDS
%===========================================
\newcommand*{\adressto}[1]{\gdef\@project{#1}}

%\newcommand*{\revision}[1]{\gdef\@revision{#1}}
%\newcommand*{\@revision}[1]{#1}

%
%\newcommand*{\@project}{Final Year Project}
%
%\newcommand*{\supervisor}[1]{\gdef\@supervisor{#1}}
%
%\newcommand*{\@supervisor}{\texttt{\string\supervisor} currently not set. Please fix this.}

%\newcommand{\headlinecolor}{\normalcolor}

\newcommand{\blankpage} {%
    \thispagestyle{empty}%
    {
        \vspace*{\fill}
        \begin{center}
            This page intentionally left blank.
        \end{center}
        \vspace*{\fill}
        \vspace*{\fill}
    } %
    \newpage
}


%===========================================
% COLORES
%===========================================
\RequirePackage[table,xcdraw]{xcolor}
\definecolor{naranjaSaveTrack}{RGB}{255,178,38}
\definecolor{azulBosch}{RGB}{28,115,178}
\definecolor{slcolor}{HTML}{882B21}


%===========================================
% HYPER-REFERENCES
%===========================================
\RequirePackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=black,urlcolor=black}


%===========================================
% GEOMETRY
%===========================================
\RequirePackage[includehead, includefoot, top=1cm, headheight=2cm, headsep=1cm,%
                bottom=1cm, footskip=30pt, left=2cm, right=2cm]%
                {geometry}


%===========================================
% REVISION HISTORY
%===========================================
\RequirePackage[tocentry,tablegrid,owncaptions]{vhistory}

\renewcommand{\vhhistoryname}{Revisi\'on Hist\'orica}
\renewcommand{\vhversionname}{Revisi\'on}
\renewcommand{\vhdatename}   {Fecha}
\renewcommand{\vhauthorname} {Autores}
\renewcommand{\vhchangename} {Descripci\'on}


%===========================================
% HEADER AND FOOTER definition
%===========================================
\RequirePackage{fancyhdr}   % Paquete para configurar el encabezado y pie de página
\RequirePackage{longtable}
\RequirePackage{tabu}
\RequirePackage{multirow}
\RequirePackage{multicol}
\RequirePackage{float}
\RequirePackage{graphicx}

\fancyhead{}
\fancyhead{%
    {
    \begin{tabu} to \linewidth [c] {|X[1.5,l]|X[5,l]|X[1,l]|X[1.3,l]|X[2,c]|}
        \tabulinesep=5pt
        \hline
        T\'itulo & \multicolumn{3}{l|}{\@title}  & \multirow{3}{*}{\includegraphics[width=2.5cm]{img/savetrack_640_480.png}} \\ \cline{1-4}
        Dirigido a &        & Fecha    &    \vhCurrentDate  &                   \\ \cline{1-4}
        Autor  &    \@author        & Revisi\'on &  \vhCurrentVersion   &                   \\ \hline
    \end{tabu}
    }
}
\renewcommand{\headrule}{}


\fancyfoot{} % clear all footer fields
\lfoot{{\bf\color{naranjaSaveTrack}\thepage / }\bf\@title}
\rfoot{\bf\color{azulBosch}www.savetrack.com}
\renewcommand{\footrulewidth}{0.4pt}

\pagestyle{fancy}



%===========================================
% CHAPTER - SECTION - SUBSECTION
%===========================================
%\renewcommand*\thesection{\arabic{section}}
\RequirePackage[uppercase, sf, explicit, raggedright]{titlesec}
\titleformat{\section}{\color{azulBosch}\sf\large\bf}{\thesection\hspace{2pt}}{.5em}{#1}
\titleformat{\subsection}{\color{azulBosch}\sf\large\bf}{\thesubsection\hspace{2pt}}{.5em}{#1}
\titleformat{\subsubsection}{\sf\normalsize\bf}{\thesubsubsection\hspace{2pt}}{.5em}{#1}

\setcounter{secnumdepth}{3}



%===========================================
% TITLE PAGE
%===========================================
\RequirePackage[pages=some]{background}


\backgroundsetup{scale=1,angle=0,opacity=1,placement=top,vshift=4pt,
    contents={
        \includegraphics[width=\paperwidth,height=.4\paperheight]
        {img/bg-tecnologia.jpg}
    }
}

\renewcommand{\maketitle}{%
%   \hrule
    \BgThispage
    \newgeometry{left=3cm,right=3cm,top=13cm,bottom=3cm} %defines the geometry for the titlepage
    \thispagestyle{empty}
    \begin{titlepage}           
        \pagecolor{naranjaSaveTrack}
        \definecolor{ahora}{RGB}{255,255,255}

        %\noindent
        \begin{center}
            \includegraphics[width=5cm]{img/savetrack_640_480.png}\\
            \vspace*{-15pt}\centering\Large\sffamily\color{black!70}\textbf{Vision and Intelligence on the road}\\
            \color{ahora}\rule{\textwidth}{1mm}
        \end{center}    

        \vfill
        \noindent
        {\huge\sffamily\@title} \\[10pt]
        \sffamily{\vhCurrentDate}

    \end{titlepage}
    \restoregeometry    % restores the geometry
    \nopagecolor        % Use this to restore the color pages to white
}

答案1

就我个人而言,我会避免使用包tabu,特别是在标题中。

尽管我会避免在标题中包含太多信息,但还是采用一种不太优雅的方式来制作标题。

texsxTabuHeader

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{blindtext}
\usepackage{vhistory}
\usepackage{graphicx}
\makeatletter
\setlength{\headheight}{95pt}
\fancyhead{%
    \begin{minipage}[c]{.7\textwidth}%
        \begin{tabularx}{\linewidth}{l>{\raggedright}X@{\quad\quad}ll}
            T\'itulo   & \multicolumn{3}{>{\raggedright}p{.7\linewidth}}{\@title}\\
            Dirigado a &          & Fecha      & \vhCurrentDate\\
            Autor      & \@author & Revisi\'on & \vhCurrentVersion\\
        \end{tabularx}
    \end{minipage}\hfill
    \begin{minipage}[c]{.25\textwidth}
        \hfill
        \includegraphics[width=\linewidth,keepaspectratio]{example-image-1x1}
    \end{minipage}\vspace{1ex}
}
\makeatother
\pagestyle{fancy}
\title{The wonderful journey of Walter Wombat and his friends to the magic mountain}
\author{Carl Capybara}

\begin{document}
\blindtext[5]
\end{document}

相关内容