[Tex/LaTex] Footheight and footrule using titlesec and geometry

geometryheader-footertitlesec

Consider the following MWE

\documentclass[a4paper,twoside]{article}

\usepackage[width=14cm,left=3.5cm,marginparwidth=3cm,marginparsep=0.35cm,
height=21cm,top=3.7cm,headsep=1cm,headheight=1.6cm,footskip=1.7cm,showframe]{geometry}

\usepackage[pagestyles,outermarks]{titlesec}
\newpagestyle{foo}{%
  \headrule\sethead
  [\thepage][][{\includegraphics[height=1.5cm]{foo.jpg}}]
  {{\includegraphics[height=1.5cm]{foo.jpg}}}{}{\thepage}
  \footrule
  \setfoot
  {}{\includegraphics[height=1cm,width=\textwidth]{bar.jpg}}{}
  }
\pagestyle{foo}

\usepackage[demo]{graphicx}
\usepackage{lipsum}

\begin{document}
\lipsum[1-5]
\end{document}

The image in the footer overlaps with the footrule and therefore the latter is not shown as it can be seen in the following image:

enter image description here

How can I fix this?
More generally, is there a way to increase the footheight when using the geometry package? (I can increase the head height with the headheight option but the foot height seems to be fixed, as it can be seen in the next image).

enter image description here

Best Answer

You can lower the picture using \raisebox

\raisebox{-1cm}{\includegraphics[height=1cm,width=\textwidth]{bar.jpg}}

Code:

\documentclass[a4paper,twoside]{article}

\usepackage[width=14cm,left=3.5cm,marginparwidth=3cm,marginparsep=0.35cm,
height=21cm,top=3.7cm,headsep=1cm,headheight=1.6cm,footskip=2cm,showframe]{geometry}

\usepackage[pagestyles,outermarks]{titlesec}
\newpagestyle{foo}{%
  \headrule\sethead
  [\thepage][][{\includegraphics[height=1.5cm]{foo.jpg}}]
  {{\includegraphics[height=1.5cm]{foo.jpg}}}{}{\thepage}
  \footrule
  \setfoot
  {}{\raisebox{-1cm}{\includegraphics[height=1cm,width=\textwidth]{bar.jpg}}}{}
  }
\pagestyle{foo}

\usepackage[demo]{graphicx}
\usepackage{lipsum}

\begin{document}
\lipsum[1-5]
\end{document}

enter image description here

Instead of hard coding 1cm, you may use \height like

\raisebox{-0.8\height}{\includegraphics[height=1cm,width=\textwidth]{bar.jpg}}

With fancyhdr, things look neat.

\documentclass[a4paper,twoside]{article}

\usepackage[width=14cm,left=3.5cm,marginparwidth=3cm,marginparsep=0.35cm,
height=21cm,top=3.7cm,headsep=1cm,headheight=1.6cm,footskip=2cm,showframe]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}{%
  \fancyhf{}
  \fancyhead[LE,RO]{\thepage}
  \fancyhead[RE,LO]{\includegraphics[height=1.5cm]{foo.jpg}}
  \fancyfoot[C]{\includegraphics[height=1cm,width=\textwidth]{bar.jpg}}
  \renewcommand{\footrulewidth}{0.5pt}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\begin{document}
\lipsum[1-5]
\end{document}

enter image description here