Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
That is exactly what I needed. Thank you so much. –  user23034 Dec 12 '12 at 21:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.