LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsGlossary package and russian GOST Topic is solved

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

Glossary package and russian GOST

Postby Eternal_student » Mon Nov 22, 2021 12:51 pm

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.

Image

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
Bartman
Posts: 304
Joined: Fri Jan 03, 2020 2:39 pm

Glossary package and russian GOST

Postby Bartman » Tue Nov 23, 2021 10:05 am

As you have probably already read in other topics, the helpers like to see a Infominimal 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}
       c%@{\quad---\quad}
       >{\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
\loadglsentries{example-glossaries-long}

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

\glsaddall

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

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Glossary package and russian GOST  Topic is solved

Postby Ijon Tichy » Tue Nov 23, 2021 11:01 am

@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}
       @{\quad---\quad}
       >{\raggedright}p{\glsdescwidth}
       @{}% no extra horizontal space after the entries
       }
     }%
     {\end{longtable}}%
}

\makeglossaries

% source: test-entries
\loadglsentries{example-glossaries-long}

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

\glsaddall

\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}
       @{\quad---\quad}
       %>{\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
\loadglsentries{example-glossaries-long}

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

\glsaddall

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

This is the same trick, that is also documented for tabularx.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:

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

Glossary package and russian GOST

Postby Eternal_student » Tue Nov 23, 2021 3:23 pm

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}
       @{\quad---\quad}
       %>{\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
\loadglsentries{example-glossaries-long}

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

\glsaddall

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

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




Thank you so much!

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

Glossary package and russian GOST

Postby Bartman » Tue Nov 23, 2021 10:04 pm

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.

User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Glossary package and russian GOST

Postby Ijon Tichy » Wed Nov 24, 2021 8:54 am

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.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:

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

Glossary package and russian GOST

Postby Eternal_student » Wed May 04, 2022 7:47 am

Hello, friends! There are new requirements for the formation of the glossary. Now terms in Russian must go first in the glossary. Is it possible to implement this functionality?

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

Glossary package and russian GOST

Postby Eternal_student » Thu May 26, 2022 8:18 am

I have a list of acronyms and a glossary of names in Russian and English. Is there a parameter that allows to display the names first in Russian, then in English.

I've seen sort recipes that use the "sort" key, but I have too many names in the list to add the key manually.

\documentclass[a4paper,14pt, oneside]{extarticle}
\usepackage{fontspec}

\setmonofont{CMU Typewriter Text}
\newfontfamily\cyrillicfonttt{CMU Typewriter Text}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Times New Roman}
\newfontfamily\cyrillicfont{Times New Roman}
\setsansfont{Arial}                         
\newfontfamily\cyrillicfontsf{Arial}



\usepackage{microtype}
\sloppy


\usepackage[english, russian]{babel}
\makeatletter\AtBeginDocument{\let\@elt\relax}\makeatother % babel 3.40 fix


% ГОСТовские настройки для полей
\usepackage[left=30mm,right=10mm,top=20mm,bottom=20mm, nofoot, nomarginpar]{geometry}
\setlength{\topskip}{0pt}                                                                   
\setlength{\footskip}{12.3pt}                                                               
\usepackage{misccorr}
\usepackage{indentfirst}
\usepackage{enumitem}
\setlength{\parindent}{1.25cm}

\usepackage{setspace}
\onehalfspacing

\usepackage{tabularx}
\usepackage{multirow, longtable}
\usepackage{booktabs} %Книжные таблицы
\usepackage{xltabular}


\usepackage[xindy={glsnumbers=false}, nonumberlist, nopostdot, nogroupskip, toc, translate=babel, acronym, automake]{glossaries}
%\usepackage{glossaries-extra}

\newglossarystyle{xlongwithseparator}{%
    \setglossarystyle{long}
    \renewcommand{\arraystretch}{2}%
    \renewenvironment{theglossary}%
    {\xltabular{\linewidth}{
            @{}% no extra indent before the entries
            >{\raggedright}p{.3\textwidth}
            @{\quad---\quad}
            %>{\raggedright}% 
            X
            @{}
        }%
    }%
    {\endxltabular}
}


\newglossarystyle{acr_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{.125\textwidth}
                @{\quad---\quad}
                %>{\raggedright}% optional ragged right for last column
                X
                @{}% no extra horizontal space after the entries
            }%
        }%
        {\endxltabular}% Note: You cannot use \end{xltabular} here.
}


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

\newglossaryentry{Avtorskoe_pravo}
{
    name={Авторские права},
    plural={авторские права},
    description={интеллектуальные права на произведения науки, литературы и искусства}
}

\newglossaryentry{patenet}
{
    name={Патент},
    plural={патенты},
    description={документ, дающий исключительное право его владельцу на изобретение, промышленный образец, полезную модель или селекционное достижение}
}

\newglossaryentry{GNU}
{
    name={GNU},
    plural={\texttt{GNU}},
    description={GNU's Not Unix}
}

\newacronym{prnu}{\texttt{PRNU}}{Photo Response Non-Uniformity}
\newacronym{vlnd}{ВЛНД}{вероятность ложного недопуска}
\newacronym{frr}{\texttt{FRR}}{false reject rate}
\newacronym{vld}{ВЛД}{вероятность ложного допуска}

\makeglossaries


\begin{document}

\gls{Avtorskoe_pravo}
\gls{patenet}
\gls{GNU}

\gls{frr}, \gls{prnu}, \gls{vlnd}, \gls{vld}

    
    \printglossary[style=xlongwithseparator]
    \printglossary[type=\acronymtype, style=acr_xlongwithseparator]

\end{document}


We get that the terms and abbreviations in English come first. And I need to get the Russian terms first.


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 0 guests