# Include a package in one chapter only

I have this package that removes the header from the pages

 \fancypagestyle{noheadrule}{  \fancyhf{}


It works like a charm but i only want to use it in one chapter but it removes all the headers from all the pages of the project

• Welcome to TeX.SX! How about using pagestyle{fancy} or pagestyle{plain} for the other chapters? ;-) Or defining a pagestyle \fancypagestyle{headrule}, that does not set \headrulewidth to 0pt? – user31729 May 17 '16 at 18:28
• Please edit your question title. I think this is about how to change pagestyle (from chapter to another) – touhami May 17 '16 at 19:24

It is not possible to include a package for one chapter and 'unload' it for another part of the document.

However, it's possible to limit the effects what a chapter does, depending on the chapter.

Explicitly define two different pagestyles, one for the particular chapter and another one, that restores the settings (or changes them to something other!)

\documentclass{book}

\usepackage{blindtext}

\usepackage{fancyhdr}

}

\fancyhf{}
}

\begin{document}
\blindtext[15]

\clearpage
\chapter{The fancy one!}
\blindtext[15]

\end{document}

• By the way, congrats on joining the ranks of the "Legendary"!! Just noticed that it happened a few days ago. – Mico May 17 '16 at 20:40
• @Mico: Thanks, it was a long journey to this badge ;-) Alas, it will be the last Gold badge for a long time – user31729 May 22 '16 at 15:14
• You made it "legendary" status in about half as much time as it took me! Your many contributions on this site are much appreciated. – Mico May 22 '16 at 19:59
• @Mico: Thanks again ;-) Because you gave too much lua - based answers? ;-) – user31729 May 22 '16 at 20:02
• Indeed, LuaLaTeX-based answers don't tend to generate a lot of upvotes... :-) I fear Lua(La)TeX is still a few -- but hopefully not many -- years away from experiencing more widespread adoption by the masses. – Mico May 22 '16 at 20:13