Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm writing a text in Dutch in which I want to use the greatest common divisor. In English, I could use something like $\gcd(123,321)$. However, in Dutch, we call the function grootste gemene deler, ggd. Of course, I could use $\text{ggd}(123,321)$ (in fact, for this I wouldn't even need math mode, but suppose this is inside a larger equation). But isn't there a way to get the mathematical commands the translated?

share|improve this question
    
Do you ask, if there is a translation of the output of \gcd into other languages? –  Christian Hupfer Sep 3 at 17:23
    
@ChristianHupfer Either that or a way to use a function like \ggd, using some kind of package that would provide this function based on the language. I'm sorry, I didn't quite know how to put this question into words. –  Camil Staps Sep 3 at 17:24
4  
You do need math, as it is math and to match style with other math. To make the spacing correct do not use \text but something like \DeclareMathOperator{\ggd}{ggd}. –  Hans-Peter E. Kristiansen Sep 3 at 17:25
    
You could use babel, but you have to provide the translation for supported languages yourself. I don't know that there some translations available –  Christian Hupfer Sep 3 at 17:26
    
@Hans-PeterE.Kristiansen that works, great! Supposing there are no translations already available you can make it an answer. –  Camil Staps Sep 3 at 17:28

2 Answers 2

up vote 4 down vote accepted

This is an (easy) approach to change the output of the \gcd operator according to the current language settings. It's not perfect, the spacings could be better.

Add other languages at will ;-)

\documentclass{article}
\usepackage{amsmath}

\usepackage[ngerman,english,dutch,strings]{babel}

\newcommand{\gcdname}{}

\StartBabelCommands{dutch}{extras}%
\SetString{\gcdname}{ggd}%
\EndBabelCommands

\StartBabelCommands{ngerman}{extras}%
\SetString{\gcdname}{ggt}% Groesster gemeinsamer Teiler
\EndBabelCommands

\StartBabelCommands{english}{extras}%
\SetString{\gcdname}{gcd}% Greatest common divisor
\EndBabelCommands


\let\gcd\relax
\DeclareMathOperator{\gcd}{\gcdname}%



\begin{document}

\selectlanguage{ngerman}

\(\gcd{144,12}\)

\selectlanguage{english}

\(\gcd{144,12}\)

\selectlanguage{dutch}

\(\gcd{144,12}\)


\end{document}

enter image description here

share|improve this answer
    
This is possibly/probably the best option, as it allows copying math between documents in a different language and doesn't add a whole load of new commands, like \DeclareMathOperator{\ggd}{ggd} would. –  Camil Staps Sep 3 at 17:46
    
I think there should be some math-language option, as one might want to have text in German, say, but however stick to US notations for functions. –  Bernard Sep 3 at 17:51
    
@Bernard: Do you mean an option to the \ggd command? –  Christian Hupfer Sep 3 at 19:44
    
@Christian Hupfer: I would rather think of a .sty file, with translations for each language — more or less the way localisations work in cleveref. –  Bernard Sep 3 at 20:17
    
@Bernard: That's an interesting idea... Will you provide the French translations? (My knowledge of French is..., say, limited ;-) ) –  Christian Hupfer Sep 3 at 21:08

If you load the package amsmath, you can easily define new math operator names using that package's \DeclareMathOperator macro. E.g.,

\DeclareMathOperator{\ggd}{ggd}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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