Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

LyX /

UsingMemoirInLyX

<< | Page list | >>

How to effectively use the Memoir document class in LyX.

1.  Using Memoir in LyX

Memoir is a great document class with many features and the possibility to easily redefine practically everything inside a document. However, its support in LyX is yet not very well done (due to the many redefinitions in the class and the many different commands; this clearly seems to be a major task and probably it is not even worth the effort).

However, one can still effectively use the Memoir class to produce beautiful and individual layouts far beyond the typical LaTeX-looks. And one can even use LyX to achieve all that. But it will require quite a lot of ERT-insertions and other commands to take care of. This page aims at helping to do that.

All examples here refer to LyX 1.5.x.

2.  Useful information and documentation

Here are some direct links to the pdf-files reffered to in this page:

3.  Changing line spacing (fixed in LyX 1.5.4)

Note that all of the described problems with line spacing are fixed as of LyX 1.5.4

The commands for line spacing inside LyX do not work with Memoir, as Memoir has its own commands for line spacing. So, if you choose line spacing via the document settings menu, you will get an error when trying to view your document as a pdf:

Undefined control sequence.

 \onehalfspacing

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Instead you should use the specific commands for Memoir. In the document settings menu choose single spacing and for your document use these commands and put them in ERT:

  • \OnehalfSpacing
  • \DoubleSpacing
  • and others

Note that the commands only differ a little bit to the usual commands for the regular book class: OnehalfSpacing instead of onehalfspacing.

For more information on this, check section 2.6 in the Memoir Addendum and the example document.

3.1  Changing line spacing within the document

If you are writing a thesis and use longer quotation and have to use 1.5 line spacing, you might wish to change the line spacing for your quotation (as this is often done). Simply put your quotation into a quotation environment and insert ERT before and after your quotation:

  • \SingleSpacing before your quotation
  • \OnehalfSpacing after your quotiation

For more information on this, check section 2.6 in the Memoir Addendum and the example document.

4.  Styling the title page

If you ever were unhappy with the looks of the typical LaTeX title pages, no wonder, I do not find them attractive either. However, title pages are a “picky point” and it does not make sense, to produce general title pages for all books in this world as they are always quite individual.

Peter Wilson, the author of the Memoir class, has written a nice tutorial on how to easily change title pages the way you want them. And in this tutorial called Some Examples of Title Pages, he also has many examples and includes the code. With a few little changes, you can also use them for your Memoir document in LyX.

4.1  Preparations

You need to be very cautious when doing these things. First, get the tutorial and read it. Print it out and decide on your favourite title page. Take a look at the code. Now in LyX, start a new document, give it a title and an author name and the date. If you do not want a date, you have to put in the authors name where the date would be written. Memoir always asks for a date and if there is none, it fills in the date of today. But if you write a name in that line, you will get no errors and no date on your title page (for whatever reason, Memoir does not ask for an author). What you have produced now, is a half-title page (in german it is called “Schmutztitel”, I guess that “half-title” would be the correct translation). Practically every book has such a page and our example title pages would not work without this workaround.

4.2  More preparations

Now, fill in a page break (new odd page) and start an ERT-field. In the first line put

\thispagestyle{empty}

and hit enter two times (just to make it a little more clearly arranged). Get the code of the desired title page from the pdf-file (see above) and copy and paste it into your ERT-field. You might find it useful, to use the Paste Simple Text command via the edit menu (again: just to make it a little more clearly arranged).

4.3  The preamble

Okay, to not have to bother too much, you can put a general declaration in your preamble. With this, all example title pages will work, for quite a few of them, you do not need to put anything in the preamble. But this you will have to check out for yourself. In my example document, I simply put this in the preamble:

\usepackage{color} 
\definecolor{Dark}{gray}{.2} 
\definecolor{Medium}{gray}{.6} 
\definecolor{Light}{gray}{.8} 
\newcommand*{\plogo}{\fbox{$\mathcal{PL}$}}

4.4  Tuning the title page

Okay, we have gotten quite far. Still, you will likely get error messages when compiling the document. This is due to many special commands and redefinitions. We will take care of them now.

The title page begins and ends like this:

\newcommand*{\titleM}{\begingroup% Misericords, T&H p 153
(...)
\endgroup}

We need to delete a little bit of that. Get rid of \newcommand* etc. and of the { } before \begingroup and after \endgroup and the comment after % to make it look like this:

\begingroup
(...)
\endgroup

Peter Wilson added a new command which he called \drop. In my experience, this causes many problems. Get the line, where he defines the command, copy the definition and delete it. For example:

\drop = 0.08\textheight

Copy the textheight bit:

0.08\textheight

And now delete that line. You will now need to replace all \drop-commands with that textheight bit. This may be several times on the title page. For example,

\vspace*{\drop}

needs to be changed to

\vspace*{0.08\textheight}

Be careful if there are special \drop-commands like this one:

\vspace*{2\drop}

Because of the ›2‹ you will need to multiplicate a little bit :) and change it to

\vspace*{0.16\textheight}

(as it means 2 times \drop, which in this case is 0.16\textheight).

Now, you are finished and your document should compile without errors. What you have achieved now, is a typical front matter of a book, starting with half-title page and a proper title page. Have fun :)

For more information on this also check the example documents at the beginning of this section.

5.  Choosing different chapter styles

Choosing different chapter styles in Memoir is very easy. There are three kinds of different chapterstyles: the chapter styles from the original document class, the chapter styles added to Memoir over time (and documented in the Memoir Addendum) and additional chapter styles designed by users of Memoir. In the example documents above you can have a first glance at the big variety of easy-to-access chapter styles.

Choosing the “standard” and the “additional standard” chapter styles needs some ERT, but is not very difficult. Those chapterstyles simply have not been integrated into LyX yet. Get the name (e.g. in the example document) and put

\chapterstyle{ChapterStyleName}

into the LaTeX preamble in the document settings dialogue. For many of these chapter styles you will also need to fill in some ERT at the beginning of each chapter (in the first line of the paragraph) to avoid page numbers or headings being printed. Fill in this code in ERT:

\thispagestyle{empty}

The same effect can be achieved by putting the following line in the preamble:

\aliaspagestyle{chapter}{empty}

Choosing any other chapter styles, e.g. from the Memoir Chapter Styles paper linked above or a self-written one, is a little bit more complicated. You need to put the code for the desired chapter style into the preamble and then choose the chapter style in the same manner as the “additional standard” chapter styles. Quite a few of the very additional chapter styles need some fine tuning. I will try out as many chapter styles as possible and upload those example chapters here as soon as I can. You can find a lot of nice-looking examples in a tutorial by Vincent Zoonekynd. You can copy the code from the \makeatletter-command just before the \begin{document}-command and put it in your preamble. As his examples are very simple, you can also try out to vary the styles and maybe come up with your own one.

6.  Typographic details in Memoir

6.1  Versals

Versals are big starting letters at the beginning of chapters of paragraphs. They often stretch over more than two lines and are quite often followed by a few words typeset in small capitals. Typesetting versals in LaTeX seems to be a fairly difficult task but thanks to Peter Wilson you can easily use them in Memoir and LyX. You will need some extra definitions (LaTeX code) which you can find in the LaTeX-preamble of the example LyX-file above. Copy this code and paste it into you document and now, with a little help of ERT, you can start paragraphs with versals like this first type:

\drop{D}ropped example versal to start with

or like this second type:

\versal{E}xample versal to start with

If you want the following letters typeset in small capitals (as I did in the example file in the second example), then do this in LyX via the ab-button.

There is another option, which is the easiest of all and does not need any extra definition (e.g. if you are experiencing problems because of several redefinitions in your document and can not figure out, what the problem is). Simply start with a big first letter (check the example files) but make sure, there is enough space above it.


7.  Categories

Category: Customization Humanities

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2012-07-05 08:37 UTC