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 am new guy on texstackexchange... I am using the daleif1 theme for my heading :

 \documentclass{memoir}
    \usepackage{color,calc,graphicx,soul,fourier}
    \definecolor{nicered}{rgb}{.647,.129,.149}
    \makeatletter
    \newlength\dlf@normtxtw
    \setlength\dlf@normtxtw{\textwidth}
    \def\myhelvetfont{\def\sfdefault{mdput}}
    \newsavebox{\feline@chapter}
    \newcommand\feline@chapter@marker[1][4cm]{%
      \sbox\feline@chapter{%
        \resizebox{!}{#1}{\fboxsep=1pt%
          \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
        }}%
      \rotatebox{90}{%
        \resizebox{%
          \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
        {!}{\scshape\so\@chapapp}}\quad%
      \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
    }
    \newcommand\feline@chm[1][4cm]{%
      \sbox\feline@chapter{\feline@chapter@marker[#1]}%
      \makebox[0pt][l]{% aka \rlap
        \makebox[1cm][r]{\usebox\feline@chapter}%
      }}
    \makechapterstyle{daleif1}{
      \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
      \renewcommand\chaptitlefont{\normalfont\huge\bfseries\scshape\color{nicered}}
      \renewcommand\chapternamenum{}
      \renewcommand\printchaptername{}
      \renewcommand\printchapternum{\null\hfill\feline@chm[2.5cm]\par}
      \renewcommand\afterchapternum{\par\vskip\midchapskip}
      \renewcommand\printchaptertitle[1]{\chaptitlefont\raggedleft ##1\par}
    }
    \makeatother
    \chapterstyle{daleif1}

enter image description here

I would like to have the red box in the top left hand corner. I have been trying for hours without any results...

Does anyone can help me please ?

Thanks.

share|improve this question
    
Welcome to TeX.SX! daleif is a regular here, so I guess he'll be helping you soon. –  egreg Jul 25 at 22:06
    
Just remove the \null\hfill from printchapternum, which pushes it over to the right. –  Werner Jul 25 at 22:10

1 Answer 1

up vote 6 down vote accepted

Like this?

enter image description here

The only change was in

 \renewcommand\printchapternum{\null\hfill\feline@chm[2.5cm]\par}

deleting the \null\hfill.

The code:

\documentclass{memoir}
\usepackage{color,calc,graphicx,soul,fourier}
\usepackage{lipsum}

    \definecolor{nicered}{rgb}{.647,.129,.149}
    \makeatletter
    \newlength\dlf@normtxtw
    \setlength\dlf@normtxtw{\textwidth}
    \def\myhelvetfont{\def\sfdefault{mdput}}
    \newsavebox{\feline@chapter}
    \newcommand\feline@chapter@marker[1][4cm]{%
      \sbox\feline@chapter{%
        \resizebox{!}{#1}{\fboxsep=1pt%
          \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
        }}%
      \rotatebox{90}{%
        \resizebox{%
          \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
        {!}{\scshape\so\@chapapp}}\quad%
      \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
    }
    \newcommand\feline@chm[1][4cm]{%
      \sbox\feline@chapter{\feline@chapter@marker[#1]}%
      \makebox[0pt][l]{% aka \rlap
        \makebox[1cm][r]{\usebox\feline@chapter}%
      }}
    \makechapterstyle{daleif1}{
      \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
      \renewcommand\chaptitlefont{\normalfont\huge\bfseries\scshape\color{nicered}}
      \renewcommand\chapternamenum{}
      \renewcommand\printchaptername{}
      \renewcommand\printchapternum{\feline@chm[2.5cm]\par}
      \renewcommand\afterchapternum{\par\vskip\midchapskip}
      \renewcommand\printchaptertitle[1]{\chaptitlefont\raggedleft ##1\par}
    }
    \makeatother
    \chapterstyle{daleif1}

\begin{document}

\chapter{Test chapter}
\lipsum[2]
\end{document}

In a comment it was requested to move the heading upwards, so the upper border of the red box coincides with the upper border of the page; this can be made by adding

\setlength\beforechapskip{-135pt}

to the definition of the theme, and perhaps also

\renewcommand*\printchapternonum{\phantom{\feline@chm[2.5cm]}\par}

so titles for unnumbered chapters won't start too high. A complete example:

 \documentclass{memoir}
\usepackage{color,calc,graphicx,soul,fourier}
\usepackage{lipsum}

    \definecolor{nicered}{rgb}{.647,.129,.149}
    \makeatletter
    \newlength\dlf@normtxtw
    \setlength\dlf@normtxtw{\textwidth}
    \def\myhelvetfont{\def\sfdefault{mdput}}
    \newsavebox{\feline@chapter}
    \newcommand\feline@chapter@marker[1][4cm]{%
      \sbox\feline@chapter{%
        \resizebox{!}{#1}{\fboxsep=1pt%
          \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
        }}%
      \rotatebox{90}{%
        \resizebox{%
          \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
        {!}{\scshape\so\@chapapp}}\quad%
      \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
    }
    \newcommand\feline@chm[1][4cm]{%
      \sbox\feline@chapter{\feline@chapter@marker[#1]}%
      \makebox[0pt][l]{% aka \rlap
        \makebox[1cm][r]{\usebox\feline@chapter}%
      }}
    \makechapterstyle{daleif1}{
      \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
      \renewcommand\chaptitlefont{\normalfont\huge\bfseries\scshape\color{nicered}}
      \renewcommand\chapternamenum{}
      \renewcommand\printchaptername{}
      \setlength\beforechapskip{-135pt}
      \renewcommand\printchapternum{\feline@chm[2.5cm]\par}
      \renewcommand*\printchapternonum{\phantom{\feline@chm[2.5cm]}\par}%
      \renewcommand\afterchapternum{\par\vskip\midchapskip}
      \renewcommand\printchaptertitle[1]{\chaptitlefont\raggedleft ##1\par}
    }
    \makeatother
    \chapterstyle{daleif1}

\begin{document}

\chapter*{Test unnumbered chapter}
\lipsum[2]
\chapter{Test numbered chapter}
\lipsum[2]

\end{document}

enter image description here

share|improve this answer
    
Oh my God, it works ! However, I would like to have the same thing with a left, right,bottom, and top margin of 2 cm. –  TexisHard Jul 25 at 22:20
1  
@TexisHard I don't understand what do you mean with "margin" in your comment. Please clearly explain what dimensions should be 2cm. –  Gonzalo Medina Jul 25 at 22:23
    
How could I get the top red-box border in contact with the top of the blank sheet ? –  TexisHard Jul 25 at 22:28
    
@TexisHard So, you want to shift everything (the red box and the title) upwards, so the upper border of the red box touches the upper border of the physical page? –  Gonzalo Medina Jul 25 at 22:29
    
Correct !! Thats it! –  TexisHard Jul 25 at 22:31

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.