%% LyX 1.6.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,ngerman,oldfontcommands]{memoir}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{lipsum}%   PW added
\pagestyle{empty}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% headers and footers
\makepagestyle{abook}
\makeheadposition{abook}{flushright}{flushleft}{}{}
\makerunningwidth{abook}{1.2\textwidth}
\makeoddhead{abook}{\itshape\rightmark}{}{\hspace{2em}\rule[-0.4ex]{0.4pt}{5mm}~~~\thepage\hspace{2em}}
\makeevenhead{abook}{\hspace{2em}\thepage~~~\rule[-0.4ex]{0.4pt}{5mm}\hspace{3em}}{}{\itshape\leftmark}

% PW
\makeatletter
\def\brule{\rule[1.5em]{\textwidth}{0.4pt}}
% LG
\def\abookheadrule{\ifodd\c@page\brule\else\hspace*{0.2\textwidth}\brule\fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter % because of \@chapapp
\makepsmarks {abook}{
\nouppercaseheads
\createmark {chapter} {both} {shownumber}{\@chapapp\ }{. \ }
\createmark {section} {right}{shownumber}{} {. \ }
\createmark {subsection} {right}{shownumber}{} {. \ }
\createmark {subsubsection}{right}{shownumber}{} {. \ }
\createplainmark {toc} {both} {\contentsname}
\createplainmark {lof} {both} {\listfigurename}
\createplainmark {lot} {both} {\listtablename}
\createplainmark {bib} {both} {\bibname}
\createplainmark {index} {both} {\indexname}
\createplainmark {glossary} {both} {\glossaryname}
}
\makeatother
\setsecnumdepth{subsubsection}
\pagestyle{abook}

\makeatother

\usepackage{babel}

\begin{document}
\selectlanguage{english}%

\chapter{kap}
\lipsum[1]
\newpage

\section{subkap}
\lipsum[1]
\newpage

\subsection{subsubkap}
\lipsum[1]

\newpage
\subsection{subsubkap}
\lipsum[1]

\end{document}


