Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

latex class structure

45 views
Skip to first unread message

Tim

unread,
Oct 31, 2012, 3:09:36 PM10/31/12
to
I have a custom class that is based on the memoir class. My question is when should I load memoir? My current structure is:

LoadClass[some options]{memoir}

RequirePackage{several lines of packages}
newcommands defined
newifs defined

DeclareOptionX{lots of options defined} % (using xkeyval)
ProcessOptionsX

memoir settings defined
more local macros defined

Now I find I need to create a new option and pass it to memoir, so I'll have to move its loading to after my option processing.

Is there any rule about the order in which these things are done? In hindsight I guess that option processing should generally come first.

Any rules of thumb about setting up class structure, esp when loading another class?

thanks,
--Tim Arnold

Robert Heller

unread,
Oct 31, 2012, 4:54:02 PM10/31/12
to
It is basically a programming 101 issue: if <some code> depends on
<some other code> then you really need <some other code> available (eg
loaded or declared or whatever) before <some code> gets run (or
defined or whatever). I would suspect that the options processing
really needs to occur before anything else, and then any dependent
classes and/or packages, and finally all of your newcommands, newifs,
and macros (although some or all of the newifs will probably be defined
when the options are processed)

>
> thanks,
> --Tim Arnold
>

--
Robert Heller -- 978-544-6933 / hel...@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments


Dan Luecking

unread,
Oct 31, 2012, 5:19:33 PM10/31/12
to
On Wed, 31 Oct 2012 12:09:36 -0700 (PDT), Tim <jtim....@gmail.com>
wrote:
Use
\DeclareOption{memoiroption}{\PassOptionsToClass{memoiroption}{memoir}}

Then load memoir after option processing, i.e., after \ProcessOptions
and/or \ExecuteOptions.

Or, to pass all options you have not otherwise declared:
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}


Dan
To reply by email, change LookInSig to luecking

Philipp Stephani

unread,
Nov 1, 2012, 4:03:25 PM11/1/12
to
Dan Luecking <Look...@uark.edu> writes:

> Or, to pass all options you have not otherwise declared:
> \DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}

Or use \LoadClassWithOptions{memoir} to automatically pass all class
options to memoir (but see sections 4.2 and 4.5 of clsguide.pdf for
important differences between these approaches).

Tim Arnold

unread,
Nov 1, 2012, 12:15:59 PM11/1/12
to
Hi Dan,
That is what I had in my mind, but only 'fuzzily'. Thanks for the
explicit example--it is exactly the kind of info I was looking for.

thanks,
--Tim

0 new messages