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 using document class report and I have decided for chapter headings to use one of the predefined style of Vincent Zoonekynd's like this:

\documentclass{report}
\usepackage{xcolor}
\makeatletter
\def\LigneVerticale{\vrule height 1.5cm depth 0.9cm\hspace{0.1cm}\relax}
\def\LignesVerticales{%
  \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
\def\GrosCarreAvecUnChiffre#1{{\setlength{\fboxsep}{-\fboxrule}%
  \fbox{\color{white}%
  \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
  \rlap{\hbox to 1cm{\hss\mbox{\color{black}#1}\hss}}%
  \vrule height 0pt width 1cm depth 0pt}}}
\def\@makechapterhead#1{
    \vspace*{-20pt}
    \hbox{%
    \huge\bfseries
    \LignesVerticales
    \hspace{-0.5cm}%
    \GrosCarreAvecUnChiffre{\thechapter}
    \hspace{0.2cm}\hbox{#1}%
}\par\vskip 0.5cm}
\def\@makeschapterhead#1
    \vspace*{-20pt}
   {\hbox{%
    \huge\bfseries
    \LignesVerticales
    %\hspace{0.5cm}%
    \hbox{#1}%
}\par\vskip 0.3cm}
\makeatother

    \begin{document}
    \chapter{Here we go}
    \end{document}

However, I would like to make some changes.

  1. I would need to move all construction up to the page, in other words to get smaller space between the top of any page and the construction.

  2. I would like to change the small box. I would prefer white square with black number (not like this one-black square with white number).

share|improve this question
1  
I've taken the liberty of expanding your code into a compilable MWE (minimum working example), incorporating your note that you use the report document class. The main change is that I had to change the instruction \white #1 to \textcolor{white}{#1}. –  Mico May 18 '12 at 16:05
add comment

1 Answer

up vote 5 down vote accepted
  1. Since you've redefined \@makechapterhead and \@makeschapterhead (responsible for creating the entire chapter header when using \chapter and \chapter*, respectively), the chapter heading starts at the top of the text block. You may be referring to moving the entire text block up (or reduce the top margin). For this I would suggest using geometry.

  2. Here's a MWE that provides what you're after. However, inserting a white block with a black number doesn't show up as needed:

    enter image description here

    \documentclass{report}
    \usepackage{showframe}% http://ctan.org/pkg/showframe
    \usepackage{xcolor}% http://ctan.org/pkg/xcolor
    
    \makeatletter
    \def\LigneVerticale{\vrule height 2cm depth 1.4cm\hspace{0.1cm}\relax}
    \def\LignesVerticales{%
      \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
    \def\GrosCarreAvecUnChiffre#1{{%
      \color{white}%
      \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
      \rlap{\hbox to 1cm{\hss\mbox{\color{black}#1}\hss}}%
      \vrule height 0pt width 1cm depth 0pt}}
    
    \def\@makechapterhead#1{\hbox{%
        \huge\bfseries
        \LignesVerticales
        \hspace{-0.5cm}%
        \GrosCarreAvecUnChiffre{\thechapter}
        \hspace{0.2cm}\hbox{#1}%
    }\par\vskip 0.3cm}
    
    \def\@makeschapterhead#1{\hbox{%
        \huge\bfseries
        \LignesVerticales
        %\hspace{0.5cm}%
        \hbox{#1}%
    }\par\vskip 0.3cm}
    \makeatother
    
    \begin{document}
    
    \chapter{A chapter}
    
    \end{document}
    

    The following definition of \GrosCarreAveUnChiffre

    \def\GrosCarreAvecUnChiffre#1{{\setlength{\fboxsep}{-\fboxrule}%
      \fbox{\color{white}%
      \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
      \rlap{\hbox to 1cm{\hss\mbox{\color{black}#1}\hss}}%
      \vrule height 0pt width 1cm depth 0pt}}}
    

    yields a boxes chapter number:

    enter image description here

    Another alternative - moving the header construction vertically is obtained using

    \def\@makechapterhead#1{%
      \vspace*{\dimexpr-\headsep-\headheight-\baselineskip}%
      \hbox{%
        \huge\bfseries
        \LignesVerticales
        \hspace{-0.5cm}%
        \GrosCarreAvecUnChiffre{\thechapter}
        \hspace{0.2cm}\hbox{#1}%
    }\par\vskip 0.3cm}
    
    \def\@makeschapterhead#1{%
      \vspace*{\dimexpr-\headsep-\headheight-\baselineskip}%
      \hbox{%
        \huge\bfseries
        \LignesVerticales
        %\hspace{0.5cm}%
        \hbox{#1}%
    }\par\vskip 0.3cm}
    

    which moves the vertical lines to the top of the page header. Of course, replacing the expression within \vspace* with a fixed dimension (say, -30pt) will displace it vertically with that amount.

    enter image description here

    showframe was added to highlight the text block boundary (in response to (1) above).

share|improve this answer
    
&Werner: Thank you. That's almost what I wanted. I just wanted to ask if you know how to put around the white square black borders. –  Jane May 18 '12 at 21:07
    
Don't use showframe package in the above. The rest of it is defined as above. Now I want to move all together (lines and chapter number and chapter name) up closer to the top of the page. I don't like too much empty space above the construction. –  Jane May 18 '12 at 22:33
    
@Jane: As mentioned in my answer, you don't need to showframe package. I just added it to provide a frame of reference. So, by all means, remove it. It should solve your problem of moving the header upward by inserting \vspace*{<len>} (where you specify <len>, a negative length) as I've indicated. –  Werner May 18 '12 at 22:40
    
@ Werner: Thank you for help. It works now. –  Jane May 19 '12 at 9:26
add comment

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.