9

I've got a custom class derived from report. I defined some standard commands inside of it to reflect its specific, so they look like:

\newcommand\contentsname{Custom Content}
\newcommand\bibname{Custom Bibname}
\newcommand\appendixname{Custom Appendix}

The problem is, when I add inputenc and babel packages which I also need, these commands become overridden with their localized versions from these packages. Of course, I can redefine the commands again in the document preamble, but I'm just curious: is there a general way to define commands which cannot be redefined later with \renewcommand in other classes?

1
  • 2
    Torbjørn points to the correct way, so putting it back into place after loading babel. If you use a modified class anyway you could also change \appendixname to \customappendixname in the class file so that it will not get modified after you load the class. I am not aware of a write-protect switch though.
    – Alexander
    May 12, 2013 at 17:14

1 Answer 1

11

Not really but you can delay your definitions hopefully after anyone else so that you win.

Your class file can use

\AtBeginDocument{%
\renewcommand\contentsname{Custom Content}%
\renewcommand\bibname{Custom Bibname}%
\renewcommand\appendixname{Custom Appendix}%
}

so then the (re)definitions will not happen until the end of the preamble. Of course other packages may delay their definitions too, so you still have to be careful of loading order.

2
  • 3
    Until someone changes the language using \selectlanguage ... May 12, 2013 at 18:38
  • @HeikoOberdiek, Torbjørn offered a solution based on this: tex.stackexchange.com/questions/82993/… (I don't know why he removed his comment). Being combined with the solution from David, it allows to define command for several languages at once.
    – Denis
    May 12, 2013 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .