Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org LaTeX, placing graphics in header
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 04-30-2009, 08:38 AM #1 edgjerp Member   Registered: Dec 2004 Location: Trondheim, Norway Distribution: kubuntu 10.04 Posts: 308 Rep: LaTeX, placing graphics in header I am helping with making a songbook in LaTeX. The songs are to be marked with how difficult they are to sing and how challenging the guitar chords. How hard would it be to set up so these "grades" can be changed for each song? The best would be to include a small pictogram (e.g. 5 small guitars, 2 shaded for a "level 2" song). on the top of each page. The book is being written as one main document with the songs as included files. Is it even possible to include a graphic in the header without going down to plain TeX? The simplest(for writing, testing, and reuse) solution would be to define where to place the graphics in the preamble, and then just place a command in each song that tells the compiler which file to use for that song. something like this: Code: %top of included file \singability{3} \playability{2} %this would place the graphic with 2 shaded guitars in the page header \section{songtitle} my guess that the fancyhdr package might be part of the solution, but it appears that the commands it uses are all placed in the preamble, am I wrong?
 04-30-2009, 09:25 AM #2 jlinkels Senior Member   Registered: Oct 2003 Location: Bonaire Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE Posts: 4,501 Rep: It is possible to put a graphics in the header: Code: \documentclass[a4paper,10pt]{article} \usepackage{fancyhdr} \usepackage[pdftex]{color,graphicx} \pagestyle{fancy} \setlength{\headsep}{30mm} \setlength{\parindent}{0pt} \setlength{\textheight}{185mm} \thispagestyle{fancy} \fancyhf{} \lhead{} \chead{} \rhead{\setlength{\unitlength}{1mm} \begin{picture}(0,0) \put(-40,0){\includegraphics[width=50mm]{/var/www/tx_report/images/rnw_logo.jpg}} \put(-80,26){ \parbox[t]{90mm}{ \begin{flushright} \begin{scriptsize} \textsf{ Kaya Gobernador Debrot 240, Postbus 45, Bonaire, Nederlandse Antillen \\ T: +599 717 5472, F: +599 717 5427, I: www.rnw.an\\ } \end{scriptsize} \end{flushright} } } \end{picture}} \renewcommand{\headrulewidth}{0pt} \lfoot{ \begin{scriptsize} \textsf{ This document was generated automatically and typeset with \LaTeXe.\\ } \end{scriptsize} } However, to put a changing graphics in the header is somewhat more complicated. It is stated in the Latex not so short introduction that it can be done using the fancyhdr package as you expected. However, I can't give you example of that, but it should be documented in the fancyhdr package. Hope that helps. jlinkels
 05-01-2009, 06:38 AM #3 edgjerp Member   Registered: Dec 2004 Location: Trondheim, Norway Distribution: kubuntu 10.04 Posts: 308 Original Poster Rep: I found a solution in the fancyhdr manual, by combining the instructions for how to make a movie in the lower righthand corner with a custom counter and changing \rfoot to rhead, I got a small graphic in the top right corner. the coding was even a lot simpler than your example. Code: \newcounter{spill} \rhead{\setlength{\unitlength}{1mm} \begin{picture}(0,0) \put(5,0){\includegraphics[width=20mm]{gitar\thespill.jpg}} \end{picture}} to change the picture I just use \setcounter{spill}{n} where n is the new number Last edited by edgjerp; 05-01-2009 at 06:39 AM.
05-20-2009, 01:42 PM   #4
Stefan_K
LQ Newbie

Registered: May 2009
Location: Hamburg, Germany
Distribution: Ubuntu Linux
Posts: 12

Rep:

Hi,

Quote:
 Originally Posted by edgjerp Is it even possible to include a graphic in the header without going down to plain TeX?
here's an example showing graphics used in headers: Fancy chapter headings with TikZ. Solutions both for fancyhdr and scrpage2 are shown, using TikZ for graphics. But of course you could use \includegraphics instead, for instance with the textpos package that allows absolute positioning of graphics/boxes on the page.

Stefan

--
TeXblog.net

 Tags graphic, latex, typeset

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post srjoshi Linux - General 0 10-31-2007 07:57 AM edgjerp Linux - Software 4 12-14-2006 09:34 PM edgjerp Linux - Software 1 11-18-2005 03:51 AM realos Linux - General 2 05-31-2004 04:50 AM realos Linux - General 1 06-14-2003 09:24 AM

All times are GMT -5. The time now is 10:40 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -