## LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and Acronyms ⇒ Glossary package and russian GOST Topic is solved

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Eternal_student
Posts: 4
Joined: Mon Nov 22, 2021 12:35 pm

### Glossary package and russian GOST

Hi all, sorry for the bad English. I am using the glossary package in my master's thesis . However, I need to customize the output according to the GOST requirement. I am asking for help.

Here is a sample output.

LaTeXguide.org • LaTeX-Cookbook.net

Bartman
Posts: 248
Joined: Fri Jan 03, 2020 2:39 pm

### Glossary package and russian GOST

As you have probably already read in other topics, the helpers like to see a minimal working example given.

In addition to my idea of the vertical space between the glossary entries, I also left a different approach to the solution as a comment.

The reason for my approach is that the optional argument of the first \tabularnewline command doesn't give me even spaces.

\documentclass{article}
\usepackage{array}% makes >{decl.} available
\usepackage[automake, nogroupskip]{glossaries}

% source: styles/glossary-long.sty
\newglossarystyle{longwithseparator}{%
\setglossarystyle{long}%
%  \renewcommand{\arraystretch}{2}%
\renewenvironment{theglossary}%
{\begin{longtable}[l]{
>{\raggedright}p{.2\textwidth}
>{\raggedright}p{\glsdescwidth}}
}%
{\end{longtable}}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & --- &
\glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
& \tabularnewline
}%
}

\makeglossaries

% source: test-entries

\renewcommand{\glsnumberformat}[1]{[\glshypernumber{#1}]}

\begin{document}
\printglossary[style=longwithseparator]
\end{document}

Ijon Tichy
Posts: 587
Joined: Mon Dec 24, 2018 10:12 am

### Glossary package and russian GOST  Topic is solved

@Bartman Why not the somehow more simple \arraystretch variant?
\documentclass{article}
\usepackage{array}% makes >{decl.} available
\usepackage[automake, nogroupskip]{glossaries}

% source: styles/glossary-long.sty
\newglossarystyle{longwithseparator}{%
\setglossarystyle{long}%
\renewcommand{\arraystretch}{2}%
\renewenvironment{theglossary}%
{\begin{longtable}[l]{
@{}% no extra indent before the entries
>{\raggedright}p{.2\textwidth}
>{\raggedright}p{\glsdescwidth}
@{}% no extra horizontal space after the entries
}
}%
{\end{longtable}}%
}

\makeglossaries

% source: test-entries

\renewcommand{\glsnumberformat}[1]{[\glshypernumber{#1}]}

\begin{document}
\printglossary[style=longwithseparator]
\end{document}


You even could use package xltabular to automatically stretch the table to the whole text width. But this is a little bit tricky, because \end{xltabular} in the <end code> of a \newenvironment does usually result in an error. So you have to use the (somehow internal) \xltabular, \endxltabular:
\documentclass{article}
\usepackage{array}% makes >{decl.} available
\usepackage[automake, nogroupskip]{glossaries}
\usepackage{xltabular}

% source: styles/glossary-long.sty
\newglossarystyle{xlongwithseparator}{%
\setglossarystyle{long}%
\renewcommand{\arraystretch}{2}%
\renewenvironment{theglossary}%
{\xltabular{\linewidth}{% Note: You cannot use \begin{xltabular} here.
@{}% no extra indent before the entries
>{\raggedright}p{.2\textwidth}
%>{\raggedright}% optional ragged right for last column
X
@{}% no extra horizontal space after the entries
}%
}%
{\endxltabular}% Note: You cannot use \end{xltabular} here.
}

\makeglossaries

% source: test-entries

\renewcommand{\glsnumberformat}[1]{[\glshypernumber{#1}]}

\begin{document}
\printglossary[style=xlongwithseparator]
\end{document}


This is the same trick, that is also documented for tabularx.

Eternal_student
Posts: 4
Joined: Mon Nov 22, 2021 12:35 pm

### Glossary package and russian GOST

Ijon Tichy wrote:
\begin{document}
\printglossary[style=longwithseparator]
\end{document}


You even could use package xltabular to automatically stretch the table to the whole text width. But this is a little bit tricky, because \end{xltabular} in the <end code> of a \newenvironment does usually result in an error. So you have to use the (somehow internal) \xltabular, \endxltabular:
\documentclass{article}
\usepackage{array}% makes >{decl.} available
\usepackage[automake, nogroupskip]{glossaries}
\usepackage{xltabular}

% source: styles/glossary-long.sty
\newglossarystyle{xlongwithseparator}{%
\setglossarystyle{long}%
\renewcommand{\arraystretch}{2}%
\renewenvironment{theglossary}%
{\xltabular{\linewidth}{% Note: You cannot use \begin{xltabular} here.
@{}% no extra indent before the entries
>{\raggedright}p{.2\textwidth}
%>{\raggedright}% optional ragged right for last column
X
@{}% no extra horizontal space after the entries
}%
}%
{\endxltabular}% Note: You cannot use \end{xltabular} here.
}

\makeglossaries

% source: test-entries

\renewcommand{\glsnumberformat}[1]{[\glshypernumber{#1}]}

\begin{document}
\printglossary[style=xlongwithseparator]
\end{document}


This is the same trick, that is also documented for tabularx.

Thank you so much!

Bartman
Posts: 248
Joined: Fri Jan 03, 2020 2:39 pm

### Glossary package and russian GOST

Ijon Tichy wrote:@Bartman Why not the somehow more simple \arraystretch variant?

The command increases the space between the heading and the first entry. Since I didn't know whether this would bother the topic starter, I decided against it.

Ijon Tichy
Posts: 587
Joined: Mon Dec 24, 2018 10:12 am

### Glossary package and russian GOST

Bartman wrote:
Ijon Tichy wrote:@Bartman Why not the somehow more simple \arraystretch variant?

The command increases the space between the heading and the first entry. Since I didn't know whether this would bother the topic starter, I decided against it.

You can simply change \LTpre to compensate this, e.g. add
  \setlength{\LTpre}{0pt}% No initial vertical skip.


or
  \setlength{\LTpre}{\smallskipamount}% Only a small initial vertical skip.


before \begin{longtable} resp. \xltabular.