Text Formattingfotter background color

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
pawhan11
Posts: 9
Joined: Mon Sep 22, 2014 10:27 am

fotter background color

Post by pawhan11 »

Hello,
I have another problem that I can't solve

I am using fancyfoot to define my custom fotter

Code: Select all

\documentclass[10pt,a4paper]{article}


\usepackage{fancyhdr}
\usepackage{geometry}
\geometry{   	
        a4paper,
        left=25mm,
        right=15mm,
        top=40mm,
	headheight=30mm,
        bottom=20mm,}


\pagestyle{fancy}
\fancyhf{}
% fotter
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[L]{ some image will \\ be here}
\fancyfoot[R]{Page no}


\begin{document}
test
\end{document}
What I get is:
Image
What I want is:
Image
All is good but now I need to change background color of this fotter. I only managed to change tex color but background is still white.

Is there an easy solution for that?
Last edited by pawhan11 on Wed Sep 24, 2014 9:54 am, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

fotter background color

Post by Johannes_B »

Remember, a minimal working example is always helpful to understand a problem and know the basic setup. Can you extend your snippet?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
pawhan11
Posts: 9
Joined: Mon Sep 22, 2014 10:27 am

Re: fotter background color

Post by pawhan11 »

Post edited, sorry for my mistake.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

fotter background color

Post by Johannes_B »

There is an alternative (and pretty modern) package for headers and footers (and more) called scrlayer-scrpage. In the documentation is an exapmple for yellow headers, i changed it to gray footers. Package showframe was just added for demonstration.
This works for twosided documents as well.

Code: Select all

\documentclass[10pt,a4paper]{article}


\usepackage{showframe}
%\usepackage{fancyhdr}
\usepackage[automark,footsepline]{scrlayer-scrpage}
\usepackage{geometry}
\geometry{      
	a4paper,
	left=25mm,
	right=15mm,
	top=40mm,
	headheight=30mm,
bottom=20mm,}


%\pagestyle{fancy}
%\fancyhf{}
%    % fotter
%\renewcommand{\footrulewidth}{0.4pt}
%\fancyfoot[L]{ some image will \\ be here}
%\fancyfoot[R]{\thepage}
\clearscrheadfoot
\ifoot{\rule{2em}{2em}}
\ofoot{\pagemark}
\usepackage{xcolor}
\usepackage{blindtext}
\DeclareLayer[clone=scrheadings.foot.oneside,
	contents={%
		\color{lightgray}%
		\rule[-\dp\strutbox]%
		{\layerwidth}{\layerheight}%
	}%
]{scrheadings.foot.oneside.background}
\DeclareLayer[clone=scrheadings.foot.odd,
	contents={%
		\color{lightgray}%
		\rule[-\dp\strutbox]%
		{\layerwidth}{\layerheight}%
	}%
]{scrheadings.foot.odd.background}
\DeclareLayer[clone=scrheadings.foot.even,
	contents={%
		\color{lightgray}%
		\rule[-\dp\strutbox]%
		{\layerwidth}{\layerheight}%
	}%
]{scrheadings.foot.even.background}
\AddLayersAtBeginOfPageStyle{scrheadings}{%
	scrheadings.foot.oneside.background,%
	scrheadings.foot.odd.background,%
	scrheadings.foot.even.background%
}
\pagestyle{scrheadings}

\setlength{\footheight}{24pt}%
%JB: the package tells us the exact height, which is 23.60007pt

\begin{document}
test
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
pawhan11
Posts: 9
Joined: Mon Sep 22, 2014 10:27 am

Re: fotter background color

Post by pawhan11 »

thanks ;)
Problem solved
Post Reply