2

I am using glossaries package and making List of Acronyms as well as List of Symbols. I got everything working except one formatting issue. The heading of my above two lists have a different formatting (centered and smaller font) then my List of Figure and List of tables (left justified and bigger font). I want heading of my list of acronyms and symbols to have same formatting as list of tables and figure.

Here is an example of list of table which is what I want

enter image description here

but my list of acronym looks like this:

enter image description here

My print command for acronyms is as follows:

\printglossary[type=\acronymtype,style=list,title=List of Acronyms]

I would appreciate if somebody can help me here. I have moderate skills in LaTeX.


\documentclass[12pt]{report}
\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 }}
}
\usepackage[nogroupskip,nonumberlist,acronym]{glossaries} 
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
\makeglossaries  
\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
}
\usepackage{subfigure}
\begin{document}
\tableofcontents
\listoftables
\printglossaries
\include{Sample}
\chapter{Sample}
This is my \gls{sa} and I can use it again. This is a symbol \gls{Pi}.
\begin{table}
 \caption{Sample Table}
\end{table}
\updatechaptername
\end{document}
10
  • 3
    Can you provide a minimal working example (MWE) so we can see what class you're using. Jan 23, 2014 at 16:23
  • Hi Nicola, I am using a template from my university which includes a .sty file and a preamble etc etc. I don't think I would be able to do that (provide MWE) although I want to. The template did not have the glossary function and i added myself. But I hope you understand the problem.
    – Tash
    Jan 24, 2014 at 1:41
  • Can you reproduce the problem without that stuff in a minimal document? If not, the problem arises because of that stuff and you need to figure out what. (Certainly nobody here can without seeing it!) If it still arises, then post the minimal code as the customised stuff is not the cause of the problem. Without code it is going to be pretty near impossible for anybody to help you. The best anybody could do is hazard a guess.
    – cfr
    Jan 24, 2014 at 3:25
  • @Tash Try using a building up approach or a hacking down approach to create a minimal document. Unfortunately we can't help otherwise. glossaries uses \chapter* or \section* for the header by default, so something in your code (or the class you're using) is overriding this. Jan 24, 2014 at 9:38
  • Sorry, forgot to add: Welcome to TeX.SX! Jan 24, 2014 at 9:39

1 Answer 1

4

It's the tocloft package that's changing the style of \listoftables etc, but it doesn't use the standard \section or \chapter commands, which is why the list of acronyms isn't matching. You need to modify the definition of \glossarysection to make it match:

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: pdflatex

\documentclass[12pt]{report}

\usepackage{subfigure}
\usepackage{sectsty}

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

\usepackage[subfigure]{tocloft}

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

\makeglossaries  

\renewcommand{\glossarysection}[2][\theglstoctitle]{%
  \def\theglstoctitle{#2}%
  \vspace{\cftbeforelottitleskip}%
  \par\noindent
  {\cftlottitlefont #2}{\cftafterlottitle}%
  \vskip\cftafterlottitleskip
% Uncomment the next line if you want an entry in the table of contents:
% \addcontentsline{toc}{chapter}{\numberline{}#1}%
}

\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
}


\begin{document}

\tableofcontents
\listoftables
\printglossaries

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

This produces:

Image of resulting document

Edit:

If you want to insert a page break after each glossary you can do:

\renewcommand*{\glossarypostamble}{\clearpage}

Or if you want to increase the vertical space after each glossary you can do:

\renewcommand*{\glossarypostamble}{\vspace*{1cm}}

(Change 1cm to the appropriate length.)

10
  • Thanks Nicola. I will try but i am also using a style file. Actual printing of glossary happens in .sty file which i got from my university. So I will need to bring portion of the .sty file here. Probably that portion is linked to other places in .sty file so i will have to bring that too. However I will try my best because i know that is the best way to get your help. Is it possible that i could send the .sty file because that is the part which haunts me? I thank all of you Nicola, cfr as well as cgnieder for taking interest in my post.
    – Tash
    Jan 24, 2014 at 23:58
  • @Tash If the glossary printing stuff is dealt with by your university's custom package, I suggest you ask the author of that package about it. (Modify my example so that it uses the custom .sty so you've got a MWE when you contact the package author.) If the package is publicly available you could put a link to it from here. Jan 25, 2014 at 10:57
  • Nicola, The first thing I did was to contact the author who was a student and have left. He responded but he seems busy. I modified part of his style file as he did not have glossary function working. Give me some time and I shall get back.
    – Tash
    Jan 25, 2014 at 15:11
  • Hi. I was finally able to make a MWE but it is about 1000 characters too long for this forum :)
    – Tash
    Jan 25, 2014 at 16:38
  • @Tash It sounds like you might be better off not using that package and use a class like scrbook, scrreprt or memoir that can be customised to fit your university requirements. I have a tutorial on using LaTeX to write a thesis if that's of any help. Jan 25, 2014 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .