LaTeX forum ⇒ Document ClassesToC garbled in revtex4-1. What the Hell !? Topic is solved

Information and discussion about specific document classes and how to create your own document classes.
User avatar
Posts: 901
Joined: Sat Apr 02, 2011 4:06 pm

ToC garbled in revtex4-1. What the Hell !?

Postby Cham » Fri Dec 01, 2017 2:09 pm

Thanks Johannes. I find it weird that this class has a French translation for all the document, except its ToC title!

Is it possible that the translation is actually done internally by some general code in LaTeX, and not the revtex4-1 class itself ? It may explain why some specific parts ("Contents") may not be translated.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9403
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Dec 01, 2017 2:21 pm

Translation by packages, such as babel and polyglossia, relies on standard text macro names, such as \contentsname. Unfortunately, revtex4-1 uses non-standard names, such as \tocname, \lofname, and \lotname. The translation packages cannot guess non-standard names.

Site admin

User avatar
Posts: 901
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Fri Dec 01, 2017 2:30 pm

Thanks Stefan. So the command I added to translate the ToC title is the natural way to do it, in this case. A -1 for the revtex4 class!

But then my goal is achieved : I successfully made an almost complete template for each major class : article, book, memoir, paper, report, revtex4, scrartcl, scrbook, scrreprt.

The only thing missing is a customization of the header. I don't know yet if I'll add this. I may start a new topic in the following days about the best way of creating an header for the "pesky" classes.

User avatar
Site Moderator
Posts: 4038
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Dec 01, 2017 7:22 pm

I have no idea why you need all those classes.
article is for articles. As is scrartcl.
report, book, scrbook and scrreprt just add a chapter command on top of that (roughly speaking)
revtex is for contributions for a special journal.
memoir does the same as article, report, book and its KOMA equivalents (implementation is different)

paper .... honestly, i never heard of this class before you came up with it.

Concerning headers and footers -> ... er-scrpage

memoir has built in macros to do the job, but probably scrlayer-scrpage will work just fine as well with memoir.

To sum it up: the main classes (including KOMA and memoir) all do the very same job. Just the default layout is a bit different and easy to adjust.

So the command I added to translate the ToC title is the natural way to do it, in this case.

This is the intended interface. Without this, you would have to patch far far far more complicated macros. The way revtex does it, is actually kind of smart. Just not standard.
  1. \def\tocname{\contentsname}
works for every langauge known to the babel package.

Short trip into history:

You may want to know why so many different classes exist in the first place? LaTeX evolved, when people installed a TeX distribution on university mainframes using floppy disks. A bit later, the internet came around, but installing TeX was just as hard. Support was done on mailing lists and newsgroups. If someone saw a need for something, he created a new class or package, making it available for everybody by putting it on CTAN. The LaTeX kernel (the basic set of LEGO bricks) is maintained by a small group of people. On the other hand, over 2000 people created more than 5000 packages (including classes) that extend basic LaTeX by adding extra bricks or creating classes like revtex that serve a limited purpose, i.e. creating bricks that play not well with other contributed bricks. ... -star-wars
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Posts: 901
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sat Dec 02, 2017 12:09 am


I need all these classes "templates", ready for use, for various works.

One day, I'll have to write a book (I already have done it two times in the past, all from scratch). I'll then have a template ready for use and I'll just have to fill it without rebuilding the whole preamble.

Another day, I'll have a small paper-like document to write. I already have a template to use with all the basic functions defined in my preamble (packages and macros). I know in advance the kind of heavy stuff I'll do (physics, with lots of equations, tables and figures). So my new templates already have all the proper packages declared in the preamble, and I will not have to recreate the files from scratch, for various styles (i.e. several classes).

For a book, I would also want to have some choices of style (book and scrbook classes). Same thing for small article-like documents.

This is why I created a large set of "shell-like" documents, with everything already defined in their preamble. I just have to fill the documents now without worrying about a new preamble from scratch.

The templates have been tested and they are now all working perfectly. I just have to add some general code for an optional header.

Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 1 guest