5

I am writing in english, greek babel and I have custom commands to change between languages. The problem is that I can change to english for example, anywhere in my text except in \chapter{}, \section{} etc. How can I use different languages in section titles?

This doesn't work:

\section{Παράδειγμα \eng{Something}}

I don't want to use XeLaTeX.

1
  • 2
    Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Apr 2, 2014 at 19:19

1 Answer 1

4

Use \protect to prevent too early expansion in moving arguments such as in titles:

\section{Παράδειγμα \protect\eng{Something}}

Moving means here, that the titles will be copied to the table of contents as well. They should do that in their original version, not expanded, that's why the \protect.

Furthermore, you could might distinguishing betweeen TOC and heading title and title in running text, depending on the needs, such as

\section[Παράδειγμα]{Παράδειγμα \protect\eng{Something}}
2
  • I found a better way, because the above will have problem in table of contents. Alternative: \subsection{\texorpdfstring{Το Αισθητήριο Όργανο \eng{Golgi}}{}}
    – crow
    Apr 5, 2014 at 17:46
  • 1
    @JimStanev Sure, it's a way for hyperref, just hyperref wasn't mentioned at all.
    – Stefan Kottwitz
    Apr 5, 2014 at 19:37

You must log in to answer this question.

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