1

I'm currently in the process of moving from LaTeX to ConTeXt. Looks promising, in particular the huge amount of freedom in page layout design you gain with ConTeXt.

Of course, this freedom does have its cost -- loads of new setup commands to cope with... An it's surprisingly difficult to search for ConTeXt-related information 'cause "context" is such a common word that relevant hits often just get lost in an overwhelming flood of unrelated results which, by chance, also bear the word "context" in a different, well, context. ;)

One thing I'm currently struggling with is teaching ConTeXt to print the word "Chapter " in the header area, with "Chapter" being automatically replace by the corresponding word in the current document language. More precisely, I'd like to have "Chapter " on even and the chapter name on odd pages. I managed to get the chapter number at the desired place using

\setupheadertexts%
[][chapter][{\somenamedheadnumber{chapter}{current}}][]

but I just can't figure out how to automatically print "Chapter " in a language-dependent manner.

Any help apprecieted!

Cheers --

Torsten

9
  • 1
    You can set language dependant texts with the \translate command, e.g. \translate[en=Chapter,de=Kapitel,fr=Chapitre]. Apr 30, 2017 at 8:26
  • I see, thanks... But in ConTeXt, there are already built-in translations for words like "Chapter" -- isn't it possible to make use of those instead of providing your own translations? Apr 30, 2017 at 8:56
  • I have posted an (unsatisfactory) answer. I will ask this on the mailing list as well. Apr 30, 2017 at 9:34
  • ConTeXt stores language dependent strings for chapter and section but it doesn’t create label texts for them. Apr 30, 2017 at 9:35
  • Link to my crosspost: mailman.ntg.nl/pipermail/ntg-context/2017/088627.html Apr 30, 2017 at 9:39

1 Answer 1

2

I'm absolutely sure there is a better way to access this, but for now this is the best I could get.

\def\chaptername{%
  \ctxlua{%
    context(languages.data.labels.texts.chapter.labels["\currentlanguage"])}}

\setupheadertexts%
  [\chaptername] [chapter]
  [{\somenamedheadnumber{chapter}{current}}] []

\starttext

\mainlanguage[de]

\startchapter[title=Knuth]
  \input knuth
\stopchapter

\startchapter[title=Zapf]
  \input Zapf
\stopchapter

\stoptext
1
  • Henri, since no further suggestions came in (not even on the mailing list you cross-posted on) I accept your answer. Thanks for your help! May 2, 2017 at 18:43

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.