3

I am writing a thesis with several chapters, and some symbols are used in multiple chapters but their definitions are different from chapter to chapter. I would like to have one list of symbols at the beginning of the document, but symbols of each chapter will be separated by chapters' name. Something like this:

List of symbols

chapter 1

   S size

  chapter 2

   S area

Chapter 1

  S is the radius of the cell.

Chapter 2

  S is the area.
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Marco Daniel Jul 13 '13 at 5:51
  • 5
    In your global list of symbol which meaning should S have? I think it isn't a good style changing the meaning of symbols between chapters. – Marco Daniel Jul 13 '13 at 5:55
  • Marco, I want to have a separate list of symbols for each chapter. – Mana Jul 13 '13 at 14:30
  • 1
    Have a look at Notation table in each chapter/part. I agree with the others that it isn't good style for a symbol to have different meanings in the same document, but if you really need it, you can define multiple entries with different labels and descriptions but the same name. – Nicola Talbot Jul 13 '13 at 16:15
9

As Marco says in his comment, this isn't good style. Your reader arrives at your List of Symbols expecting to look up a particular symbol in an alphabetical list. Splitting that list into several per-chapter lists makes their job harder if they don't know in which chapter the symbol was first defined.

Also, if you split your list into several per-chapter lists, your reader may not expect that "S" has different meanings in different chapters. They might see that "S" is "cell radius" in Chapter 1's list, and not bother to read further to find that it actually meant "area" in the chapter they were reading.

If you really have to assign different meanings to "S" in different chapters, then I think the simplest thing to do is to have a single list of symbols, and for the "S" entry to explicitly acknowledge the two meanings, like so:

List of symbols
---------------

R:    random reachability relation
S:    cell radius (in Chapter 1) / area (in Chapter 2)
T:    terrifyingly transitory transaction
5

Disclaimer I totally agree with the comments stating that having a glossary for each chapter is not a good idea, using the same symbol for various definitions in different chapters is even worse!

However, here is a solution based on the glossaries package. I will first provide with the code and later explain piece by piece what it does.

\documentclass{report}
\usepackage{hyperref}
\usepackage[nonumberlist,nomain]{glossaries}

\renewcommand*{\glspostdescription}{}
\newglossary{chap1}{chap1}{sbl1}{Chapter 1: Symbols}
\newglossary{chap2}{chap2}{sbl2}{Chapter 2: Symbols}
\newcommand{\addgloss}[2]{\newglossaryentry{#1}{type=chap\thechapter,name=#1,description={#2}}}
\newcommand{\addglossmath}[3]{\newglossaryentry{#3}{type=chap\thechapter,name=\ensuremath{#1},description={#2}}}
\newcommand{\printchapglossary}{\glsaddall%
\printglossary[type=chap\thechapter]}
\makeglossaries

\begin{document}

\chapter{First chapter}
\begin{equation}
E=mc^2
\end{equation}
\addglossmath{E}{Total energy}{E}
\addglossmath{m}{Mass}{m}
\addglossmath{c}{Celerity}{c}

\printchapglossary

\chapter{Second chapter}
\addgloss{test}{This is a test entry}
\addglossmath{\pi}{Famous symbol...}{pi}
Here is a \gls{test} to see the value of \gls{pi}.

\printchapglossary

\printglossaries

\end{document}

First of all, you don't need the hyperref package, but if you want it for any other purpose, you have to load it before the glossaries package. The options used here with this package are (nonumberlist) to remove the number of the page after each entry of the glossaries and (nomain) to get rid of the main glossary file which is not used if you don't want to have a main nomenclature including all the entries.

The \renewcommand*{\glspostdescription}{} is used to remove the period at the end of each entry of the glossary when printed. Then comes the "annoying" part, in order to have one small glossary for each chapter you need to define one by one these glossaries with the \newglossary command. The first argument is the label of the sub-glossary, the two next are the extensions of the files which will be created to store the entries and the last is the name of the sub-glossary which will be printed as heading (don't hesitate to rename it to your taste!).

I then defined two commands to add an entry to the glossary because the treatment of an entry dealing with maths name is a little bit special.

The first command \addgloss is for the regular entries. The first argument is the key label and the second is the definition you want to see in the glossary.

The other command \addglossmath is for mathematical symbols. The first argument is the symbol (for instance \pi), the second argument is the definition and the third argument is the label where you should not use any special character (for instance pi).

Finally I defined a third command \printglossary to use where you want to have the glossary of the current chapter. The \glsaddall command used here allows you to have entries in the glossary, defined with the previous command, even if they are not used with any of the \gsl, \Gsl, ... commands.

If you want to have all the entries sorted by chapter you just need to call \printglossaries where you want it in your document.

NOTE Assuming your document is called mydoc.tex you need to run the following commands in a terminal:

  1. latex mydoc
  2. makeglossaries mydoc
  3. latex mydoc

This is to create all the links required.

EDIT As suggested by Nicola Talbot it might be a good idea to load the morewrites package before the glossariespackage in order to make sure not to ran out of registers.

Furthermore this is just a rough idea of what is possible and the output is not satisfying (lack of homogeneity in the entries,...) but could be fixed if you want to go in that direction.

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.