latex-dictionary/dictionary.sty
finga 8a6bc1c949 Start with the dictionary environment
Use datatool to create database of entries and print them sorted.
2024-12-04 19:46:24 +01:00

21 lines
615 B
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dictionary}[2024/11/24 Dictionary]
\RequirePackage{babel}
\RequirePackage{datatool}
\newcommand{\entry}[2]{%
\DTLnewrow{dictionary}%
\DTLnewdbentry{dictionary}{word}{#1}%
\DTLnewdbentry{dictionary}{translation}{#2}%
}
\newenvironment{dictionary}{%
\DTLifdbexists{dictionary}{\DTLcleardb{dictionary}}{\DTLnewdb{dictionary}}%
}{%
\DTLsort{word}{dictionary}%
\scriptsize%
\DTLforeach*{dictionary}{\word=word,\translation=translation}{%
\selectlanguage{vietnamese}\textbf{\word:} \selectlanguage{naustrian}\translation\\}%
\selectlanguage{vietnamese}%
}