custom glossaries

I would like to change the glossaries settings in order to have " see p. x" rather than just the number of the page where this entry is.

For example if the acronym PC in the page 3 of my document, it will appear in the glossary as " PC Personal Computer. 3", and I would like " PC Personal Computer. see p. 3"

How can I do that ? I read the user-guide of the glossaries package but I did not find (or understant) something about it.

Here is an example:

\documentclass[onecolumn,twoside,openright,a4paper,11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{hyperref}
\usepackage{makeidx}                % package permettant de crÃ©er des index
\usepackage[toc,acronym,xindy,section=section]{glossaries}
\newglossary[ntg]{notation}{not}{ntn}{Glossaire}
\newglossary[slg]{symbols}{sym}{sbl}{Nomenclature}

\makeindex             %
\makeglossaries        %

\begin{document}       %

\newglossaryentry{glscard}{%type=main,
name=cardinality,
description={The number of elements in the specified set}}

\printglossary[toctitle=Lexique,type=main]

\newacronym{pc}{PC}{personal computer}

\printglossary[toctitle=Acronyms,type=acronym]

\newglossaryentry{mesh}{type=notation,
name={Mesh},
description={maillage},
sort={m}}

\printglossary[type=notation]

\newglossaryentry{mbb}{type=symbols,
name={\ensuremath{ {M} }},
first={dzq},
firstplural={esfe}
text={ \uuline{M} },
plural={fesfse},
description={matrix},
descriptionplural={desfsf},
sort=m,

\printglossary[type=symbols]

\chapter{Introduction}
\section{ab}

\gls{pc}; \gls{glscard}; \gls{mbb}; \gls{mesh};

\end{document}


Note the cross-reference does not work, I don't understand why.

The displaying of glossaries is controlled by the styles. Then you need declare a new style or edit the macros that used into the styles. The defualt style is list and the part that print the entries in the glossaries is the \glossentry macro.

The list style definition declares the \glossentry macro as (p. 251, glossaries-code.pdf):

\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{##1}%
\glstarget{##1}{\glossentryname{##1}}]
\glossentrydesc{##1}\glspostdescription\space ##2}%


Then is possible to define a new style based in the list style (p. 179, glossaries-user.pdf), and modify only the \glossentry macro adding the 'see p.' before of page list part (##2). It means:

\newglossarystyle{mylist}{%
\setglossarystyle{list}% base this style on the list style
\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{##1}%
\glstarget{##1}{\glossentryname{##1}}]
\glossentrydesc{##1}\glspostdescription\space see p.\space ##2}%
}


Finally, it is necessary set the style before of the print glossary

\setglossarystyle{mylist}


The last question about the cross-reference: this works if the newglossaryentry are used in the preamble. I don't know the reason, I think is related to that:

Originally, \newglossaryentry ... could only be used in the preamble.(p. 83, glossaries-user.pdf)

MWE:

\documentclass[onecolumn,twoside,openright,a4paper,11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{hyperref}
\usepackage{makeidx}                % package permettant de crÃ©er des index
\usepackage[toc,acronym,xindy,section=section]{glossaries}

\newglossarystyle{mylist}{%
\setglossarystyle{list}% base this style on the list style
\renewcommand*{\glossentry}[2]{%
\item[\glsentryitem{##1}%
\glstarget{##1}{\glossentryname{##1}}]
\glossentrydesc{##1}\glspostdescription\space see p.\space ##2}%
}

\newglossary[ntg]{notation}{not}{ntn}{Glossaire}
\newglossary[slg]{symbols}{sym}{sbl}{Nomenclature}

\makeindex             %
\makeglossaries        %

\newglossaryentry{glscard}{%type=main,
name=cardinality,
description={The number of elements in the specified set}}

\newglossaryentry{mesh}{type=notation,
name={Mesh},
description={maillage},
sort={m}}

\newglossaryentry{mbb}{type=symbols,
name={\ensuremath{ {M} }},
first={dzq},
firstplural={esfe}
text={ \uuline{M} },
plural={fesfse},
description={matrix},
descriptionplural={desfsf},
sort=m,

\begin{document}       %

\setglossarystyle{mylist}
\printglossary[toctitle=Lexique,type=main]
\newacronym{pc}{PC}{personal computer}
\printglossary[toctitle=Acronyms,type=acronym]
\printglossary[type=notation]

\printglossary[type=symbols]

\chapter{Introduction}
\section{ab}

\gls{pc}; \gls{glscard}; \gls{mbb}; \gls{mesh};

\end{document}

• Your code is working great when I compile with arara. But if after the arara compilation, I compile with pdflatex I get an error message : "(./essai2.out) ! Undefined control sequence. l.48 \setglossarystyle{mylist} ?" How can I avoid this error ? – R. N Oct 12 '14 at 15:38
• @Romain, hi. I ran arara and after pdflatex, but didn't obtain the error. you can try delete the auxiliary files and try again. – Carlos Lanziano Oct 12 '14 at 16:33
• I delete all the auxiliary files, and this didn't chage anything. In fact I run pdflatex through TexMaker, the error could be linked to TexMaker ? – R. N Oct 12 '14 at 21:18
• If you run the arara and pdflatex from console, do you get the same error? – Carlos Lanziano Oct 13 '14 at 14:15
• Hi. If run arara and pdflatex from console I don't get any error. But I tried today with another computer at work and I didn't get any error with TexMaker. I don't know what makes the difference but it's ok. Thanks. Otherwise, do you know how can I get the number of arguments in the list ##2 in the command newglossarystyle ? I try to creat a counter but it doesn't understant ##2 as a list but as a string. – R. N Oct 13 '14 at 15:06