5

I need to translate some reserved word of paragraph environment to my own language; like Chapter, Table of Content, Example, Bibliography, and some more. How do I achieve that? I'm using LyX in Linux. Book document class.

  • 1
    Which language? For most languages, just go to Document->Settings->Language, select your Language from the dropdown-box and a respective Language package (usually Bable). – Daniel Jun 14 '13 at 9:10
  • I agree with Daniel. Do you want it translated in the LyX output or the PDF output or both? – scottkosty Jun 14 '13 at 20:27
  • Well its a local region not national language so it is not on the list – Nur Jun 15 '13 at 7:06
  • 1
    If you're not using Babel, just see here: tex.stackexchange.com/q/82993 The relevant commands should be placed in the preamble. If you're using Babel, see the second part of this answer of mine. – Torbjørn T. Jun 17 '13 at 17:48
  • If the comment by @TorbjørnT. solved your problem, please say so. He will post it as an answer and you can accept it. If it did not solve your problem, update your question to explain why. – scottkosty Jun 18 '13 at 1:36
3

The general answer to this question is found in How to change the name of document elements like "Figure", "Contents", "Bibliography", "Appendix", etc.?, the relevant commands from that question can be added to the preamble, in Document --> Settings --> LaTeX preamble.

There are, however, a couple of things that need to be taken into account in LyX, if babel is used in the document:

Loading order

When LyX generates the complete preamble for the LaTeX file, it loads babel after the custom commands added by the user, in the document settings. As a result, if one adds e.g. \addto\captionsenglish{... it won't work, because those are commands defined by babel.

To circumvent this problem, one can use \AtBeginDocument to postpone the redefinitions to the position of \begin{document}, i.e. after the preamble, as mentioned in How to change bibliography to webography in lyx 2.0.2?. Hence, instead of e.g.

\addto\captionsenglish{%
 ...
}

use

\AtBeginDocument{%
  \addto\captionsenglish{%
    ... 
}}

I suppose that adding \usepackage{babel} to the Document --> Settings --> LaTeX preamble before the redefinitions is another option, but then babel is loaded twice.

Language name

In some cases, at least for Indonesian, the language name used in the LaTeX code is not the same as specified in the LyX document settings. When choosing Indonesian in the document settings, the name passed to babel is bahasa. This can be checked by looking at the complete source code generated by LyX, and checking the optional arguments for the document class, which is in the first line of code. With the default settings for the book class, and Indonesian as language, that line looks like

\documentclass[oneside,bahasa]{book}

Therefore, instead of

\AtBeginDocument{%
  \addto\captionsindonesian{%
    ... 
}}

you need

\AtBeginDocument{%
  \addto\captionsbahasa{%
    ... 
}}

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.