1

I've trying to make a document template.

I've set up a header and footer very similar to that of the following MWE:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[letterpaper, left=19mm, right=19mm, top=2.54cm, bottom=2.54cm, headheight=31pt]{geometry}
\usepackage{amssymb}

% set the font of the document
\usepackage{fontspec}
\setmainfont{Arial}

\usepackage{titling}

\usepackage{setspace}
\setstretch{1.15}

\usepackage{xcolor}
\definecolor{my-orange}{RGB}{238,113,43}
\definecolor{my-light-grey}{RGB}{144,147,146}

\usepackage{titlesec}
\titlespacing\section{0pt}{6pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{6pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{6pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titleformat*{\section}{\Large\bfseries\color{my-orange}}
\titleformat*{\subsection}{\large\bfseries}
\titleformat*{\subsubsection}{\normalsize\itshape}

\usepackage{graphicx}
\usepackage{tabu}

\usepackage{fancyhdr}

\fancypagestyle{my-style}{
    \fancyhf{} %Clear Everything.
    \renewcommand{\headrulewidth}{0.75pt} 
    \renewcommand{\footrulewidth}{0.75pt} 
    \fancyhead[R]{\raisebox{-0.5\height}[0pt][0pt]{\includegraphics[width=5.15cm]{test_logo.png}}\vspace{2pt}}
    \renewcommand{\headrule}{\hbox to\headwidth{%
    \color{my-orange}\leaders\hrule height \headrulewidth\hfill}}
    \renewcommand{\footrule}{\hbox to\headwidth{%
    \color{my-orange}\leaders\hrule height \headrulewidth\hfill}}  
    \fancyfoot[C]{\vspace{-20pt}\noindent
\begin{tabu} to \textwidth {X[l]X[c]X[c]X[r]} 
{\scriptsize \color{my-light-grey}\hspace{-2ex} Sample Company} & {\scriptsize \color{my-light-grey}+44(0)99 9999 9999}  &  {\scriptsize \color{my-light-grey} [email protected]} & {\scriptsize \color{my-light-grey}www.samplecompany.com}\\
\end{tabu}\\ \vspace{5pt} {\scriptsize \color{my-light-grey}This is a placeholder sentence.}\\\vspace{-6pt}{\scriptsize \color{my-light-grey}This is also just another placeholder sentence.} }
    \fancyfoot[R]{\scriptsize \color{my-light-grey} Page | \thepage}
}

\pagestyle{my-style}

\usepackage{microtype}
\usepackage{lipsum}

\begin{document}
\section*{An example section}
\lipsum[1]
\end{document}

I'm compiling with XeLaTeX.

I'm using the tabu package to create a line in the footer of the document. The idea is that tabu allows for a number of elements to be equally spaced spanning the width of the footer.

The problem I have is that the elements don't appear evenly spaced and the last element in the tabu doesn't quite reach the end of the horizontal rule of the footer as shown below:

sample footer

How can this be fixed?

Alternatively is there a better method of having a number of separate text elements all in one line, equally spaced, and spanning the whole footer horizontal rule?

2
  • 1
    Recommendation: don't use tabu unless you don't mind your document breaking unexpectedly at some point in the future. The package author has promised backwards-incompatible changes, and refused to fix serious bugs in the meantime.
    – cfr
    Aug 12, 2015 at 22:44
  • Don't use inputenc with Xe/LuaTeX and, probably, don't use fontenc either.
    – cfr
    Aug 12, 2015 at 23:36

1 Answer 1

5

I wouldn't use any packages for this; I'd just use some \hfills:

\documentclass[12pt]{article}
\usepackage[letterpaper, left=19mm, right=19mm, top=2.54cm, bottom=2.54cm, headheight=31pt]{geometry}
\usepackage{amssymb}

% set the font of the document
\usepackage{fontspec}
\setmainfont{Arial}

\usepackage{titling}

\usepackage{setspace}
\setstretch{1.15}

\usepackage{xcolor}
\definecolor{my-orange}{RGB}{238,113,43}
\definecolor{my-light-grey}{RGB}{144,147,146}

\usepackage{titlesec}
\titlespacing\section{0pt}{6pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{6pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{6pt plus 4pt minus 2pt}{6pt plus 2pt minus 2pt}
\titleformat*{\section}{\Large\bfseries\color{my-orange}}
\titleformat*{\subsection}{\large\bfseries}
\titleformat*{\subsubsection}{\normalsize\itshape}

\usepackage{graphicx}
\usepackage{fancyhdr}

\fancypagestyle{my-style}{
    \fancyhf{} %Clear Everything.
    \renewcommand{\headrulewidth}{0.75pt} 
    \renewcommand{\footrulewidth}{0.75pt} 
    \fancyhead[R]{\raisebox{-0.5\height}[0pt][0pt]{\includegraphics[width=5.15cm]{test_logo.png}}\vspace{2pt}}
    \renewcommand{\headrule}{\hbox to\headwidth{%
    \color{my-orange}\leaders\hrule height \headrulewidth\hfill}}
    \renewcommand{\footrule}{\hbox to\headwidth{%
    \color{my-orange}\leaders\hrule height \headrulewidth\hfill}}  
    \fancyfoot[C]{\vspace{-10pt}
{\scriptsize\color{my-light-grey} Sample Company\hfill +44(0)99 9999 9999\hfill  [email protected] \hfill www.samplecompany.com \\
\vspace{5pt} This is a placeholder sentence.\\\vspace{-6pt}This is also just another placeholder sentence.}}
    \fancyfoot[R]{\scriptsize \color{my-light-grey} Page | \thepage}
}

\pagestyle{my-style}

\usepackage{microtype}
\usepackage{lipsum}

\begin{document}
\section*{An example section}
\lipsum[1]
\end{document}

The resulting footer:

enter image description here

You must log in to answer this question.

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