# How to define a custom glossary style

How can one define his/her own glossary style.

I am looking for a set of commands (for instance):

\printitem{name}{description}{...}
\printoffsetcharacter{character}


That one can redefine and thus typeset the glossary him/herself.

MWE:

Say I have a glossary:

\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{computer}{
name=computer,
description={is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format}
}
\begin{document}
\printglossaries
\end{document}


Will print something like:

Computer is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format, 1.

Say I want to modify this such that the name is in italic, there should be a command like:

\renewcommand{\printitem}[2]{\emph{#1}: #2}


When some kind of group-style is used, another command should be redefined that prints the first character:

\renewcommand{\printoffsetcharacter}[1]{\textbf{#1}}


resulting in:

C

Computer: is a programmable machine that receives input, stores and manipulates data, and provides output in a useful format

– cfr
Apr 5 '14 at 21:04
• Do you mean you want to define your own glossary mechanism yourself from scratch or are you asking for a package that allows you to create a glossary? Apr 5 '14 at 21:10
• I've provided a MWE. Apr 9 '14 at 19:27
– user31034
Apr 9 '14 at 19:39

Changing the glossary style is described in the Defining your own glossary style section of the user manual. You can define a new style that's based on an existing style and use that. For example:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\newglossaryentry{computer}{
name=computer,
description={is a programmable machine that receives input,
stores and manipulates data, and provides output in a useful format}
}

\newglossarystyle{mystyle}{%
\setglossarystyle{treegroup}%
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}\textit{\glstarget{##1}{\glossentryname{##1}}}%
:\space \glossentrydesc{##1}\par
}%
}

\setglossarystyle{mystyle}

\begin{document}