I'm dealing with a problem at my headings which I can't figure it out. I'm writing a thesis (book document class) and the main language is Greek. At almost all pages headings are working great and are in Greek, but when I have to change the language to English so I can quote some source code (and the code is more than 1 page, or is changing page) the header that is "between" that code is in English
So in all document 2-3 headers are in English an all others in Greek. How can I define the header's language so that it won't be interfered by the text inside my document???
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
I have apparently the same problem as yours (with Hebrew/English/French) in a complex document. That's how I found your post (probably well too late, but hopefully this may be of interest anyway...)
Unfortunately I haven't succeeded in solving it in a completely satisfactory way. But it may be sufficient for your purposes: protect the language in the header by adding \selectlanguage{greek} if you want to force latex to write the header in Greek. For instance, in my case, I am using the package fancyhdr, I wrote
\fancyhead[CO]{\selectlanguage{french}CHAPITRE \thechapter: LA
P\'ERIODE ANTIQUE} \fancyhead[CE]{\selectlanguage{french}LA
JUSTIFICATION DE LA LOI} \fancyhead[RO, LE]
{\selectlanguage{french}\thepage}
This solved the language problem: all headers for that chapter are now in French. However, this did not solve it completely because Hebrew is a right to left language and the layout is the mirror opposite of what I want it to be. Any suggestion, anyone ?
Since Greek is a left to right language, this solution might work in your case.
[Other than that, you can manually check the pages where the language of the header changes and make sure that the page change occurs at "the right language". This removed most of my "wrong" headers. Since the way Latex decides the layout is not obvious, it seems difficult to produce a minimal example.]
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p