LaTeX forum ⇒ Document Classesrevtex4-1 style for French articles ? Topic is solved

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

revtex4-1 style for French articles ?

Postby Cham » Sun Nov 26, 2017 6:18 pm

I like pretty much the stylings in the revtex4-1 class, but there's some aesthetical glitches with the figures and tables captions for a French document, and there are some restrictions on its customization. I'm getting this typical warning during compilation :

Package frenchb.ldf Warning: Figures' and tables' captions might look like
(frenchb.ldf) `Figure 1:' which is wrong in French.
(frenchb.ldf) Check your class or packages to change this;
(frenchb.ldf) reported on input line 17.


Here's a MWE code showing that class and a few options :
  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[11pt,nofootinbib,eqsecnum,twosides]{revtex4-1}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage[french]{babel}
  6. \usepackage{amsfonts}
  7. \usepackage{amsmath}
  8. \usepackage{amssymb}
  9. \usepackage{graphicx,xcolor}
  10. \usepackage{here}
  11. \usepackage{hyperref}
  12. \usepackage{subfigure}
  13.  
  14. \begin{document}
  15.  
  16. \title {Some article title in French}
  17.  
  18. \author{Some Guy}
  19. \email{email@somewhere.ca}
  20. \affiliation{Some departement}
  21.  
  22. \begin{abstract}
  23.  
  24. Some French text.
  25.  
  26. \end{abstract}
  27.  
  28. \maketitle
  29.  
  30. \section{Introduction}
  31.  
  32. Some introduction.
  33.  
  34. \section{Some title}
  35.  
  36. Something here.
  37.  
  38. \begin{figure}[htbp]
  39. \centering
  40. \subfigure[Description 1.]{\includegraphics[width=0.4\textwidth]{example-image-a}}
  41. \qquad
  42. \subfigure[Description 2.]{\includegraphics[width=0.4\textwidth]{example-image-b}}
  43. \caption{Some description.}
  44. \label{ }
  45. \end{figure}
  46.  
  47. \section*{Remerciements}
  48.  
  49. A few thanks.
  50.  
  51. \begin{thebibliography}{999}
  52.  
  53. \bibitem{bibitem1}
  54. A.~Someone \& B.~Someonelse, ``Titre de l'article 1'', Found.\ Phys.\ \textbf{11}, no. 8, 299 (2037).
  55.  
  56. \bibitem{bibitem2}
  57. C.~Someone \& D.~Someonelse, ``Titre de l'article 2'', Phys.\ Rev.\ D \textbf{12}, 103522 (2052).
  58.  
  59. \end{thebibliography}
  60.  
  61. \end{document}


I know that the revtex4 class has a few severe restrictions for the customization, since it's a specific class designed for publications in some English journals. So is there another class that do the same stylings (adapted for a French article), without all the restrictions, and without recreating all of it from scratch using the paper or the article class? It would be a pain in the arse to redo all the same styling as customization of another class.

I'm expecting that the answer is "no", and that I'll have to customize another class all from scratch, but maybe I'm wrong.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Nov 27, 2017 11:35 am

Hi Cham,

if you know what style details have to be changed, it can be redefined one by one. I guess it's more than just the figure numbers.

Stefan
Site admin

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

Postby Cham » Mon Nov 27, 2017 3:58 pm

Stefan,

apparently, the revtex class doesn't adapt the Figures and Tables ":" (after the number) to the language. I don't know if there are other things "frozen" in the code. I also get these weird warnings in the compilation console :

  1. Class revtex4-1 Warning: Repair the float package.
  2.  
  3.  
  4. LaTeX Warning: Unused global option(s):
  5. [twosides].


and while I don't even use \it, I get this (probably from one of the packages in the code I gave above) :
  1. Package nag Warning: Command \it is an old LaTeX 2.09 command.
  2. (nag) Use \itshape or \textit instead on input line 31.


I don't want to recreate all the titles styles and format with another class. I guess it may be easier (?) to fix the few wrong things than recreate all the rest.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Nov 27, 2017 4:36 pm

Hi Cham,

I guess you mean that in French there's an additional space before the :. You can change it this way:

  1. \makeatletter
  2. \renewcommand*{\@caption@fignum@sep}{ : }
  3. \makeatother


Regarding the other warnings:

  • change twosides to twoside
  • "Repair" is meant as "Repairing" and actually means that revtex is patching the float package macros successfully.

The nag warning appears because revtex4-1 uses \it internally. You can fix it by

\renewcommand*{\frontmatter@affiliationfont}{\normalfont\itshape}

as above, after \makeatletter.

Stefan
Site admin

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

Postby Cham » Mon Nov 27, 2017 5:43 pm

It's all working great. Thanks Stefan.

But I thought that the revtex class was internally very "frozen", without much possibilities for customization. I'm now wondering what other problems I may encounter with it, if I start using this class. I remember having a problem with commas and the icomma package before. Maybe I should stay with the standard classes instead. :?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Nov 27, 2017 6:01 pm

It's just LaTeX, so anything can be redefined and customized. It just doesn't provide such a great interface like KOMA-Script classes or memoir. And, since packages are usually written and tested with standard classes, it can be possible that some may not be compatible with revtex definitions. But, changes and "hacks" are no problem.

Stefan
Site admin

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

Postby Cham » Mon Nov 27, 2017 6:18 pm

You're now giving me the impression that I just scratched the surface of classes in LaTeX. I extensively used the usual "book", "article", "paper" and a few others before, which fit my usual needs. But I like to play and experiment with other possibilities, and I now suspect that I didn't used the optimal classes for what I need to do. I don't know any of the KOMA classes.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Nov 27, 2017 6:37 pm

Oh, yes. For me,

  • komascript: is the new and modern standard
  • memoir: is similar regarding capabilities, but not modular, directly includes package functions (like copying) so hardly can stay up-to-date
  • base classes: for me not standard any more, I rather call them base classes, and they are in the base directory of the TeX tree. They did not change since 10 years or more.

So base classes are ok for examples in forums for testing and sharing ;-) but not if you would like to use the modern benefits of LaTeX - in that case either use base classes with 50 packages on top, or KOMA-Script classes that are modular and developed continuously throughout the last many years.

KOMA-Script classes can be used like standard classes, so they are somehow backwards compatible, just with different default layout. But, there's a base compatibility mode if one still likes the fat, serif headings. ;-) I remember, when I started with LaTeX, I hesitated to deal with KOMA-Script since it appeared to me like I would have to learn something different. But it turned out that I can use it like standard classes but with many optional settings via key=value instead of complicated redefinitions and patches. A lot of customizations, requiring macro programming or using packages, is just a simple key=value setting in KOMA-Script. So, one could go ahead and use it (scrbook instead of book, etc.), and just use the scrguien manual as a reference. Though it's good stuff for reading.

Stefan
Site admin

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

Postby Cham » Mon Nov 27, 2017 8:34 pm

Stefan,

while not exactly related to the topic, I started creating a folder of examples documents for all the main classes, and I noticed that the "paper" and "revtex" (not "revtex-1") classes also have a problem with French version of its Figures and Tables numbers (with the spacing before ":"). The code you gave above do not work :

  1. \makeatletter
  2. \renewcommand*{\@caption@fignum@sep}{ : }
  3. \makeatother


What would be the proper modification to solve this issue, for the paper and revtex classes ?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Tue Nov 28, 2017 12:33 am

Everything can be redefined or patched.

With paper:

  1. \usepackage{etoolbox}
  2. \makeatletter
  3. \patchcmd{\@makecaption}{#1:}{#1 :}{}{}
  4. \makeatother


revtex: do you really want to patch a class or package from the stone age? ;-) Perhaps continue with revtex4-1 or revtex4, otherwise I need to see that old revtex.cls or revtex.sty file to patch...

Stefan
Site admin


Return to “Document Classes”

Who is online

Users browsing this forum: Google [Bot] and 5 guests