I tried creating my own class based on amsart, like this one:

% file: myamsart.cls

However, the option fleqn has no effect:

% file: test.tex

\[ x = x \]
  y = y

Why does it work like this?

More generally, what is the difference between passing options with \documentclass and passing them with \LoadClass? Is there a general method to load a base class from cls file with the same effect as when using \docementclass?

  • Note that the fleqn option in amsart is implemented rather strangely. The declared option does nothing. – daleif Nov 15 '18 at 10:46
  • What do you mean by "does nothing"? It works with \documentclass[fleqn]{amsart}. – Alexey Nov 15 '18 at 10:49
  • 1
    Look in amsart.cls and you'll find \DeclareOption{fleqn}{}, but it does something "strange" with it later on in a non standard manner. – daleif Nov 15 '18 at 11:17
  • @daleif, "but it does something "strange" with it later on in a non standard manner" -- i think, i have to agree. – Alexey Nov 15 '18 at 13:43
  • kindly observe that amsart.cls was first written before 1995, and has been used in a production capacity since then. it wasn't designed to have options passed to it except through the option to the main \documentclass line, since nobody expected it to be used that way (really, that wasn't how things like this were thought of in 1995). there are numerous classes that \LoadClass{amsart}; all of them that i know of expect the fleqn option to be specified on the \documentclass line. it's too late to change that. – barbara beeton Nov 16 '18 at 1:22

The fleqn option to amsart actually does nothing at \ProcessOptions time, because of


The class uses a nonstandard way to set and use options. You can hack it by adding the option yourself.

\expandafter\g@addto@macro\csname opt@myamsart.cls\endcsname{,fleqn}

The first \g@addto@macro forcibly adds fleqn to the list of options myamsart.cls is loaded with, so as to make the tests \@ifclasswith{\@classname} follow the “true” branch. The second \g@addto@macro forcibly adds fleqn to the global options, so also amsmath (and all other packages) will see and honor it.

| improve this answer | |
  • Could you explain a bit, please, how this hack works, or at least give links or references to documentation? – Alexey Dec 15 '18 at 20:35
  • @Alexey Added some explanations – egreg Dec 15 '18 at 22:44
  • @Alexey Yes, sorry for the typo – egreg Dec 16 '18 at 1:05
  • Thanks. To make your answer complete, could you add some link to an explanation of the difference between options of a class and global options? For example, this one, but maybe you know better. – Alexey Dec 16 '18 at 9:05


| improve this answer | |
  • Indeed, this has some effect, but not the same as when just using \documentclass[fleqn]{amsart}. – Alexey Nov 15 '18 at 11:00
  • Why passing options with \documentclass is not equivalent to passing them with \LoadClass? – Alexey Nov 15 '18 at 11:03
  • 1
    @Alexey documentcass options are global and seen by all packages, but if you use options to LoadClass the options are just passed to the class, so you are relying on the class to pass on the option to any packages rather than using the global option mechanism. – David Carlisle Nov 15 '18 at 11:32
  • 1
    you can use \LoadClassWithOptions{amsart} and then \documentclass[fleqn]{myamsart} – user2478 Nov 15 '18 at 11:48
  • @Herbert, it is more crazy than this. After glancing at amsclass source documentation and a bit of experimenting, i observed that simply using \documentclass[fleqn]{myamsart} in my example makes the option have its effect. No need to change my myamsart.cls, no need to pass any options to amsart or to use \LoadClassWithOptions. This is not what i wanted and not how a class interface should work IMHO. – Alexey Nov 15 '18 at 13:48

After being prompted by daleif, I glanced into amscls source documentation, and noticed that the actual behaviour of fleqn option is implemented starting with


Having already experimented with different combinations of commands and options proposed by Herbert, I decided to be bold and to simplify my myamsart.cls to


and then to use it with


This produced flushed left equations exactly as when using \documentclass[fleqn]{amsart}. (However, this is not what I wanted to do, because I did not want to pass any options to myamsart.)

| improve this answer | |
  • IMHO, this is not how a class interface should work. – Alexey Nov 15 '18 at 14:34

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.