2

This question is with reference to the answer provided in How to achieve nomenclature entries like: symbol, Description, Dimension and unit, etc?

I am able to achieve different styling for different categories. Sorting is also done similar to the way illustrated in the figure. enter image description here

However what is happening is that if a category starts on one page and continues over the next page headings do not appear in the next page. I want to be able to get headings in the next page if the contents do not fit in one page. Please suggest a way to be able to get headings in a new page.

TRK
  • 389
  • You could use the longtable package to typeset this. It features header lines that will be added whenever the table is entering a new page. – TonioElGringo Aug 20 '14 at 21:58
  • I am not sure how to do this. Could you please let me know how to do that? NOTE: This question was with respect to http://tex.stackexchange.com/questions/112884/how-to-achieve-nomenclature-entries-like-symbol-description-dimension-and-uni. It would be great if the answer is an extension to the ideas presented in that question. Unfortunately, I don't have the reputation to post my query in that question. Hence I was forced to frame my own. – TRK Aug 21 '14 at 04:33
  • It is not obvious how to integrate longtable with nomencl. The package nomentbl is supposed to do just what you want, but I didn't manage to make it work. – TonioElGringo Aug 21 '14 at 09:15
  • 2
    use glossaries instead of nomencl, it has longtable styles. – Ulrike Fischer Feb 27 '20 at 13:33

2 Answers2

1

You can easily achieve this using glossaries instead of nomencl.

  • Create separate glossaries for the different kinds of symbols.
  • Add keys for any additional fields you need (dimension, unit, definition).
  • Create glossary styles as desired. I took the predefined long3col-booktabs and long4col-booktabs and modified them.
  • Add the glossary entries. I locally redefined \glsdefaulttype to put many entries in the desired glossary without giving the type key for every one. You could just as well load them from different files or create custom macros for the same level of convenience.
  • Add all defined entries to the glossaries (so you don't have to use them in the document).

As a reminder: The complete compilation cycle for glossaries is pdflatex, makeglossaries, pdflatex, pdflatex (or equivalent). (This is "Option 2" from the manual.)

\documentclass{article}

\usepackage[nonumberlist]{glossaries}
\usepackage{glossary-longbooktabs}
\usepackage{booktabs}
\usepackage{siunitx}

\newglossary*{nodimennum}{Dimensionless Numbers}
\newglossary*{greeksym}{Greek Symbols}

\glsaddkey{dimension}
  {--}
  {\glsentrydimension}
  {\Glsentrydimension}
  {\glsdimension}
  {\Glsdimension}
  {\GLSdimension}
\glsaddkey{unit}
  {--}
  {\glsentryunit}
  {\Glsentryunit}
  {\glsunit}
  {\Glsunit}
  {\GLSunit}
\glsaddkey{definition}
  {--}
  {\glsentrydefinition}
  {\Glsentrydefinition}
  {\glsdefinition}
  {\Glsdefinition}
  {\GLSdefinition}
\glssetnoexpandfield{dimension}
\glssetnoexpandfield{unit}

\newcommand*\dimensionname{Dimension}
\newcommand*\unitname{Unit}
\newcommand*\definitionname{Definition}

\newglossarystyle{nodimennum}{%
  \glspatchLToutput
  \renewenvironment{theglossary}%
    {\begin{longtable}{l p{.35\linewidth} p{.35\linewidth}}}%
    {\end{longtable}}%
  \renewcommand*{\glossaryheader}{%
    \toprule
    \bfseries \symbolname &
    \bfseries \descriptionname &
    \bfseries \definitionname
    \tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1} &
    \glsentrydefinition{##1} \tabularnewline
  }%
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}
\newglossarystyle{physsym}{%
  \glspatchLToutput
  \renewenvironment{theglossary}%
    {\begin{longtable}{l l l l}}%
    {\end{longtable}}%
  \renewcommand*{\glossaryheader}{%
    \toprule \bfseries \symbolname &
    \bfseries \descriptionname &
    \bfseries \dimensionname &
    \bfseries \unitname
    \tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1} &
    \glsentrydimension{##1} &
    \glsentryunit{##1} \tabularnewline
  }%
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}

\begingroup\renewcommand*\glsdefaulttype{greeksym}
  \newglossaryentry{eps0}{
    name={eps0},
    symbol={\(\varepsilon_0\)},
    description={vacuum permittivity},
    dimension={\(\mathrm F / \mathrm L\)},
    unit={\si{\farad\per\meter}},
  }
\endgroup

\begingroup\renewcommand*\glsdefaulttype{nodimennum}
  \newglossaryentry{zero}{
    name={0},
    symbol={\(0\)},
    description={zero},
    definition={the smallest natural number},
  }
  \newglossaryentry{one}{
    name={1},
    symbol={\(1\)},
    description={one},
    definition={\(0 + 1\)},
  }
  \newglossaryentry{two}{
    name={1},
    symbol={\(2\)},
    description={two},
    definition={\(1 + 1\)},
  }
  \newglossaryentry{three}{
    name={3},
    symbol={\(3\)},
    description={three},
    definition={\(2 + 1\)},
  }
  \newglossaryentry{four}{
    name={4},
    symbol={\(4\)},
    description={four},
    definition={\(3 + 1\)},
  }
  \newglossaryentry{five}{
    name={5},
    symbol={\(5\)},
    description={five},
    definition={\(4 + 1\)},
  }
  \newglossaryentry{six}{
    name={6},
    symbol={\(6\)},
    description={six},
    definition={\(5 + 1\)},
  }
  \newglossaryentry{seven}{
    name={7},
    symbol={\(7\)},
    description={seven},
    definition={\(6 + 1\)},
  }
  \newglossaryentry{eight}{
    name={8},
    symbol={\(8\)},
    description={eight},
    definition={\(7 + 1\)},
  }
  \newglossaryentry{nine}{
    name={9},
    symbol={\(9\)},
    description={nine},
    definition={\(8 + 1\)},
  }
\endgroup

\makeglossaries
\glsaddall

\begin{document}

Hello World!
\vskip .6\textheight

\printglossary[type=greeksym, style=physsym]
\printglossary[type=nodimennum, style=nodimennum]

\end{document}

MWE output

schtandard
  • 14,892
  • Thanks for the answer. I was able to reproduce your output by adding the option automake while including the glossaries package in the preamble. I will try to have both the types of glossary entries occupy same width on the page. – TRK Mar 02 '20 at 13:34
  • 1
    automake just runs makeglossaries for you, which you can also do manually, see section 1.1 of the glossaries documentation. For making both glossaries have the same width, just modify the longtable column specification in the glossary styles. – schtandard Mar 02 '20 at 14:23
0

Here is my answer. Thanks to @schtandard. I modified his code a bit and was able to get something closer to what I need.

\documentclass[12pt,a4paper]{article}
\usepackage[inner=1in,outer=1in,tmargin=1in,bmargin=1in]{geometry}
\usepackage{tabu}
\usepackage[nonumberlist, automake]{glossaries}
\usepackage{glossary-longbooktabs}
\usepackage{booktabs}
\usepackage{siunitx}
\newglossary*{nodimennum}{Dimensionless Numbers}
\newglossary*{greeksym}{Greek Symbols}

\glsaddkey{dimension}
  {--}
  {\glsentrydimension}
  {\Glsentrydimension}
  {\glsdimension}
  {\Glsdimension}
  {\GLSdimension}
\glsaddkey{unit}
  {--}
  {\glsentryunit}
  {\Glsentryunit}
  {\glsunit}
  {\Glsunit}
  {\GLSunit}
\glsaddkey{definition}
  {--}
  {\glsentrydefinition}
  {\Glsentrydefinition}
  {\glsdefinition}
  {\Glsdefinition}
  {\GLSdefinition}
\glssetnoexpandfield{dimension}
\glssetnoexpandfield{unit}

\newcommand*\dimensionname{Dimension}
\newcommand*\unitname{Unit}
\newcommand*\definitionname{Definition}

\newglossarystyle{nodimennum}{%
  \glspatchLToutput
  \renewenvironment{theglossary}%
    %{\begin{center}\begin{longtable}{@{\extracolsep{\fill}}p{.2\linewidth}p{.35\linewidth}p{.35\linewidth}}}%
    {\begin{longtabu}{lXX}}%
    {\end{longtabu}}%
    %{\end{longtable}\end{center}}%
  \renewcommand*{\glossaryheader}{%
    \toprule
    \bfseries \symbolname &
    \bfseries \descriptionname &
    \bfseries \definitionname
    \tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1} &
    \glsentrydefinition{##1} \tabularnewline
  }%
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}
\newglossarystyle{physsym}{%
  \glspatchLToutput
  \renewenvironment{theglossary}%
    %{\begin{center}\begin{longtable}{@{\extracolsep{\fill}} l l l l}}%
    {\begin{longtabu}{l X X X}}%
    {\end{longtabu}}%
    %{\end{longtable}\end{center}}%
  \renewcommand*{\glossaryheader}{%
    \toprule \bfseries \symbolname &
    \bfseries \descriptionname &
    \bfseries \dimensionname &
    \bfseries \unitname
    \tabularnewline\midrule\endhead
    \bottomrule\endfoot}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1} &
    \glsentrydimension{##1} &
    \glsentryunit{##1} \tabularnewline
  }%
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}%
  \fi
}
\makeglossaries
\begingroup\renewcommand*\glsdefaulttype{greeksym}
  \newglossaryentry{eps0}{
    name={eps0},
    symbol={\(\varepsilon_0\)},
    description={vacuum permittivity},
    dimension={\(\mathrm F / \mathrm L\)},
    unit={\si{\farad\per\meter}},
  }
\endgroup

\begingroup\renewcommand*\glsdefaulttype{nodimennum}
  \newglossaryentry{zero}{
    name={0},
    symbol={\(0\)},
    description={zero},
    definition={the smallest natural number},
  }
  \newglossaryentry{one}{
    name={1},
    symbol={\(1\)},
    description={one},
    definition={\(0 + 1\)},
  }
  \newglossaryentry{two}{
    name={1},
    symbol={\(2\)},
    description={two},
    definition={\(1 + 1\)},
  }
  \newglossaryentry{three}{
    name={3},
    symbol={\(3\)},
    description={three},
    definition={\(2 + 1\)},
  }
  \newglossaryentry{four}{
    name={4},
    symbol={\(4\)},
    description={four},
    definition={\(3 + 1\)},
  }
  \newglossaryentry{five}{
    name={5},
    symbol={\(5\)},
    description={five},
    definition={\(4 + 1\)},
  }
  \newglossaryentry{six}{
    name={6},
    symbol={\(6\)},
    description={six},
    definition={\(5 + 1\)},
  }
  \newglossaryentry{seven}{
    name={7},
    symbol={\(7\)},
    description={seven},
    definition={\(6 + 1\)},
  }
  \newglossaryentry{eight}{
    name={8},
    symbol={\(8\)},
    description={eight},
    definition={\(7 + 1\)},
  }
  \newglossaryentry{nine}{
    name={9},
    symbol={\(9\)},
    description={nine},
    definition={\(8 + 1\)},
  }
\endgroup

%\makeglossaries
\glsaddall

\begin{document}

Hello World!
\vskip .6\textheight

\printglossary[type=greeksym, style=physsym]
\printglossary[type=nodimennum, style=nodimennum]

\end{document}
TRK
  • 389