Debian Codegraph @

texmf-dist/doc/latex/glossaries/samples/sample-langdict.tex

raw
1 % This file is public domain
2 % If you want to use arara, you need the following directives:
3 % arara: pdflatex: { synctex: on }
4 % arara: makeglossaries
5 % arara: pdflatex: { synctex: on }
6
7 % This file also requires the glossaries-english
8 % and glossaries-french language modules. These must
9 % be installed in addition to installing the glossaries package.
10 %
11 %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-langdict
12 \documentclass[english,french]{article}
13
14 \usepackage[utf8]{inputenc}
15 \usepackage[T1]{fontenc}
16 \usepackage{babel}
17 % The package option "nomain" is used here to suppress the
18 % main glossary, since this example doesn't use it. If you
19 % want to use the main glossary, remove the "nomain" option.
20 \usepackage[nomain]{glossaries}
21
22 \newglossary[glg]{english}{gls}{glo}{English to French}
23 \newglossary[flg]{french}{flx}{flo}{French to English}
24
25 \makeglossaries
26
27 % \newword{label}{english}{determiner}{french}
28 \newcommand*{\newword}[4]{%
29 \newglossaryentry{en-#1}{type=english,name={#2},description={#3 #4}}%
30 \newglossaryentry{fr-#1}{type=french,name={#3 #4},text={#4},sort={#4},description={#2}}%
31 }
32
33 \newword{cat}{cat}{le}{chat}
34 \newword{chair}{chair}{la}{chaise}
35
36 \begin{document}
37 \selectlanguage{english}
38 The \gls{en-cat} sat on the \gls{en-chair}.
39
40 \selectlanguage{french}
41 Le \gls{fr-cat} s'est repos\'e sur la \gls{fr-chair}.
42
43 \selectlanguage{english}
44 \printglossary[type=english]
45
46 \selectlanguage{french}
47 \printglossary[type=french]
48 \end{document}