2

I have a header template that is based on boxes, which looks like this:

    \documentclass[10pt,a4paper]{article}
    \usepackage[MeX]{polski}
    \usepackage[utf8]{inputenc}

    \setlength{\parindent}{0pt}

    \usepackage[
      top    = 1.50cm,
      bottom = 1.50cm,
      left   = 1.50cm,
      right  = 1.50cm,
    ]{geometry}

    \usepackage{tabularx}

    \pagestyle{empty}

    \renewcommand{\familydefault}{\sfdefault}

    \newcommand{\datasprzedazy}{3.03.2006}
    \newcommand{\terminplatnosci}{17.03.2006}
    \newcommand{\nrfaktury}{3/2006} 
    \newcommand{\netto}{1000.00} 
    \newcommand{\vat}{220.00}
    \newcommand{\brutto}{1220.00}
    \newcommand{\slownie}{jeden tysiąc dwieście dwadzieścia złotych}

    \begin{document}

    \renewcommand\arraystretch{1.3}
    \renewcommand\tabcolsep{0pt}


    \setbox0=\vtop{
      \hrule height 0pt
      \hbox{\fbox{%
        \begin{minipage}[t]{0.47\textwidth}
        \begin{tabular}[t]{ l l }
          Company Name & Logo\\
          Address & \\
          Street & \\
          Tax ID &\\
          Other Info
        \end{tabular}
        \end{minipage}%
      }}% end the \fbox and the \hbox
      \hrule height 0pt
      }% end the \vtop

    \setbox2=\vtop to \dp0{
      \hrule height 0pt
      \hbox{\framebox[0.47\textwidth]{\textbf{Faktura VAT nr \nrfaktury}}}
      \vfill
      \hbox{\begin{tabular}{lr}
        Data sprzedaży: & \datasprzedazy \\
        Data wystawienia: & \datasprzedazy
      \end{tabular}}
      \vfill
      \hbox{\framebox[0.47\textwidth]{\textbf{ORYGINAŁ}}}
      \hrule height 0pt
      }

    \leavevmode\box0\hfill\box2\par
    \end{document}

However, when I try to use it with fancyhdr, like this:

    \documentclass[10pt,a4paper]{article}
    \usepackage[MeX]{polski}
    \usepackage[utf8]{inputenc}

    \setlength{\parindent}{0pt}

    \usepackage[
      top    = 1.50cm,
      bottom = 1.50cm,
      left   = 1.50cm,
      right  = 1.50cm,
    ]{geometry}
    \usepackage{fancyhdr}

    \usepackage{tabularx}

    \pagestyle{empty}
    \pagestyle{fancy}

    \renewcommand{\familydefault}{\sfdefault}

    \newcommand{\datasprzedazy}{3.03.2006}
    \newcommand{\terminplatnosci}{17.03.2006}
    \newcommand{\nrfaktury}{3/2006} 
    \newcommand{\netto}{1000.00} 
    \newcommand{\vat}{220.00}
    \newcommand{\brutto}{1220.00}
    \newcommand{\slownie}{jeden tysiąc dwieście dwadzieścia złotych}

    \chead
    {
    \setbox0=\vtop{
      \hrule height 0pt
      \hbox{\fbox{%
        \begin{minipage}[t]{0.47\textwidth}
        \begin{tabular}[t]{ l l }
          Company Name & Logo\\
          Address & \\
          Street & \\
          Tax ID &\\
          Other Info
        \end{tabular}
        \end{minipage}%
      }}% end the \fbox and the \hbox
      \hrule height 0pt
      }% end the \vtop

    \setbox2=\vtop to \dp0{
      \hrule height 0pt
      \hbox{\framebox[0.47\textwidth]{\textbf{Faktura VAT nr \nrfaktury}}}
      \vfill
      \hbox{\begin{tabular}{lr}
        Data sprzedaży: & \datasprzedazy \\
        Data wystawienia: & \datasprzedazy
      \end{tabular}}
      \vfill
      \hbox{\framebox[0.47\textwidth]{\textbf{ORYGINAŁ}}}
      \hrule height 0pt
      }
    \leavevmode\box0\hfill\box2\par
    }

    \begin{document}

    \renewcommand\arraystretch{1.3}
    \renewcommand\tabcolsep{0pt}
    Content
    \end{document}

I get parse errors like these:

    Runaway argument?
    { \setbox 0=\vtop { \hrule height 0pt \hbox {\fbox {\begin {minipage}\ETC.
    ! Paragraph ended before \@ychead was complete.

Is there a simpler way to make this header appear on every page?

1 Answer 1

3

you cannot have paragraphs with empty lines or \par in the \chead. Use:

\chead
{%
\setbox0=\vtop{
  \hrule height 0pt
  \hbox{\fbox{%
    \begin{minipage}[t]{0.47\textwidth}
    \begin{tabular}[t]{ l l }
      Company Name & Logo\\
      Address & \\
      Street & \\
      Tax ID &\\
      Other Info
    \end{tabular}
    \end{minipage}%
  }}% end the \fbox and the \hbox
  \hrule height 0pt
  }% end the \vtop
\setbox2=\vtop to \dp0{%
  \hrule height 0pt
  \hbox{\framebox[0.47\textwidth]{\textbf{Faktura VAT nr \nrfaktury}}}
  \vfill
  \hbox{\begin{tabular}{lr}
    Data sprzedaży: & \datasprzedazy \\
    Data wystawienia: & \datasprzedazy
  \end{tabular}}
  \vfill
  \hbox{\framebox[0.47\textwidth]{\textbf{ORYGINAŁ}}}
  \hrule height 0pt
  }%
\leavevmode\box0\hfill\box2
}

However, the same is possible with a simple tabular without using setbox, which should already be defined outside of the \chead command

You must log in to answer this question.

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