LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

Reply
 
LinkBack Search this Thread
Old 04-30-2009, 08:38 AM   #1
edgjerp
Member
 
Registered: Dec 2004
Location: Trondheim, Norway
Distribution: kubuntu 10.04
Posts: 308

Rep: Reputation: 31
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?
 
Old 04-30-2009, 09:25 AM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 3,980

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
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
 
Old 05-01-2009, 06:38 AM   #3
edgjerp
Member
 
Registered: Dec 2004
Location: Trondheim, Norway
Distribution: kubuntu 10.04
Posts: 308

Original Poster
Rep: Reputation: 31
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.
 
Old 05-20-2009, 01:42 PM   #4
Stefan_K
LQ Newbie
 
Registered: May 2009
Location: Hamburg, Germany
Distribution: Ubuntu Linux
Posts: 12

Rep: Reputation: 1
graphics in header

Hi,

Quote:
Originally Posted by edgjerp View Post
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
 
  


Reply

Tags
graphic, latex, typeset


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Space above nad below the included graphics in document in latex srjoshi Linux - General 0 10-31-2007 07:57 AM
preventing LaTeX from placing a blank page first edgjerp Linux - Software 4 12-14-2006 09:34 PM
graphics with LaTeX edgjerp Linux - Software 1 11-18-2005 03:51 AM
pdf--->> latex, graphics possible? realos Linux - General 2 05-31-2004 04:50 AM
graphics problem in latex realos Linux - General 1 06-14-2003 09:24 AM


All times are GMT -5. The time now is 09:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration