2

I would like to create a document with two glossaries of the following kind:

German to English

Wahrscheinlichkeitstheorie: Probability theory

Dichte: Density

English to German

Probability theory: Wahrscheinlichkeitstheorie

Density: Dichte

For each word and its translation, I would like to have just one LaTeXentries which is used by bothglossaries`. So something of the following kind:

\newentry
{
    english = Probability theory,
    german = Wahrscheinlichkeitstheorie
}
\newentry
{
    english = Density,
    german = Dichte
}

I could not figure out a way to do that with the package glossaries, but I am not familiar with it. How can I do that?

3

A preliminary version:

\documentclass{article}

\usepackage[nomain]{glossaries}

\setlength{\glsdescwidth}{0.6\textwidth}

\newglossary{german}{ggin}{gglo}{German to English}
\newglossary{english}{bgin}{bglo}{English to German}


\newglossarystyle{dict}{%
  \setglossarystyle{long}%
  \renewenvironment{theglossary}%
  {\begin{longtable}{lp{\glsdescwidth}}}%
    {\end{longtable}}%
  %
  \renewcommand*{\glossentry}[2]{%
    \glstarget{##1}{\bfseries \glossentryname{##1}:}% Name
    & \textbf{\glossentrydesc{##1}}  \tabularnewline
  }%
}

\newcommand{\newdictentry}[3]{%
  \newglossaryentry{#1ger}{%
    name={#2},%
    description={#3},%
    type=german%
  }%
  \newglossaryentry{#1eng}{%
    name={#3},%
    description={#2},%
    type=english%
  }%
}


\newdictentry{hund}{Hund}{Dog}
\newdictentry{ente}{Ente}{Duck} 
\newdictentry{katze}{Katze}{Cat}
\newdictentry{ameise}{Ameise}{Ant}
\newdictentry{papagei}{Papagei}{Parrot}



\makeglossaries
\begin{document}

\glsaddall

My nice dictionary

\setglossarystyle{dict}
\printglossaries
\end{document}

enter image description here

3
  • Thanks! It is nice. But I have a problem with accents: for example \newdictentry{wurfel}{W\"{u}rfel}{Die} does not work out. Oct 30 '15 at 9:07
  • @GillesBonnet: Try \usepackage[utf8]{inputenc} and Würfel then
    – user31729
    Oct 30 '15 at 11:23
  • @GillesBonnet: \newdictentry{wurfel}{W\"urfel}{Die} works too. I find \"{u} rather strange
    – user31729
    Oct 30 '15 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.