# Using Multiple Custom Chapterstyles - Memoir

I'm using a two custom chapterstyle, one for the main document and one for the backmatter. While it is recognizing and rendering both styles, I get extra text. In the preamble I have the main style:

\usepackage{pgfornament}

\renewcommand\printchaptername{}
\renewcommand\midchapskip{1ex}
\renewcommand\chaptitlefont{\fontsize{18}{18}\scshape\centering}
\renewcommand\afterchaptertitle{%
\par\centering%
\raisebox{1ex}{\pgfornament[scale=0.35]{88}}\par\nobreak\vspace{3ex}}
}

\makepagestyle{chapter}
{\thispagestyle{empty}
}


And then I have my main document.

At the end, I have:

\backmatter
\makechapterstyle{afterwards}
{
\setlength{\beforechapskip}{-50pt}
\renewcommand\printchaptername{}
\renewcommand\chaptitlefont{\fontsize{18}{18}\scshape\centering}
\renewcommand\afterchaptertitle{%
\par\centering%
\raisebox{1ex}{\pgfornament[scale=0.35]{88}}\par\nobreak\vspace{3ex}}
}
\chapterstyle{afterwards}


The new style renders correctly (it's the same style, set higher on the page) however, in the PDF exported I get a page that is empty of everything but the text "1ex."

How do I get rid of this extra text and what is a better way to include two different custom styles? (I initially tried including both styles in the preamble. Got lots of errors)

Notes: I am using memoir, and coding via Lyx. The backmatter and backmatter chapter style are in a "Tex Code" block between the final chapter and the beginning of the after-content.

• Have you seen my answer which solves your problem? Feb 20, 2021 at 18:33

In your definition of \makechapterstyle{heading-1}{...} you used

 \renewcommand\midchapskip{1ex}


but it should have been

\setlength{\midchapskip}{1ex}


You can define both chapterstyles in the preamble. The following is a cobbled together corrected version of what you might have supplied as an MWE.

% memchapprob.tex  SE 583682

\documentclass{memoir}
\usepackage{pgfornament}

\renewcommand\printchaptername{}
%\renewcommand\midchapskip{1ex}
\setlength\midchapskip{1ex}
\renewcommand\chaptitlefont{\fontsize{18}{18}\scshape\centering}
\renewcommand\afterchaptertitle{%
\par\centering%
\raisebox{1ex}{\pgfornament[scale=0.35]{88}}\par\nobreak\vspace{3ex}}
}

\makechapterstyle{afterwards}{%
\setlength{\beforechapskip}{-50pt}
\renewcommand\printchaptername{}
\renewcommand\chaptitlefont{\fontsize{18}{18}\scshape\centering}
\renewcommand\afterchaptertitle{%
\par\centering%
\raisebox{1ex}{\pgfornament[scale=0.35]{88}}\par\nobreak\vspace{3ex}}
}

\makepagestyle{chapter}{\thispagestyle{empty}}

\begin{document}
\chapter{Main chapter}
Some text.

\backmatter
\chapterstyle{afterwards}

\chapter{Afterwards}
More text.
\clearpage
Even more text.

\end{document}