Page LayoutGlossary usurps chapter name in fancyhdr

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
mr418
Posts: 3
Joined: Tue Jul 07, 2009 9:53 am

Glossary usurps chapter name in fancyhdr

Post by mr418 »

I am using the glossaries package to produce a number of glossaries for my PhD thesis. A glossary of terms goes at the beginning and two glossaries, one of reagents and one of suppliers goes in the materials and methods section.

I am using the fancyhdr package to put the chapter and section in the header. In my materials and method section on every page from that including the glossary of reagents the chapter title in the header is replaced by the glossary title.

This is the code which makes my glossaries:

Code: Select all

%%%------Make Glossaries

\usepackage[toc,nonumberlist=TRUE]{glossaries}



\newglossary[rlg]{Reagents}{rgn}{rgt}{Reagents}
\newglossary[spg]{Suppliers}{spn}{spt}{Suppliers}
\newglossary[gng]{General}{gnn}{gnt}{General}
\newglossary[crg]{ComonR}{crn}{crt}{ComonR}


\loadglsentries[Reagents]{A0_glossariy/glos_Reagents.tex}
\loadglsentries[Suppliers]{A0_glossariy/glos_Suppliers.tex}
\loadglsentries[General]{A0_glossariy/glos_General.tex}
\loadglsentries[ComonR]{A0_glossariy/glos_ComonR.tex}
\makeglossaries

%%------End Make Glossaries
This is the code which prints my glossaries.

Code: Select all

%--------------------------------------------------------------------------------------------------------------------------------------------
%-----Glossary: Reagent
\setglossarysection{subsection}
\renewcommand{\glossarypreamble}{Reagent and instrument suppliers are referred to in the text by a short names. The following glossary provides the full name and company address for each short name.}
\singlespacing
\printglossary[	type=Suppliers,
		title=Suppliers Details,
		toctitle=Suppliers Details,
		style=list,
%		nonumberlist=TRUE,
%		numberedsection=autolabel
		]
\doublespacing
\glsaddall[types=Suppliers,]
%---------End:Glossary
%--------------------------------

%----------------------------------------------------------------------------------
%-----Glossary: Common Solvents
\renewcommand{\glossarypreamble}{A list of common solvents and reagents referred to throughout the methods section with their suppliers and grade.}
\singlespacing
\printglossary[	type=ComonR,
		title=Details of Common Solvents and Reagents,
		toctitle=Details of Common Solvents and Reagents,
		style=list,
%		nonumberlist=TRUE,
%		numberedsection=autolabel
		]
\doublespacing
\glsaddall[types=ComonR,]
%---------End:Glossary
%-------------------------------------------------
Any help getting the correct chapter title into the header would be greatfully recieved.

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
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Glossary usurps chapter name in fancyhdr

Post by nlct »

Can you provide a minimal working example. For example:

Code: Select all

\documentclass{book}

\usepackage{fancyhdr}
\usepackage[toc,nonumberlist]{glossaries}

\usepackage{lipsum}

\pagestyle{fancy}

\newglossary[rlg]{Reagents}{rgn}{rgt}{Reagents}

\makeglossaries

\newglossaryentry{sample}{name=sample,description={sample entry}}

\newglossaryentry{sample2}{type=Reagents,name=another sample,
description={another sample entry}}

\glsaddall

\begin{document}
\printglossary

\chapter{Sample Chapter}
\lipsum

\printglossary[type=Reagents]

\chapter{Another Chapter}

\lipsum
\end{document}
Regards
Nicola Talbot
mr418
Posts: 3
Joined: Tue Jul 07, 2009 9:53 am

Glossary usurps chapter name in fancyhdr

Post by mr418 »

Hi Nicola

The following code replicates the problem on my system running xetex on windows xp.

I have attached the pdf produced by my system.

Page 7 has the chapter and section titles in the header as I wish. Page 11 in chapter 2 has the glossary title in place of the chapter title in the header but still the correct section title.

Code: Select all

\documentclass{book}

\usepackage{fancyhdr}

\usepackage{lipsum}


\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter. #1 }}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[RO]{\bfseries\rightmark}
\fancyhead[L]{\bfseries\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}
}


%---Glossaries Stuff

\usepackage[toc,nonumberlist=TRUE]{glossaries}

\newglossary[spg]{Special}{spn}{spt}{Special}
\newglossary[gng]{General}{gnn}{gnt}{General}

%--General Gloss
\newglossaryentry{sample1}{type=General,name=another sample,
description={another sample entry}}
\newglossaryentry{sample2}{type=General,name=another sample,
description={another sample entry}}

%Special Gloss
\newglossaryentry{Special1}{type=Special,name=another special,
description={another special entry}}
\newglossaryentry{Special2}{type=Special,name=another special,
description={another special entry}}

\makeglossaries

%---------------------------------------------

\begin{document}

\tableofcontents

\renewcommand{\glossarypreamble}{General Glossary.}
\printglossary[type=General,
							title=General Glossary,
							toctitle=General Glossary,
							style=list
							]

\chapter{Sample Chapter}
\section{section1}
\lipsum
\gls{sample1}
\gls{sample2}

\section{section2}
\lipsum

\chapter{Another Chapter}

\section{Special Glossary}

\setglossarysection{subsection}
\renewcommand{\glossarypreamble}{Special Glossary}
\printglossary[	type=Special,
							title=Special,
							toctitle=Special Glossary,
							style=list
							]
\glsaddall[types=Special]

\gls{Special1}
\gls{Special2}

\section{section3}
\lipsum

\section{section4}
\lipsum


\end{document}
my make index executions look like this:

Code: Select all

-s "%bm".ist -t "%bm".gng -o "%bm".gnn "%bm".gnt
-s "%bm".ist -t "%bm".spg -o "%bm".spn "%bm".spt
Thank you for your help

Matt
Attachments
minimalGlossError.pdf
(33.94 KiB) Downloaded 386 times
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Re: Glossary usurps chapter name in fancyhdr

Post by nlct »

That's interesting. I get an error with your example. I think there's a conflict between xfor and fancyhdr. (I don't think this is related to your problem, but it suggests you're using older versions that me.) I'll have to fix xfor.

Regards
Nicola Talbot
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Glossary usurps chapter name in fancyhdr

Post by nlct »

nlct wrote:I'll have to fix xfor.
My mistake. I've already fixed it but for some reason hadn't put the new version on my texmf tree.

The problem's caused by the \@mkboth in \glossarysection. You can redefine it after you've used \setglossarysection:

Code: Select all

\makeatletter
\renewcommand*{\glossarysection}[2][\@gls@title]{%
\def\@gls@title{#2}%
\@ifundefined{phantomsection}{%
\@glossarysection{#1}{#2}}{\@p@glossarysection{#1}{#2}}%
}
\makeatother
Regards
Nicola Talbot
mr418
Posts: 3
Joined: Tue Jul 07, 2009 9:53 am

Re: Glossary usurps chapter name in fancyhdr

Post by mr418 »

Brilliant, that works perfectly!

Thank you so much.

Matt
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Glossary usurps chapter name in fancyhdr

Post by nlct »

nlct wrote: The problem's caused by the \@mkboth in \glossarysection. You can redefine it after you've used \setglossarysection:

Code: Select all

\makeatletter
\renewcommand*{\glossarysection}[2][\@gls@title]{%
\def\@gls@title{#2}%
\@ifundefined{phantomsection}{%
\@glossarysection{#1}{#2}}{\@p@glossarysection{#1}{#2}}%
}
\makeatother
Just to let you know, in the new version (2.02) that I've just released, you can replace all the above with

Code: Select all

\renewcommand{\glossarymark}[1]{}
Regards
Nicola Talbot
Post Reply