1

I followed this answer to add a seperate list of symbols, besides my acronym list and general glossary: glossaries: How to customize list of symbols with additional column for units?

As a first appearence in text I would like to see Absolute Humidity (AH), and the next appearences only AH, but when I add

    first={Absolute Humidity (AH)}

to the code, it just ignores it. Adding text={Absolute Humidity (AH)} works, but then all my references are in this long variant. I refer to it as in the code below in my main.tex

\documentclass[a4paper,10pt,twoside]{report}
\usepackage[acronym,nopostdot,toc,section=chapter]{glossaries}
\newglossary[slg]{symbolslist}{syi}{syg}{Symbolslist} % create symbolslist
% Glossary settings
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\makeglossaries
\loadglsentries{glossary}
\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
    \begin{longtable}{p{2cm}p{10.92cm}p{2cm}}}%
    {\end{longtable}}%
\renewcommand*{\glossaryheader}{%  Change the table header
    \bfseries Sign & \bfseries Description & \bfseries Unit \\
    \hline
    \endhead}
\renewcommand*{\glossentry}[2]{%  Change the displayed items
    \glstarget{##1}{\glossentryname{##1}} %
    & \glossentrydesc{##1}% Description
    & \glsunit{##1}  \tabularnewline
    }
}

\begin{document}
In text reference of first appearance of the term \gls{AH}, second appearence \gls{AH}.
    %Print the glossary
    \glsaddall
    %\printglossaries % print all in default values
    \printglossary[type=\acronymtype, style=list, nonumberlist] % prints just the list of acronyms
    \printglossary[type=symbolslist, style=symbunitlong]   % list of symbols
    \printglossary[style=altlist,nonumberlist ] % if no option is supplied the default glossary is printed.

\end{document}

my glossay.tex file looks like this

    \newglossaryentry{AH}{type=symbolslist,
    name={AH},
    description={Absolute Humidity.},
    unit={$g/m^3$}}

How can I solve this?

  • Welcome to TeX.SE. Please do not post such fragments only. Provide the compilable code that shows the issue! – user31729 Jan 15 '17 at 17:48
  • \ref is for use with \label. You need to use \gls to reference glossary entries. – Nicola Talbot Jan 15 '17 at 18:04
  • I hope I improved my question. Fairly new to latex, so I wasn't aware of the way to ask a question here – meep Jan 15 '17 at 18:04
  • I used \gls in text. I typed ref by mistake here, my document uses \gls and it shows the reference to the symbol list. The problem is that it always shows AH and no difference for the first appearence – meep Jan 15 '17 at 18:05
  • @meep: Your document is still a fragment only. I am not going to glue this to a working document – user31729 Jan 15 '17 at 18:06
1

This is the simplest method (given that AH is essentially an abbreviation):

\documentclass[a4paper,10pt,twoside]{report}

\usepackage[acronym,nopostdot,toc,section=chapter,acronymlists={acronym,symbolslist}]{glossaries}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolslist} % create symbolslist

% Glossary settings

\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}

\makeglossaries

\setacronymstyle{long-short}

\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
    \begin{longtable}{p{2cm}p{10.92cm}p{2cm}}}%
    {\end{longtable}}%
\renewcommand*{\glossaryheader}{%  Change the table header
    \bfseries Sign & \bfseries Description & \bfseries Unit \\
    \hline
    \endhead}
\renewcommand*{\glossentry}[2]{%  Change the displayed items
    \glstarget{##1}{\glossentryname{##1}} %
    & \glossentrydesc{##1}% Description
    & \glsunit{##1}  \tabularnewline
    }
}

\newacronym[type=symbolslist,unit={$g/m^3$}]{AH}{AH}{Absolute Humidity}


\begin{document}
In text reference of first appearance of the term \gls{AH}, second
appearence \gls{AH}.

    %Print the glossary

    \glsaddall
    %\printglossaries % print all in default values
    \printglossary[type=\acronymtype, style=list, nonumberlist] % prints just the list of acronyms
    \printglossary[type=symbolslist, style=symbunitlong]   % list of symbols
    \printglossary[style=altlist,nonumberlist ] % if no option is supplied the default glossary is printed.

\end{document}

In text reference of first appearance of the term Absolute Humidity (AH), second appearence AH.

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.