2

I added my name in the \lfoot header (I'm using \usepackage{fancyhdr}) of a file and I would like to overlay the picture of my signature to have the effect of the screenshot

enter image description here.

I can actually do it within the normal text frame, in a centered position:

\begin{center}
    \begin{tikzpicture}
    \draw (0,0) node[midway,yshift=1.2cm](c){\includegraphics[width=3cm]{JohnBrownSignature}}; 
    \node[yshift=10mm] at (c.south) {\Large \textit{John Brown}};
    \end{tikzpicture}
\end{center}

but I do not manage for the heading. I tried both with \lfoot{\includegraphics, \lfoot{\begin{picture} or \lfoot{\begin{tikzpicture}.

MWE follows:

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tikz}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.3pt}
\rfoot{Page~\thepage~of~\pageref{LastPage}}
\lfoot{John Brown}

% WRONG:
%\lfoot{John Brown{\begin{tikzpicture}\draw(0,0){\includegraphics[width=3cm]{JohnBrownSignature}}\end{tikzpicture}}

\cfoot{\today}

What is different for the headings? Are they considered as "special" areas?

  • \draw(0,0) node{\includegraphics[width=3cm]{JohnBrownSignature}}; – Salim Bou Aug 18 '17 at 10:18
3

Without the usage of TikZ and the like:

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}

\usepackage{blindtext}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.3pt}
\rfoot{Page~\thepage~of~\pageref{LastPage}}

\def\signWimage{%
    \setbox0\hbox{John Brown}%
    \hskip0.5\wd0%
    \parbox[c][0pt][c]{0pt}{%
        \makebox[0pt]{\includegraphics[width=1.1\wd0,height=2.2\ht0]{example-image-a}}}%
        \parbox[c][0pt][c]{0pt}{\makebox[0pt]{\unhbox0}}}

\lfoot{\signWimage}

\cfoot{\today}

\begin{document}
\blinddocument
\label{LastPage}
\end{document}

enter image description here

  • Thank for the input. The \wd and \ht are considered unrecognized commands. Maybe that's why the proportions of the figure are very distorted? I tried to modify the values to adjust the ratio (basically just increasing the height), what I get is the good aspect but shifted to the top ie the picture is not overlapping anymore. Am I just increasing the box height without keeping it centered? – Chamaeleon Aug 18 '17 at 13:08
  • @Chamaeleon this setup is very basic. \wd0 and \ht0 are the width and height of box0, respectively. The image and the text both are set to width 0pt and centered. But the height is their natural height, so independent of the ratio you choose, the image should be always horizontally centered and bottom align to the text. Do you want it to be vertically centered as well? – Skillmon Aug 18 '17 at 15:22
  • 1
    @Chamaeleon I've made an edit. Now both the image and the text are considered to be 0pt wide and 0pt high. They are vertically and horizontally centered on each other and the text is left aligned to the footseprule. And of course you might change the width and height in \includegraphics I chose to any value you like (they don't have to be \ht0 and \wd0). – Skillmon Aug 18 '17 at 15:28
  • The image now is not distorted, moreover adjusting the alignment of the boxes the overlap is perfect. – Chamaeleon Aug 21 '17 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.