3

My problem is that the glossary title should be normal size, bold, all caps and centered.

While Chapter, section and subsection must be all left aligned. So I cannot change section style to suit glossary because it will break the sections original style. Yes, university is specific about such thing (the ruler is my personal touch)... I do have other glossaries, and they must all not show at ToC.

If I try to use \printacronyms[style=long,title=\centering \uppercase\bfseries {Glossary Title}] as suggested Benjamin comment on this answer, it gives me an error:

Missing { inserted. ...ysection[\glossarytoctitle]{\glossarytitle}
Missing } inserted. ...ysection[\glossarytoctitle]{\glossarytitle}
TeX capacity exceeded, sorry [input stack size=5000]. ...ysection[\glossarytoctitle]{\glossarytitle}

If I try \centering \printacronyms... then chapter and section gets centered but justified with horrible spacing MS-Word-loking because of the few words, but glossary doesn't change. Like this:

bogus chapter centered but glossary not

This is my MWE:

\documentclass[a5paper]{memoir}
\usepackage[margin=1in]{geometry}
\usepackage[T1]{fontenc}        
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\selectlanguage{brazil}         

\usepackage{titlesec}
\titleformat{\chapter}
  {\fontfamily{phv}\selectfont\bfseries\LARGE}
  {\thechapter}{20pt}{}[\vspace{2ex}\rule{\columnwidth}{0.35cm}]
\titleformat{\section}
  {\fontfamily{fvs}\selectfont\bfseries}
  {\MakeUppercase{\thesection}}{15pt}{} 

\usepackage[xindy={language=portuguese},acronym,sort=standard,nomain,nonumberlist=true,nogroupskip]{glossaries} 

\setglossarysection{subsection} 
\newacronym{pnnl}{PNNL}{Pacific Northwest National Laboratory}

\def\xindylangopt{-L lang/brazil/utf8-lang}
\makeglossaries

\begin{document}


\printacronyms[style=long,title={Glossary Title}]% \centering \uppercase\bfseries {Glossary Title}]
\chapter{Chapter Title}

Text text \gls{pnnl} text text Text text text text Text text text text Text text text text 
\section{Section title}
Text text text text Text text text text Text text text text Text text text text 
\end{document}
5

The section header for each glossary is set using \glossarysection[\glossarytoctitle]{\glossarytitle} so you just need to redefine that command before you print the glossary. For example:

\documentclass[a5paper]{memoir}
\usepackage[margin=1in]{geometry}
\usepackage[T1]{fontenc}        
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\selectlanguage{brazil}         

\usepackage{titlesec}
\titleformat{\chapter}
  {\fontfamily{phv}\selectfont\bfseries\LARGE}
  {\thechapter}{20pt}{}[\vspace{2ex}\rule{\columnwidth}{0.35cm}]
\titleformat{\section}
  {\fontfamily{fvs}\selectfont\bfseries}
  {\MakeUppercase{\thesection}}{15pt}{} 

\usepackage[xindy={language=portuguese},acronym,sort=standard,nomain,nonumberlist=true,nogroupskip]{glossaries} 

\setglossarysection{subsection} 
\newacronym{pnnl}{PNNL}{Pacific Northwest National Laboratory}

\def\xindylangopt{-L lang/brazil/utf8-lang}
\makeglossaries

\renewcommand{\glossarysection}[2][]{{\centering\bfseries\MakeTextUppercase{#2}\par}}

\begin{document}


\printacronyms[style=long,title={Glossary Title}]

\chapter{Chapter Title}

Text text \gls{pnnl} text text Text text text text Text text text
text Text text text text 
\section{Section title}
Text text text text Text text text text Text text text text Text
text text text 
\end{document}

This ignores the first argument so it doesn't get added to the table of contents, but the change to \glossarysection means it's no longer a sectioning command, so the definition may need adjusting.

  • That was fast, and works prefectly. I've tried similar commands before, but I was using \glossaryheader and \glossarytitle, which is probably why it didn't work since I defined glossary to be section right? Many thanks. – G. Bay Oct 19 '15 at 19:59
  • 1
    @G.Bay \glossarysection is the command that usually does the sectioning stuff (\section, \chapter or whatever), \glossarytitle is the actual title set at the start of \printglossary (or \printacronyms), and \glossaryheader is inserted after \begin{theglossary} and is redefined by the glossary styles. Many of the styles redefine \glossaryheader to do nothing but some, such as the longheader style redefine it to add header columns for a tabulated glossary. (There's also \glossarypreamble which is a user hook that occurs immediately after \glossaryheader.) – Nicola Talbot Oct 19 '15 at 20:10
  • Sorry, that should have been \glossarypreamble occurs immediately after \glossarysection. – Nicola Talbot Oct 20 '15 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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