Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to put a tikzpicture near the footer line. The tikzpicture is used to show the page number on top of an image. The problem i am having is the tikzpicture is centered on the footer.

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{fancyhdr}
\pagestyle{fancy}

\definecolor{light-blue}{RGB}{0,175,236}

\fancyhf{}
\fancyheadoffset{0in} % Ajust the header/footer width with the set margins.
\addtolength{\footskip}{0.6cm}
\renewcommand{\footrulewidth}{1pt}
\renewcommand{\footrule}{{\color{light-blue}%
   \vskip-\footruleskip\vskip-\footrulewidth
   \hrule width\headwidth height\footrulewidth\vskip\footruleskip}}

\rfoot{\begin{tikzpicture}
\node (image) at (0,0) {\includegraphics[width=0.297in,height=0.353in]{pagenumber.png}};
\node[align=center,white] at (image.center) {\thepage};
\end{tikzpicture}}
\usepackage[left=0.75in,top=1.5in,right=0.75in,bottom=1in]{geometry}

\begin{document}
some text
\end{document}
share|improve this question
add comment

1 Answer

Your code works as expected once a typo in \includegraphics is fixed (there was a missing opening brace before the name of the image file); using xshift and yshift you can fine tune the \node position:

\documentclass[12pt]{article}
\usepackage[left=0.75in,top=1.5in,right=0.75in,bottom=1in]{geometry}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage{fancyhdr}
\pagestyle{fancy}

\definecolor{light-blue}{RGB}{0,175,236}

\fancyhf{}
\addtolength{\footskip}{0.6cm}
\renewcommand{\footrulewidth}{1pt}
\renewcommand{\footrule}{{\color{light-blue}%
   \vskip-\footruleskip\vskip-\footrulewidth
   \hrule width\headwidth height\footrulewidth\vskip\footruleskip}}
\fancyfoot[R]{%
\begin{tikzpicture}[remember picture,overlay]
  \node[xshift=-0.1485in,yshift=2pt] (image) {\includegraphics[width=0.297in,height=0.353in]{pagenumber.png}};
  \node[align=center,white] at (image.center) {\thepage};
\end{tikzpicture}%
}

\begin{document}
some text
\end{document}

An image of the bottom right corner of the page and showing the desired result:

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

share|improve this answer
    
Yes, i have missed the { in the image. But my concern is i want the image next to the footer line. For example, i want to align the top of the black rectangle on the footer line. how can i achieve that? –  Pete Sep 18 '12 at 18:22
    
@Pete what footer line? Your code doesn't produce a physical line; I don't understand what line are you referring to. –  Gonzalo Medina Sep 18 '12 at 18:24
    
I have edited my 1st post and it includes the footer line. sorry, i thought it was there by default. –  Pete Sep 18 '12 at 18:50
    
@Pete I updated my answer. –  Gonzalo Medina Sep 18 '12 at 19:08
    
Thanks Gonzalo :) –  Pete Sep 18 '12 at 19:19
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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