2

Hello I am trying to use the following class (yReport.cls) from this link https://github.com/HarveySheppard/yLaTeX

I am using MikTex 2.9 and I have installed the relevant packages, fonts and cls files. Unfortunately the following error comes and I do not know how to fix it:

! LaTeX error: "xparse/command-already-defined"
! 
! Command '\FA' already defined!
! 
! See the LaTeX3 documentation for further information.

This error comes up when loading the following code which is the minimal amount of code required for the layout to work:

\documentclass[french]{yReport}

\author{Your name}
\subtitle{Subtitle}
\title{Title}
\hypersetup{
    pdftitle={Title},
    pdfsubject={Subject},
    pdfauthor={Your name},
    pdfkeywords={{keyword 1}{keyword 2}},
}

\makeatletter
\let\runauthor\@author
\let\runtitle\@title
\makeatother

\begin{document}
    \titleTwo
\end{document}
  • 1
    Please add a minimal (non) working example (MWE), that illustrates your problem. – NBur Sep 30 '18 at 14:08
  • Added a not working example – sab hoque Sep 30 '18 at 14:10
  • There is no problem when rendering using XeLaTeX or pdfTeX. The word Lorem appears as it should – sab hoque Sep 30 '18 at 14:20
  • 1
    Try \documentclass{article}\usepackage[marginIcons]{infoBulle}\usepackage{fontawesome}\begin{document}Lorem\end{document}? – moewe Sep 30 '18 at 14:21
  • 1
    Good. I suspect infoBulle defines things that fontawesome defines, so the definitions clash. – moewe Sep 30 '18 at 14:23
6

The problem can be reproduced with

\documentclass{article}
\usepackage{infoBulle}
\begin{document}
Lorem
\end{document}

You'll need infoBulle.sty from https://github.com/HarveySheppard/yLaTeX/tree/master/yPackages/infoBulle and yMainColor.sty from https://github.com/HarveySheppard/yLaTeX/blob/master/yPackages/yMainColor/ to run the code.

A short investigation reveals that infoBulle.sty not only loads the fontawesome package (in line 44), but it also issues

\newfontfamily{\FA}{FontAwesome}

later on in line 115.

At that point, however, fontawesome has executed that same line itself and we get an error.

It seems to me that infoBulle.sty is wrong in using \FA with \newfontfamily for FontAwesome when fontawesome is already loaded. This should be reported to the infoBulle maintainer (https://github.com/HarveySheppard/yLaTeX/issues/8). The maintainer has responded quickly and a fixed version is available on GitHub.

In the meantime the easiest, but also dirtiest, fix is to edit your local copy of infoBulle.sty and to remove (or comment out) the \newfontfamily{\FA}{FontAwesome} in line 115.

sab hoque's investigations show that the problem did not occur with older versions of fontspec. And indeed the fontspec documentation explains

[\newfontfamily, \setfontfamily, \renewfontfamily] These commands define new font family commands (like \rmfamily). The new command checks if ⟨cmd⟩ has been defined, and issues an error if so. The renew command checks if ⟨cmd⟩ has been defined, and issues an error if not. The set command never checks; use at your own risk.

NEW: In previous versions of fontspec, only \newfontfamily was provided, but it behaved like \setfontfamily. You’ll have to update your code slightly if this now causes problems; apologies.

So in older versions of fontspec the \newfontfamily in infoBulle would simply overwrite the default in fontawesome, but now the two \newfontfamilys with the same name clash and generate an error.

  • I found out the problem. So essentially in earlier editions of fontec, \newfontfamily worked fine but in the current version it has to be replaced with setfontfamily. Your answer unfortunately is unable to render anything while using the infoBulle package but changing it to setfontfamily makes everything work fine. Thanks for the help – sab hoque Sep 30 '18 at 16:41
  • @moewe You are absolutely correct about the new command \setfontfamily. I changed the package code. Everything should now be working – HarveyShepp Oct 1 '18 at 1:57
  • This is very late but removing \newfontfamily{\FA}{FontAwesome} from line 115 causes some other features to not work/render correctly, anyhow for any new viewers I would recommend downloading the new version from the appropriate github page – sab hoque Mar 26 at 4:12
  • @sabhoque Mhhh, since the fontawesome package executes a similar line, removing it should not affect functionality that much. But I'm afraid that I can't say anything without a short MWE that reproduces a loss in functionality here. – moewe Mar 26 at 4:40
1

The problem resides in the newer version of fontec. I added the following line

\usepackage{fontspec}

at around line 43 or so. I also changed \newfontfamily{\FA}{FontAwesome} to \setfontfamily{\FA}{FontAwesome} Now it works as it should. Also LuaLaTeX should be used instead of XeLaTeX

  • Do you mean fontspec instead of fontenc? fontenc should not be used with XeLaTeX or LuaLaTeX. – moewe Sep 30 '18 at 16:48
  • opps yes i meant fontspec – sab hoque Sep 30 '18 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.