[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-users
Subject:    Re: changing fixed names 'Contents', 'List of Figures', etc. <Maybe solved>
From:       Guenter Milde <milde () users ! sf ! net>
Date:       2012-05-29 7:22:35
Message-ID: jq1tfr$a3o$1 () dough ! gmane ! org
[Download RAW message or body]

On 2012-05-29, Steve Litt wrote:
> On Tue, 29 May 2012 00:03:08 +0000 (UTC), ddiedrichs said:

>> I cannot change the default strings 'Contents', 'List of Figures',
>> etc. that are generated as titles of these sections.  I have tried
>> putting in the preamble commands of the type:

>> \renewcommand{\contentsname}{Table of Contents}

>> But nothing works.  I am typing in English without the babel package.

Are you sure you do not use the babel packge? LyX uses it by default. 
What does the View>Source window show when you tick the "show complete
source" box? (You can also export your example to LaTeX and play with
it.)

I am asking, because the minimal LaTeX example

  \documentclass[english]{article}
  % \usepackage{babel}
  
  \renewcommand{\contentsname}{Table of Contents} 
  
  \begin{document}
  
  \tableofcontents
  \section{test the best}
  
  \end{document}

works as you expect (showing "Table of Contents" as contents heading in
the output).

> I reproduced your symptom in an article based document, putting
> \renewcommand{\contentsname}{Table of Contents} in the document
> preamble, as you would expect it should be. Like you, my document
> continued to print the table of contents title as "Contents". So then I
> exported to LaTeX, fooled around with it, and discovered it works only
> if \renewcommand{\contentsname}{Table of Contents} is in the document
> itself, not the document header.

The usual trick in these cases is \AtBeginDocument. Indeed, replacing
renaming \renewcommand{\contentsname}{Table of Contents} with:

 \AtBeginDocument{\renewcommand{\contentsname}{Table of Contents}}

works also with babel as expected.

> So I went back into LyX, removed \renewcommand{\contentsname}{Table of
> Contents} from the document preamble, and put it in an ERT before the
> Table of Contents, and it did the right thing.

No need for ERT with \AtBeginDocument.

Günter

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic