1

I am using LyX 2.1 with the document class "Report". I am writing my thesis, which consists of three essays. How do I change word "Part" for each section to "Essay"?

I have not been able to find an answer to this question for LyX 2.1. I have already tried using:

\renewcommand{\partname}{Essay}

in the preamble as documented in previous StackExchange answers but they do not seem to work in the basic report class template in a fresh newfile of LyX 2.1 (I can provide an MWE if necessary).

Edit 1: one solution presented in the comment below is to use something like:

\usepackage[english]{babel}
\addto\captionsenglish{
  \renewcommand{\partname}{Essay}
}

in the preamble. This works for the basic LyX 2.1 document in the Report class. However, I have discovered that the solution breaks if using non-TeX fonts via XeTeX/LuaTeX. In the case of my essays, if one selects the "Use non-TeX fonts (via XeTeX/LuaTeX)" option and the Roman option set to "Baskerville Old Face" the solution breaks down.

Edit 2: With only a slight modification, the code above works for any choice of fonts. Use the following:

\AtBeginDocument{\addto
\captionsenglish{ \renewcommand{\partname}{Essay}}}
mlachans
  • 103
  • 3
    LyX generally adds babel by default, so there is a small difference in the process (http://tex.stackexchange.com/questions/82993), see http://tex.stackexchange.com/questions/112391/how-to-change-bibliography-to-webography-in-lyx-2-0-2/112455#112455 – Torbjørn T. Sep 01 '14 at 17:19
  • 1
    Works fine here, with \AtBeginDocument{\addto\captionsenglish{ \renewcommand{\partname}{Essay}}} in the preamble. – Torbjørn T. Sep 01 '14 at 18:30
  • The key line appears to be the \AtBeginDocument{}, at any rate this worked and the question is closed. – mlachans Sep 01 '14 at 18:47
  • Yes, as I say in the last question I linked to in my first comment. It was perhaps misleading to add the link in parentheses as well, sorry about that. – Torbjørn T. Sep 01 '14 at 18:49
  • Yes, I was (and still am) not clear why \AtBeginDocument{} becomes necessary when using non-TeX fonts so I was hesitant to try that particular variation of \renewcommand until a few moments ago. It was my error. – mlachans Sep 01 '14 at 18:52
  • It really doesn't have anything to do with which fonts you use, you get the same problem when not using non-TeX fonts (unless you explicitly add \usepackage[english]{bibtex} to the preamble). The \addto and \captionsenglish commands are defined by the language package (babel or polyglossia), and if they are used before the \usepackage{<lang-pack>} you'll get an error. LyX adds that \usepackage line after the commands in the user preamble, causing the problem. So you could add \usepackage{polyglossia} instead of using \AtBeginDocument{}, [...] – Torbjørn T. Sep 01 '14 at 20:50
  • [...] but then you're loading packages twice, and if you turn off use non-TeX fonts, you'll get an error unless you explicitly use XeTeX/LuaTeX when generating the PDF. – Torbjørn T. Sep 01 '14 at 20:50

0 Answers0