[Tex/LaTex] Multiline footer with bottom of text aligned to bottom margin

geometryheader-footervertical alignment

When a single line of text is added to a footer, it is bottom-aligned to the margin as I would expect:

single line footer

However, when I add a second line of text, the alignment is still with the first line of text. I would expect the first line of text to move up, and for the whole paragraph to be bottom-aligned with the margin.

2 lines of footer

I would like to produce my document so that the bottom of the text "and another line of footer" in the example above aligns above the bottom margin, rather than the first "line of footer" text.

I've tried placing the text in a parbox, but to no avail.

I can't believe that this question hasn't been answered before, but I have looked at lots of similar questions, and cannot find one that is exactly the same scenario as this. This question is similar, but in that question the footer is still spilling into the bottom margin, rather than being bottom-aligned to it.

For info, what I am actually trying to do is place an image with some text below it into the footer, but I assume that the solution will be the same regardless.

Here is my MWE:

\documentclass[a4paper]{article}

\usepackage[includefoot,margin=0.8cm,showframe]{geometry}
\usepackage{lipsum,fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\lfoot{line of footer\\and another line of footer}

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

And just to clarify what I am trying to achieve:

how it should be

Best Answer

You can put your material in a \parbox and use the [b] option to make the alignment point be the baseline of the last line. Of course you should make sure there is enough room for the footer.

Sample ouptut

\documentclass[a4paper]{article}

\usepackage[includefoot,margin=0.8cm,showframe]{geometry}
\usepackage{lipsum,fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\lfoot{\parbox[b]{\textwidth}{line of footer\\and another line of footer}}

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