I am preparing a document in Turkish which is an agglutinative language with two dimensional vowel harmony. This means that there are a lot of suffixes and they change form depending on how the word they are attached to sounds. Automatic reference numbers are simply incompatible with this aspect of Turkish.

Here is a simple example. Suppose I want to say something like "According to theorem 3.1..." which translates to "Teorem 3.1'e göre..." in Turkish. The code to get this ouptut is obviously

Teorem \ref{theorem_tag}'e göre... 

However If the numbering changes and, say, the number becomes 3.6 then the output becomes "Teorem 3.6'e göre..." which is false. It should be "Teorem 3.6'ya göre..." due to vowel harmony and some other mechanism.

Is it possible to implement a command \ref_suffix{theorem_tag}{'a} which outputs the correct form of the suffix? Vowel harmony, devoicing and other suffix changing rules are algorithmically very simple and there are no irregularities, at least in the case of numbers.

Edit: Following egreg's request, here are the rules of vowel harmony in Turkish. Notation: Let X and Y be sets of vowels. A rule of the form X -> Y means if the vowel of a syllable is from X then the vowel of the following syllable should be from Y. The rules are

{a,ı,o,u} -> {a,ı,o,u},

{a,e,ı,i} -> {a,e,ı,i},

{o,ö,u,ü} -> {a,e,u,ü}.

  • Welcome to TeX.SX! Could you explain these rules?
    – egreg
    Apr 29, 2014 at 8:51
  • Please, add to your question, rather than in comments.
    – egreg
    Apr 29, 2014 at 10:26
  • 1
    In essence, he wants something that is a very extensive version of like english single/plural. In english, you say 'one book' and 'two books', but of book is coming from a \command, then you get 'one books'. In the turkish, the idea is that the '6' is expecting a different lettering than the '1', he wants to put something to automatically create the right text for the number. Apr 29, 2014 at 11:18
  • I can't see how to adapt it to this case: I think this depends on the vowel of the numeral. Does it? And I can't see what rule provides 'ya.
    – egreg
    Apr 29, 2014 at 20:06
  • 1
    I think you need to add a reference for Turkish number names in your question... So the macro should 1. figure out the name of the last number of the ref (e.g. 3.11->11->on bir) 2. lookup what's the last vowel in its name (bir -> i) 3. produce the appropriate suffix (i->e-> 'e)
    – Bordaigorl
    May 20, 2014 at 10:20

1 Answer 1


You can condition the form of the suffix on the value of the theorem counter using an if-then control structure, e.g. using the package ifthen. Here's a MWE:







Teorem \harmony{thm} göre, so-and-so. Teorem \harmony{thm'} göre, this-and-that.

  Lorem ipsum


  Lorem ipsum


Obviously, this is only feasible if you can set a reasonably low upper bound on the total number of your theorems (in which case the solution is not really general/productive) or if the Turkish number system is very systematic vis-á-vis vowel harmony (unfortunately, I know no Turkish). In principle, the ifthen package allows for more complex comparisons in the conditional antecedent than the equal macro I've used here.

  • Thank you for the answer. However this approach is not really feasible as there are many suffixes and many numbers --I'd like to implement this up to 1000. I need a way to process the counter as a string and modify the suffix accordingly. Later I found that the packages refcount, etoolbox and xstring have everything I need.
    – sonat
    May 20, 2014 at 11:46
  • I see. If you manage to come up with a general solution, do post it! I suppose this (or something similar) will be an issue also in some other languages with complex morphology.
    – Kahovius
    May 20, 2014 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .