Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Earlier I asked a question to match the heading of List of Acronyms and Symbols to that of List of table (instead of chapter heading). That was solved by Nicola via Formatting of heading List of Acronyms and list of tables glossaries package link. However, now it is kind of reverse problem that my Glossary heading has the same style as List of Symbols etc but I want it to be same as my chapter and index heading (smaller and centered) as it comes at the end. I am attaching a MWE which also reflects the code sent by Nicola to solve my earlier problem. I hope it is humanly possible to do that :)

\documentclass[12pt]{report}
%%%%%%%%%%%%%% For page header/footer  
\usepackage{fancyhdr}
\pagestyle{fancyplain} 
\fancyhf{}
\setlength{\headheight}{15pt}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{\bfseries{\rightmark}}
\rhead{\bfseries{\thepage}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{makeidx}
\usepackage{sectsty}
\allsectionsfont{\bfseries}
\chapterfont{\centering\Large} 
\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\usepackage[subfigure]{tocloft}
\usepackage{tocloft}
\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{7em}
\newcommand*\updatechaptername{%
\addtocontents{toc}{\protect\renewcommand*\protect\cftchappresnum{Appendix }}
}
\makeindex
\usepackage[nogroupskip,nonumberlist,acronym]{glossaries} 
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
\makeglossaries  
% Code provided by Nicola Talbot to make heading of  List of Acronyms and
% List of Symbols same as heading of List of Tables. 
\renewcommand{\glossarysection}[2][\theglstoctitle]{%
  \def\theglstoctitle{#2}%
  \vspace{\cftbeforelottitleskip}%
  \par\noindent
  {\cftlottitlefont #2}{\cftafterlottitle}%
  \vskip\cftafterlottitleskip
}
% % % % % % % % % % % % Glossary Entries  % % % % % % % % % % % % 
\newacronym{sa}{SA}{sample acronym}
\newglossaryentry{Pi}{
name=$\pi$,
description={A mathematical constant whose value is the ratio of any circle's circumference to its diameter.},
sort=symbpi, type=symbolslist
}
\newglossaryentry{glos:ia}{
name=Integer Ambiguity,
description={The unknown number of whole carrier phase cycles between the user and the satellite at the start of tracking (Sometimes ambiguity for short).} 
}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\usepackage{subfigure}
\begin{document}
\tableofcontents
\clearpage
\listoftables
\clearpage
\printglossary[type=\acronymtype,style=long,title=List of Acronyms \& Initialisms]
\clearpage
\printglossary[type=symbolslist,style=long] %Print list of symbols
\include{Sample}
\chapter{Sample}
This is my \gls{sa} and I can use it again. This is a symbol \gls{Pi}. This document\index{document} also has an index\index{index}.
\begin{table}
 \caption{Sample Table}
\end{table}
\updatechaptername
\clearpage
\glsaddall
\printglossary[] % Print list of symbols
\clearpage
\printindex
\end{document}
share|improve this question
    
Please format your MWE as code, using the {} button of the SE editor or indent each line with 4 space characters. –  Christian Hupfer Mar 10 at 18:14

1 Answer 1

up vote 7 down vote accepted

You just need to redefine \glossarysection again before the final \printglossary so that it now uses \chapter*:

\documentclass[12pt]{report}

\usepackage{makeidx}
\usepackage{sectsty}

\allsectionsfont{\bfseries}
\chapterfont{\centering\Large} 
\sectionfont{\normalsize}
\subsectionfont{\normalsize}

\usepackage[subfigure]{tocloft}
\usepackage{tocloft}

\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{7em}
\newcommand*\updatechaptername{%
\addtocontents{toc}{\protect\renewcommand*\protect\cftchappresnum{Appendix }}
}
\makeindex
\usepackage[nogroupskip,nonumberlist,acronym]{glossaries} 
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
\makeglossaries  

% section heading for glossaries in the front matter:

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
  \def\theglstoctitle{#2}%
  \vspace{\cftbeforelottitleskip}%
  \par\noindent
  {\cftlottitlefont #2}{\cftafterlottitle}%
  \vskip\cftafterlottitleskip
}

% % % % % % % % % % % % Glossary Entries  % % % % % % % % % % % % 
\newacronym{sa}{SA}{sample acronym}
\newglossaryentry{Pi}{
name=$\pi$,
description={A mathematical constant whose value is the ratio of any circle's circumference to its diameter.},
sort=symbpi, type=symbolslist
}
\newglossaryentry{glos:ia}{
name=Integer Ambiguity,
description={The unknown number of whole carrier phase cycles between the user and the satellite at the start of tracking (Sometimes ambiguity for short).} 
}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\usepackage{subfigure}

\begin{document}
\tableofcontents
\clearpage
\listoftables
\clearpage
\printglossary[type=\acronymtype,style=long,title=List of Acronyms \& Initialisms]
\clearpage
\printglossary[type=symbolslist,style=long] %Print list of symbols

\chapter{Sample}
This is my \gls{sa} and I can use it again. This is a symbol \gls{Pi}. This document\index{document} also has an index\index{index}.
\begin{table}
 \caption{Sample Table}
\end{table}
\updatechaptername
\clearpage
\glsaddall

% redefine glossary section heading

\renewcommand{\glossarysection}[2][]{\chapter*{#1}}

\printglossary[] % Print list of symbols
\clearpage
\printindex
\end{document}

This produces:

Image of glossary

(You might want to use the nopostdot package option to suppress the redundant final full stop.)

If you also want to add the glossary to the table of contents you need to adjust the code to include \addcontentsline:

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
 \def\theglstoctitle{#2}%
 \chapter*{#2}%
 \addcontentsline{toc}{chapter}{#1}%
}

or

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
 \def\theglstoctitle{#2}%
 \chapter*{#2}%
 \addcontentsline{toc}{chapter}{\numberline{}#1}%
}

To update the page headers, you can use \markboth. For example:

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
 \def\theglstoctitle{#2}%
 \chapter*{#2}%
 \addcontentsline{toc}{chapter}{\numberline{}#1}%
 \markboth{#1}{#1}%
}

or (for upper case headings):

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
 \def\theglstoctitle{#2}%
 \chapter*{#2}%
 \addcontentsline{toc}{chapter}{\numberline{}#1}%
 \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}%
}

Edit:

Presumably at this point in the document you don't have any more numbered chapters. In which case, the easiest solution may be to just use \chapter instead of \chapter* but suppress the numbering by changing the secnumdepth counter. This will ensure the glossary behaves in the same way as your other chapters. For example:

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
  \def\theglstoctitle{#2}%
  \setcounter{secnumdepth}{-1}%
  \chapter[#1]{#2}%
}
share|improve this answer
    
Thank you Nicole. It solved the problem. There is a minor glitch that the running header shows the heading of previous section (I wanted to attach the image to show it but don't know how). It should be 'Glossary'. How can i do that? –  Tash Mar 10 at 19:41
    
@Tash I've updated my answer to include how to fix the page headers. –  Nicola Talbot Mar 10 at 20:01
    
Thank Nicola, that is great. I hate to ask for more but one last thing :). Now header also shows on first page which is not consistent with the chapter heading. How can I suppress it from first page? –  Tash Mar 10 at 20:11
    
@Tash How are you setting the page style? Your MWE just has footers and no headers (the plain page style). –  Nicola Talbot Mar 10 at 20:23
    
\usepackage{fancyhdr} is being used by my thesis style file which is probably used for headers. I did not include it at first place as I did not know this issue will crop up. –  Tash Mar 10 at 21:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.