I am using LaTeX to produce texts containing both English and Greek characters, with the aid of the babel package. My approach up to now, in declaring the use of another language, is to use a shortened self-defined command (e.g. \gr{}). Though effective, this has become quite cumbersome, and I would be interested to be able to switch between the two languages without having to declare this every time. Is there a relatively short solution to this problem?

  • 1
    Hi, please always show an MWE to start with. If you need some functions of babel for your text, you will always have to tell LaTeX which language you are using at the moment. You could just change languages with out any support from babel, of course. The only solution would be to have an automatic language recognizing system... Which is neither easy nor short. So the answer would be "no". – LaRiFaRi Sep 16 '14 at 9:17
  • 3
    while a unicode font (with xetex or luatex) will allow Greek and English text to be typeset with no commands, you will still need a command to switch languages so that you get correct hyphenation – David Carlisle Sep 16 '14 at 9:56

Using XeTeX and unicode, you can type foreign scripts directly into your LaTeX document. See Why can't my build produce certain Greek symbols?

In that example, I use the \textgreek command, however, that's only necessary to allow automatic font switching.

If you go this path, you will need to switch to polyglossia, rather than babel.

  • 1
    That only solves glyphs/characters, but typographical rules, including hyphenation, cannot be switched automatically in general (not only TeX, so "in general" means exactly that). By the way, for a Greek, the foreign language is English :-). – Javier Bezos Sep 17 '14 at 16:31
  • The solution provided does allow full typographic support through polyglossia. – penguinpreferred Sep 17 '14 at 22:03
  • Many thanks! fontspec and ucharclasses are really designed to do exactly what I was looking for. @Javier: Hahaha, true! – Koul Sep 18 '14 at 9:59
  • Since the Greek and Latin alphabets don't intersect, you can load the Greek and English hyphenation patterns together in XeTeX's formats; that way you get at least the correct hyphenation for both languages at once—spaces and other stuff may be a little trickier. – erreka Nov 20 '15 at 20:59

There is auto-greek, a package which allows this exactly. I have tested some years ago, but I haven't used it; it was difficult in collaboration to use a package that cannot be installed automatically. You can review and download it here

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.