5

I'm very new to TeX and I'm from a graphic design background, so I apologize if I'm missing something very obvious.

I want to modify the memoir style VZ14. What I would like is:

=====h double line======== Chapter title =====h double line=======

so that the top line is a little thicker than the bottom. And I don't want Chapter numbers.

\makeatletter 
\newcommand\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@} 
\setlength\midchapskip{10pt} 
\makechapterstyle{VZ14}{
    \renewcommand\chapternamenum{} 
    \renewcommand\printchaptername{} 
    \renewcommand\chapnamefont{\small\scshape} 
    \renewcommand\printchapternum{%
    \chapnamefont\null\thickhrulefill\quad
    \@chapapp\space\thechapter\quad\thickhrulefill}
\renewcommand\printchapternonum{%
    \par\thickhrulefill\par\vskip\midchapskip
    \hrule\vskip\midchapskip
}
\renewcommand\chaptitlefont{\small\scshape\centering}
\renewcommand\afterchapternum{%
\par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip}
\renewcommand\afterchaptertitle{%
\par\vskip\midchapskip\hrule\nobreak\vskip\afterchapskip}
}
\makeatother
\chapterstyle{VZ14}
7

The code below shows one possibility:

\documentclass{memoir}

\newlength\chaptitlelength
\newlength\chaptitlerlength

\makeatletter 
\newcommand\thickhrulefill[1]{%
  \leavevmode \leaders \hrule height #1 \hfill \kern \z@} 
\setlength\midchapskip{10pt} 
\makechapterstyle{mystyle}{
  \setlength\beforechapskip{0pt}
  \renewcommand\chapternamenum{} 
  \renewcommand\printchaptername{}
  \renewcommand\printchapternum{} 
  \renewcommand\chaptitlefont{\small\scshape\centering}
  \renewcommand*{\printchaptertitle}[1]{%
    \settowidth\chaptitlelength{\hspace*{1em}\chaptitlefont##1\hspace*{1em}}%
    \ifnum\chaptitlelength>\dimexpr0.7\textwidth\relax%
      \setlength\chaptitlelength{0.7\textwidth}%
    \fi%
    \setlength\chaptitlerlength{\textwidth}%
    \addtolength\chaptitlerlength{-\chaptitlelength}%
    \addtolength\chaptitlerlength{-2em}%
    \noindent\parbox[c]{.5\chaptitlerlength}{\normalsize\thickhrulefill{0.3ex}\par\vskip-1.5ex\thickhrulefill{0.2ex}}\hspace*{1em}%
    \parbox[c]{\chaptitlelength}{\chaptitlefont##1}\hspace*{1em}%
    \parbox[c]{.5\chaptitlerlength}{\normalsize\thickhrulefill{0.3ex}\par\vskip-1.5ex\thickhrulefill{0.2ex}}%
  }%
}
\makeatother
\chapterstyle{mystyle}

\begin{document}

\chapter{Test Chapter One}

\chapter{Test Chapter Two With a Long Title Spanning Two Lines And Some More Text}

\end{document}

The idea is to use three vertically centered \parboxes; the first and third ones contain the rules and the middle one contains the title; some provision was made in case the title is too long: the middle box width won't exceed 0.7\textwidth to guarantee that both lines will always show:

An image of a short title:

enter image description here

An image of a long title:

enter image description here

Of course, feel free to adjust the settings according to your needs.

  • That is exactly what I needed. Thank you so much. – user23034 Dec 12 '12 at 21:57

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.