LaTeX forum ⇒ Page LayoutShow glossaries as chapter in text but show as sections in contents

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Oleiro
Posts: 2
Joined: Thu Oct 04, 2018 12:02 pm

Show glossaries as chapter in text but show as sections in contents

Postby Oleiro » Thu Oct 04, 2018 12:45 pm

Hello everyone!

I am using the glossaries package to create two different glossaries.

  1. \newglossary*{Abbs}{List of Abbreviations}
  2. \newglossary*{ICPs}{List of Institutions, Companies \& Policies}


I am trying to display them just like the list of figure or list of tables within the document. So show them in the same style as a chapter and start on the right page. However, I would like them to be displayed in the style of a section in the contents. So exactly as when I use:

  1. \addcontentsline{toc}{section}{\listfigurename}
  2. \listoffigures


The way I have glossaries in the preambel implemented is the following:
  1. \usepackage[nogroupskip,
  2. nonumberlist,
  3. toc,
  4. %section=section,
  5. nopostdot]{glossaries}


And then I call the glossaries in the standard way:
  1. \printnoidxglossaries


When I use "section=section" it shows the two lists correctly in the contents, however, they are not shown properly in the document. When I comment it out, the lists are shown properly in the document but not in the contents.


How can I have the chapter style in the document but the section style in the contents for both glossaries?

kaiserkarl13
Posts: 599
Joined: Tue Mar 25, 2008 5:02 pm

Postby kaiserkarl13 » Sun Oct 14, 2018 8:47 pm

Do you actually want the glossaries as sections, or is it more that you want them as unnumbered chapters? It would be weird to have a chapter-level entity (such as a glossary) as a subsection of the previous chapter, but if that's what you want...try this:
  1. \documentclass{report}
  2. \usepackage[nonumberlist,toc,nopostdot,section=section]{glossaries}
  3. \makeatletter
  4. \renewcommand*{\@@glossarysec}{section}%
  5. \makeatother
  6.  
  7. \makenoidxglossaries
  8. \newglossary*{Abbs}{List of Abbreviations}
  9. \newglossary*{ICPs}{List of Institutions, Companies, and Policies}
  10. \newglossaryentry{abbr}{name={Toodles},description={Howdy}}
  11. \newglossaryentry{company}{name={Big Corporation},description={Blah}}
  12. \begin{document}
  13. \tableofcontents
  14. \chapter{My chapter}
  15. \section{Its first section}
  16. Here's my \gls{abbr} term.
  17. \section{Its second section}
  18. Here's another \gls{company} entry.
  19. \printnoidxglossaries
  20. \end{document}

Oleiro
Posts: 2
Joined: Thu Oct 04, 2018 12:02 pm

Postby Oleiro » Mon Oct 15, 2018 1:18 pm

Hey kaiserkarl13,

Thanks for your reply. Maybe I was a bit unclear. I don't want them as actual sections but they are supposed to have the same look as the one that you get from using \listoffigures or \listoftables.

I have tried a very basic approach by using \addcontentsline. Here is the code
  1. \tableofcontents
  2.  
  3. \addcontentsline{toc}{section}{\listtablename}
  4. \listoftables
  5.  
  6. \addcontentsline{toc}{section}{\listfigurename}
  7. \listoffigures
  8. \cleardoublepage
  9.  
  10. \addcontentsline{toc}{section}{List of Abbreviations}
  11. \printnoidxglossaries
  12. \addcontentsline{toc}{section}{List of Institutions, Companies \& Policies}


This gives me almost the desired result but obviously the page number of "List of Institutions..." is wrong.

I attached an image of the look that I need and of the look that I get when I simply use \printnoidxglossaries.
Attachments
What I do not want.png
What I do not want.png (14.79 KiB) Viewed 45 times
What I want.png
What I want.png (26.74 KiB) Viewed 45 times


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 7 guests