Testing whether a document has option "fleqn"

Hefferon, Jim S. jhefferon at smcvt.edu
Sat May 4 00:30:49 CEST 2019


How can I test whether the document has the class option `fleqn`?  I want to have an environment that takes the place of center but that if required gives content that is left-aligned, as equations are left-aligned under fleqn.

I had in mind something like this.  However this one gives `! LaTeX Error: Can be used only in preamble.`  

\newenvironment{display}{%   
   \@ifclasswith{fleqn}{
      \trivlist \item \relax \hspace*{\mathindent}
      }{
      \trivlist \centering \item \relax
    }}{  
    \endtrivlist 
    }

I know that there are flags like \@fleqntrue and have spent some time trying toggle commands, etc, but been unable to hit on the right one.  A tip would really help me.

Thank you,
Jim

----------
... those dreadful hammers!
  --John Ruskin, 1851



More information about the texhax mailing list