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

Taking only \openany and \openright from Memoir

569 views
Skip to first unread message

Olaf Marzocchi

unread,
Mar 4, 2007, 6:19:31 PM3/4/07
to
Today I tried to take only the \openany and \openright commands from
the memoir class, to change how chapters start inside the document,
but I failed.
Could you explain me the error?

I took the following lines from memoir.dtx and put them inside a
\makeatletter and \makeatother, in my preamble:

% \subsection{The openright, openleft and openany options}
%
\DeclareOption{openright}{\@openrighttrue}
\DeclareOption{openany}{\@openrightfalse}
\DeclareOption{openleft}{\@openlefttrue}
%
% Commands that can be used to change the option in the middle of the
% document\footnote{Openleft provided to meet a request by
% Vladimir G.~Ivanovic (\texttt{vlad...@acm.org}) in September
2001.}.
\newcommand{\openright}{\@openrighttrue\@openleftfalse%
\gdef\clearforchapter{\cleartorecto}}
\newcommand{\openany}{\@openrightfalse\@openleftfalse%
\gdef\clearforchapter{\clearpage}}
\newcommand{\openleft}{\@openlefttrue
\gdef\clearforchapter{\cleartoverso}}

% A repeat of |\cleardoublepage|; clears to a recto (odd-numbered)
page.
\def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}\thispagestyle{cleared}%
\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

\def\cleartoverso{\clearpage\if@twoside
\ifodd\c@page\hbox{}\thispagestyle{cleared}%
\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}


I get the following error:

! LaTeX Error: \RequirePackage or \LoadClass in Options Section.
The package `' is defective.
It attempts to load `ragged2e' in the options section, i.e.,
between \DeclareOption and \ProcessOptions.

Why is it? I didn't even use that new options!


Thank you for your help!
Olaf Marzocchi

Lars Madsen

unread,
Mar 5, 2007, 4:19:56 AM3/5/07
to

I would think that you cannot specify \DeclareOption in the preamble of a
document. That has to go in a package or a class.

what exactly is it you are trying to do?

--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl

Olaf Marzocchi

unread,
Mar 5, 2007, 5:00:44 AM3/5/07
to
> I would think that you cannot specify \DeclareOption in the preamble of a
> document. That has to go in a package or a class.
>
> what exactly is it you are trying to do?

My goal is to change the way chapters start: in the first part of the
document I want chapters (LoT, LoF, Preface, Foreword) to start on the
next page, while in the second part of the document I want chapters to
start on the next recto (odd) page.
I specified openright in the documentclass options, but I need to
switch to openany in the first part of the document and then switch
back.

Update: I tried to remove the first lines, with \DeclareOption, and it
compiles ok, but when I try to use \openany in the document, I get an
error about @openrighttrue. I copied also the code about it and it
works! Follows the code to introduce \openany, \openright, \openleft
in any preamble, without comments.
Could someone check for hidden bugs? (I copied it without
understanding it completely)


\makeatletter

\newif\if@openleft
\@openleftfalse
\newif\if@openright
\@openrighttrue

\newcommand{\openright}{\@openrighttrue\@openleftfalse


\gdef\clearforchapter{\cleartorecto}}
\newcommand{\openany}{\@openrightfalse\@openleftfalse

\gdef\clearforchapter{\clearpage}}
\newcommand{\openleft}{\@openlefttrue
\gdef\clearforchapter{\cleartoverso}}

\def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else


\hbox{}\thispagestyle{cleared}%
\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\def\cleartoverso{\clearpage\if@twoside
\ifodd\c@page\hbox{}\thispagestyle{cleared}%
\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

\makeatother


That's all.

Olaf

Lars Madsen

unread,
Mar 5, 2007, 5:19:02 AM3/5/07
to
[snip]

I still don't see the need for redefining stuff

\documentclass[a4paper]{memoir} % openright is the default

\begin{document}

\openany

\frontmatter

\tableofcontents*

\listoffigures

\chapter{preface}

text

\chapter{intro}

text

\openright
\mainmatter

\chapter{main text}

\begin{figure}
\rule{5cm}{5cm}
\caption{a figure}
\end{figure}

\chapter{next chapter}

\end{document}

Olaf Marzocchi

unread,
Mar 5, 2007, 5:54:05 AM3/5/07
to
> I still don't see the need for redefining stuff
>
> \documentclass[a4paper]{memoir} % openright is the default

I'm using the standard latex book class, not memoir...

Olaf

Lars Madsen

unread,
Mar 5, 2007, 6:28:56 AM3/5/07
to

then why not switch to memoir, it would solve a lot of problems

Olaf Marzocchi

unread,
Mar 5, 2007, 6:44:36 AM3/5/07
to
> then why not switch to memoir, it would solve a lot of problems

Of course, my next works will be done with memoir, but, when I tried
to simply change from "book" to "memoir" this one, Fancyhdr gave some
problems:

! LaTeX Error: Command \footruleskip already defined.
Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.302 ...and{\footruleskip}{.3\normalbaselineskip}


The \onehalfspacing and \singlespacing commands (setspace package) are
not recognised anymore, too... I think I don't have much time to
correct all the problems, now. It's better to keep the \openany
definition I extracted and to start from scratch with the memoir class
next time.


Olaf

Enrico Gregorio

unread,
Mar 5, 2007, 7:06:00 AM3/5/07
to
Olaf Marzocchi <olaf....@gmail.com> wrote:

memoir has its internal implementation both of fancyhdr and setspace.
So it is incompatible with them, but their functionality is already
present; look at the documentation.

Ciao
Enrico

Lars Madsen

unread,
Mar 5, 2007, 8:40:04 AM3/5/07
to
Olaf Marzocchi wrote:
>> then why not switch to memoir, it would solve a lot of problems
>
> Of course, my next works will be done with memoir, but, when I tried
> to simply change from "book" to "memoir" this one, Fancyhdr gave some
> problems:
>
> ! LaTeX Error: Command \footruleskip already defined.
> Or name \end... illegal, see p.192 of the manual.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.302 ...and{\footruleskip}{.3\normalbaselineskip}
>
>
fancyhfr is already included inside memoir

> The \onehalfspacing and \singlespacing commands (setspace package) are
> not recognised anymore, too... I think I don't have much time to
> correct all the problems, now. It's better to keep the \openany
> definition I extracted and to start from scratch with the memoir class
> next time.
>

the setspace is included inside memoir, though different names, and memoir then
disables the setspace package

>
> Olaf

Olaf Marzocchi

unread,
Mar 5, 2007, 1:57:10 PM3/5/07
to
>
> the setspace is included inside memoir, though different names, and memoir then
> disables the setspace package
>

Ok, since I got the desired output with my addition, I can experiment
and port the document to memoir in the free time. Next time it will be
memoir from start.

Thank you
Olaf Marzocchi

Olaf Marzocchi

unread,
Mar 5, 2007, 4:36:47 PM3/5/07
to
> memoir has its internal implementation both of fancyhdr and setspace.
> So it is incompatible with them, but their functionality is already
> present; look at the documentation.

I tried, but I didn't find any setspace replacement. At least, I
searched memman.pdf for "interline" and also for "spac*" but it was
useless.
Could you help me?

Thank you
Olaf

Lars Madsen

unread,
Mar 5, 2007, 6:52:02 PM3/5/07
to

because the memman is so large several people have printed it (my self
included), so Peter Wilson writes about the additions which are auto
loaded through the mempatch package, in the memmanadd.pdf file, you will
find it on CTAN.

/daleif

Olaf Marzocchi

unread,
Mar 5, 2007, 6:55:59 PM3/5/07
to
> because the memman is so large several people have printed it (my self
> included), so Peter Wilson writes about the additions which are auto
> loaded through the mempatch package, in the memmanadd.pdf file, you will
> find it on CTAN.

Found!! I had locally an old (6 months :-/ ) version of the addendum.

Thanks.
Olaf

0 new messages