Text FormattingPage Border and Heading Color

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
loki
Posts: 3
Joined: Mon Jan 31, 2011 11:29 pm

Page Border and Heading Color

Post by loki »

Hi,
I'm new to LaTeX and have run into an issue. I want a colored border around my title page. I achieved this, but now the heading on the next page shows up as the same color as my border, and I can't find a way to keep my page border color while changing my heading back to black. What I have done is:
\pagestyle{fancy}
\headheight 20pt
\headwidth \textwidth
\lhead{Text}
\chead{Text}
\rhead {Text}
For the heading. Then for the titlepage:
\begin{document}
\begin{titlepage}
\color{MyDarkBlue}
\setlength\fboxrule{3pt}
\thisfancypage{\fbox}{}
Text
\end{titlepage}
\newpage

Anyone have any ideas for me as to why this is happening?

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

achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

Page Border and Heading Color

Post by achim »

I can't run your code since half of it is missing. Please provide a working minimal example.

Thank you
OS: Kubuntu
Distribution: TexLive
Editor: Kile
loki
Posts: 3
Joined: Mon Jan 31, 2011 11:29 pm

Re: Page Border and Heading Color

Post by loki »

\documentclass[11pt, twoside]{article}
%Header%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[a4paper,margin=1in, inner=1in, outer=1in, hmarginratio=1:1]{geometry}
\usepackage[pdftex]{graphicx}
\usepackage{subfig}
\usepackage[usenames]{color}
\usepackage{wrapfig}
\usepackage{fancyhdr}
\usepackage{times}
\usepackage{multirow}
\usepackage{parskip}
\usepackage[table]{xcolor}
\usepackage{float}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{color}
\usepackage{array}
\usepackage{fancybox}

\pagestyle{fancy}
\headheight 20pt
\headwidth \textwidth
\lhead{Text}
\chead{Text}
\rhead {Text}
\lfoot{ Text}
\cfoot{Text}
\rfoot{Text}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\setlength{\parindent}{0in}
\raggedbottom

%Redefine \cleardoublepage%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\def\cleardoublepage{\clearpage \if@twoside \ifodd\c@page\else
\hbox{}
\vspace{\fill}
\begin{center}
This page intentionally left blank.
\end{center}
\vspace{\fill}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

%Title Page Border Color%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{MyDarkBlue}{rgb}{0,0.08,0.45}

%Title Page%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{titlepage}
\color{MyDarkBlue}
\setlength\fboxrule{3pt}
\thisfancypage{\fbox}{}
Text
\end{titlepage}
\newpage
Text
\newpage
Text
\end{document}
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Page Border and Heading Color

Post by frabjous »

You should put code inside [ code ] boxes, as per the Board Rules.

Anyway, your problem is strange. I couldn't quite figure out why it was showing this behavior either. Probably a bad interaction between \thisfancypage and the titlepage environment. The only workaround I could see what to force the normal headers to be black by putting this right in their definitions:

Code: Select all

\pagestyle{fancy}
\headheight 20pt
\headwidth \textwidth
\let\oldheadrule=\headrule
\renewcommand{\headrule}{\color{black}\oldheadrule}
\lhead{\color{black}Text}
\chead{\color{black}Text}
\rhead{\color{black}Text}
\lfoot{\color{black}Text}
\cfoot{\color{black}Text}
\rfoot{\color{black}Text}
(Actually, I'm not sure the \lhead ... \rfoot need to have \color{black} in them, since it seems to tackle the \headrule first, but just in case.)

Not a very elegant solution. Maybe someone else will know of a better way to handle this.
loki
Posts: 3
Joined: Mon Jan 31, 2011 11:29 pm

Re: Page Border and Heading Color

Post by loki »

Thanks for replying so quickly! I'll use that for now.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Page Border and Heading Color

Post by localghost »

loki wrote:Thanks for replying so quickly! I'll use that for now.
If that solves the problem for now, then please mark the topic accordingly as written in the Board Rules (to be read before posting). Please catch up on tagging code as such in your former posts here.


Best regards and welcome to the board
Thorsten
Post Reply