summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/samples/sample-langdict.tex
blob: a15b19980aee8783ee3760baccf3693351c8b672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% This file is public domain
% If you want to use arara, you need the following directives:
% arara: pdflatex: { synctex: on }
% arara: makeglossaries
% arara: pdflatex: { synctex: on }

% This file also requires the glossaries-english
% and glossaries-french language modules. These must
% be installed in addition to installing the glossaries package.
%
%http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-langdict
\documentclass[english,french]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
% The package option "nomain" is used here to suppress the
% main glossary, since this example doesn't use it. If you
% want to use the main glossary, remove the "nomain" option.
\usepackage[nomain]{glossaries}

\newglossary[glg]{english}{gls}{glo}{English to French}
\newglossary[flg]{french}{flx}{flo}{French to English}

\makeglossaries

% \newword{label}{english}{determiner}{french}
\newcommand*{\newword}[4]{%
   \newglossaryentry{en-#1}{type=english,name={#2},description={#3 #4}}%
   \newglossaryentry{fr-#1}{type=french,name={#3 #4},text={#4},sort={#4},description={#2}}%
}

\newword{cat}{cat}{le}{chat}
\newword{chair}{chair}{la}{chaise}

\begin{document}
\selectlanguage{english}
The \gls{en-cat} sat on the \gls{en-chair}.

\selectlanguage{french}
Le \gls{fr-cat} s'est repos\'e sur la \gls{fr-chair}.

\selectlanguage{english}
\printglossary[type=english]

\selectlanguage{french}
\printglossary[type=french]
\end{document}