Page LayoutColored boxes in footer

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
znarch
Posts: 7
Joined: Sun Sep 20, 2009 3:44 pm

Colored boxes in footer

Post by znarch »

Hi all, im trying to get 3 colored boxes in my footer, i need to be able to specify the height and width exactly (in mm). And i need to be able to put the pagenumber in the box.

I had some stupid ideas but cant think of how to fix it:

+ using tikz (its not possible to put a tikz pic in a footer) (using fncyhdr)
+ using a table (impossible to make it the exact with and height i want (or am i missing something ?)

Anyone has an idea ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Colored boxes in footer

Post by Stefan Kottwitz »

Hi,

have a look at Fancy chapter headings with TikZ, there are examples using TikZ together with fancyhdr and scrpage2 to get colored boxes in the header. That could be done similar with the footer.

Stefan
LaTeX.org admin
znarch
Posts: 7
Joined: Sun Sep 20, 2009 3:44 pm

Re: Colored boxes in footer

Post by znarch »

yeah i already googled that page, but hardly understand it :oops:
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Colored boxes in footer

Post by Stefan Kottwitz »

Perhaps try the code in comment 20 on this page. If you would have concrete questions then ask here or there.

Stefan
LaTeX.org admin
znarch
Posts: 7
Joined: Sun Sep 20, 2009 3:44 pm

Colored boxes in footer

Post by znarch »

I found some way :) now i got a few questions, but first my code:

Code: Select all

\documentclass[a4paper, 10pt, oneside]{report}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tikz}

\definecolor{paars}{cmyk}{0.04,0.95,0,0}
\definecolor{rood}{cmyk}{0,0.93,1,0}
\newcommand*\tikzhead{%

 \begin{tikzpicture}[remember picture,overlay]
    \fill[color=paars!100] (0,0) rectangle (6.1,-0.75);
    \fill[color=rood!100] (6.6,0) rectangle (12.6,-0.75);
		\fill[color=rood!100] (13.1,0) rectangle (19,-0.75);   
   \end{tikzpicture}}
   
   
   
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\fancyfootoffset{-2.0in}

\foot{\tikzhead}

\pagestyle{fancy}
\newcommand*\headcolor{Aqua}
\newcommand*\setheadcolor[1]{\renewcommand*\headcolor{#1}}
\begin{document}
\setheadcolor{Gold}
\tableofcontents
\clearpaged
\setheadcolor{Olive}

\blinddocument
\end{document}
Some code is not working but this is the partthat matters:

Code: Select all

\newcommand*\tikzhead{%

 \begin{tikzpicture}[remember picture,overlay]
    \fill[color=paars!100] (0,0) rectangle (6.1,-0.75);
    \fill[color=rood!100] (6.6,0) rectangle (12.6,-0.75);
		\fill[color=rood!100] (13.1,0) rectangle (19,-0.75);   
   \end{tikzpicture}}
   
   
   
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

\fancyfootoffset{-2.0in}

\cfoot{\tikzhead}
Problem is, my picture is not centered in the middle of te page, also trying \lfoot, or \rfoot doesent matter over here, the image is alligned really odd. Dident even try the pagenumber yet :) anyone has an idea ?

ps: the pic is wider then textwidth, thats why im trying to make the footer wider but i suck at it :|
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Colored boxes in footer

Post by Stefan Kottwitz »

znarch wrote: the image is alligned really odd.
That's why the example on the other page used the current page node for positiong:

Code: Select all

\node[yshift=-2cm] at (current page.north west)
  {\begin{tikzpicture} ...
You could use current page.south west and another shift value.

Stefan
LaTeX.org admin
znarch
Posts: 7
Joined: Sun Sep 20, 2009 3:44 pm

Colored boxes in footer

Post by znarch »

Also, making the boxes in tikz should have been done different.

Mypic started at coordinate 0,0, and thats the anchor,now i did like this:

Code: Select all

 \begin{tikzpicture}[remember picture,overlay]
    \fill[color=paars!100] (-9.5,0) rectangle (-3.4,-0.75);
    \fill[color=rood!100] (-2.9,0) rectangle (3.1,-0.75);
		\fill[color=rood!100] (3.6,0) rectangle (9.6,-0.75);   
   \end{tikzpicture}}
   
and it works better, gnna fix some more, ill keep u updated :)
znarch
Posts: 7
Joined: Sun Sep 20, 2009 3:44 pm

Colored boxes in footer

Post by znarch »

Okej, another stupid question :roll:

I want the chapter number/title and so on aligned left, and in color.
I tried using something like this, but i really cant seem to do it:

Code: Select all

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{\chaptertitlename\ \thechapter\hfill \chaptertitle{\Huge}
Using Titlesec ofc, also would like to have *normal* section/subsection etc styles, but then in red. Could someone help me out ? :oops:
Post Reply