3

Merry christmas to everyone. I'm trying to make a LyX template since I have to write three reports over the next 12 months. I'm using memoir and chapterstyle demo2. How can I

1) Right align the chapter number (the name is already right aligned) and

2) Change it from e.g. "one" to "Chapter 1"?

3) Can I do the same thing on my appendix? I.e., make right align and make it start with "Appendix A" instead of "A"? enter image description here

This is my preamble so far:

\chapterstyle{demo2}
\makepagestyle{mystyle}
\makeheadrule {mystyle}{\textwidth}{\normalrulethickness} 
\makeevenhead{mystyle}{\small\leftmark}{}{}
\makeoddhead{mystyle}{\small\rightmark}{}{}
\makeevenfoot{mystyle}{}{\thepage }{} 
\makeoddfoot{mystyle}{}{\thepage}{}
5

Define a variant of the demo2 chapter style:

\documentclass{memoir}

\makeatletter
\makechapterstyle{demo2var}{%
  \chapterstyle{default}
  \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
  \renewcommand*{\chapnumfont}{\chaptitlefont}
  \renewcommand*{\printchaptername}{\raggedleft}
  \renewcommand*{\printchapternum}{\chapnumfont
     \ifanappendix Appendix \else Chapter \fi\thechapter}
  \renewcommand*{\printchaptertitle}[1]{%
    \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
  \renewcommand*{\afterchaptertitle}{%
    \vskip\onelineskip \hrule\vskip \afterchapskip}
  \setlength{\beforechapskip}{3\baselineskip}
  \renewcommand*{\printchapternonum}{%
    \vphantom{\chapnumfont One}
    \afterchapternum%
    \vskip\topskip}
  \setlength{\beforechapskip}{2\onelineskip}}
\makeatother

\chapterstyle{demo2var}

%% add here the changes for headers and footers

\begin{document}

\mainmatter
\chapter{Fundamentals}

\appendix

\chapter{Minor points}

\end{document}

Chapter

Appendix

  • 1
    @Lars_CPH It just took a minute: find the definition of the demo2 chapter style, and figure out what changes had to be made. Not easy for a beginner, but if you're interested, you can spot the differences by looking at the code in memoir.cls (lines 3247–3262). Welcome to TeX.SX! – egreg Dec 24 '13 at 14:30
  • I am interested (I do some other coding, but in this community, Im new and unskilled/useless) - where/how do I find the memoir.cls? – Lars_CPH Dec 24 '13 at 14:41
  • 1
    @Lars_CPH It depends on what TeX distribution and OS you are using. On Unix, the command line less $(kpsewhich memoir.cls) will do. – egreg Dec 24 '13 at 14:49
  • Okay. I'll take a look at it after christmas :). Thanks again. – Lars_CPH Dec 24 '13 at 14:55

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.