I am trying to create a file which includes common packages and macros I use. It is something like this.



 ... other packages and macros

But some packages clash with each other in combinations. For example when I try to use


It gives error since IEEEtran already created command appendix.

I would like to get some solution to this problem something like below.

if document class is not IEEEtran 
end if

A way is


But I believe that documents written for submission should not have any reference to conflicting packages (and so tricks like this one). How would you use the commands provided by appendix if the document class is IEEEtran?

  • 1
    I do not plan to use appendix commands in this conference submission , but I use that commands in my thesis. – Atilla Ozgur Feb 29 '12 at 10:51

I was advised once to test on functionality rather than on class name. The problem is that both appendix.sty and IEEEtran.cls defines \appendices. So only load the appendix package if there isn't already a command \appendices defined. Here is a working example:

\title{Test of conditional use of the appendix package}
\usepackage{lipsum} % just for dummy text
\ifcsname appendices\endcsname
  % do nothing










\ifcsame is available on all e-TeX builds and is documented (along with other ways to check if a command is defined) here.

  • This will do nothing for all classes that define \appendix, including article, report, book, memoir. – egreg Feb 29 '12 at 22:23
  • @Matthew: Please something is wrong with your use of \ifcsname! – Ahmed Musa Mar 1 '12 at 2:22
  • @egreg: I thought that's what the OP wanted. He said the problem was the existence of the command \appendix. After creating a MWE I see that's not the problem: it's the existence of the command \appendices. I've updated my answer so that appendix.sty is loaded in article.cls, etc. – Matthew Leingang Mar 10 '12 at 12:32
  • @AhmedMusa: Yes, I was missing \endcsname. Thanks for noticing. – Matthew Leingang Mar 10 '12 at 12:32

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.