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.

This is perhaps a simple question with a simple answer, but I'm stumped as a tikz novice. What would be the best method to add an image (logo) file to the upper left-hand corner of my document?

sample document with desired result

MWE:

\documentclass[12pt]{article}

\usepackage{lipsum}
\usepackage{showframe}
%\usepackage{tikz}
%\usepackage{graphicx}

\begin{document}

\section*{Lorem Ipsum}

\lipsum[1]

\end{document}

I wish to avoid using fancyhdr to achieve this result.

share|improve this question
    
Do you want the image on every page of your document, or only on one? –  Jake Dec 19 '11 at 6:06
    
Every page would be preferable, but both solutions would be great to see (if anyone is willing/has the time). Sorry, I failed to mention this. –  user2473 Dec 19 '11 at 6:09
2  
If you want the image on every page, you can put your TikZ code into the header (tex.stackexchange.com/questions/4930/tikzpicture-on-every-page). If you only need it for a single page, \tikz [remember picture, overlay] \node at (current page.north west) [anchor=north west] {\includegraphics{...}}; should do the trick. –  Jake Dec 19 '11 at 6:13
    
You can also find an example similar to what Jake has given in the pgf manual on page 200. (version 2.10) –  percusse Dec 19 '11 at 6:17
2  
@Caleb: Try putting a % at the end of the line containing the TikZ code. –  Jake Dec 19 '11 at 6:23
show 1 more comment

2 Answers

up vote 20 down vote accepted

While tikz is powerful, eso-pic can also be used to perform this via \AddToShipoutPictureBG (or \AddToShipoutPictureFG):

enter image description here

\documentclass[12pt]{article}

\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{eso-pic}% http://ctan.org/pkg/eso-pic
\usepackage{graphicx}% http://ctan.org/pkg/graphicx

\AddToShipoutPictureBG{%
  \AtPageUpperLeft{\raisebox{-\height}{\includegraphics[width=1.5in]{tiger}}}%
}

\begin{document}

\section*{Lorem Ipsum}
\lipsum[1-50]

\end{document}
share|improve this answer
add comment

You can use the background package which internally relies on tikz to place either an imported graphic logo or a logo created with a tikzpicture on each page or on selected pages:

enter image description here

The code below places the image on each page. However, if you only want to place the logo on some of the pages you would simply load the package with the some option:

 \usepackage[some]{background}

and then issue the \BgThispage on the pages where you wanted the logo. An example of including the image on specific pages (ex, 2, 3, and 6) can be found in Image on top specified page.

Note

  • Need at least two runs to see the logo.

Code:

\documentclass[12pt]{article}
\usepackage[demo]{graphicx}
\usepackage[all]{background}

\usepackage{lipsum}
\usepackage{showframe}
\usepackage{tikz}

\newcommand{\MyGraphicLogo}{% For imported graphic logo
\begin{tikzpicture}[remember picture,overlay,yshift=-2cm, xshift=2cm]
  \node at (0,0) {\includegraphics[width=2cm,height=2cm]{foo}};
 \end{tikzpicture}
}

\newcommand{\MyTikzLogo}{% For a logo drawn with TikZ
\begin{tikzpicture}[remember picture,overlay,yshift=-1cm, xshift=1cm]
    \draw [cyan,fill=yellow] (0cm,0cm) 
        -- (2cm,  0cm) 
        -- (2cm, -2cm)
        -- (0cm, -2cm)
        -- cycle;
 \end{tikzpicture}
}

%\SetBgContents{\MyGraphicLogo}% Select included image
\SetBgContents{\MyTikzLogo}% Select tikz picture

\SetBgPosition{current page.north west}% Select location
\SetBgOpacity{1.0}% Select opacity
\SetBgAngle{0.0}% Select roation of logo
\SetBgScale{1.0}% Select scale factor of logo


\begin{document}
\section*{Lorem Ipsum}
\lipsum[1-12]
\end{document}
share|improve this answer
add 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.