0

I Want to create this layout:

enter image description here

With the title in the black box, using titlesec. But I just have got this result:

enter image description here

And I can not move down the number page...

Here is my code:

\documentclass{book}
\usepackage[a4paper,right=1cm, left=1cm,bottom=1cm,top=1cm]{geometry}
\pagestyle{plain}
\usepackage[pagestyles]{titlesec}

\usepackage{lipsum}

\pagestyle{plain}
\renewpagestyle{plain}{
\widenhead[1cm][1cm]{1.5cm}{1.5cm}
\sethead[\LARGE\bfseries\thepage][][]{}{}{\LARGE\bfseries\thepage}%
}
\newpagestyle{main}{
\widenhead[1cm][1cm]{1.5cm}{1.5cm}
\sethead[\LARGE\bfseries\thepage][][]{}{}{\LARGE\bfseries\thepage}%
}

\begin{document}
\pagestyle{main}
\chapter{Here}
\section{here}
\lipsum[1-20]
\chapter{Here}
\lipsum[1-20]
\end{document} 

I tried solutions with background, but I could not prevent it to run into empty pages and chapter (plain) pages.

Gergian
  • 495

1 Answers1

1

A possible solution:

\documentclass{book}
\usepackage[a4paper,right=1cm, left=1cm,bottom=1cm,top=1cm]{geometry}
\pagestyle{plain}
\usepackage[pagestyles]{titlesec}

\usepackage[]{graphicx}

\usepackage{lipsum}

\pagestyle{plain}

\newcommand*\MoveA[2]
  {%
    \rlap
      {%
        \raisebox{-\dimexpr\headsep+\height\relax}
          {%
            \llap
              {%
                \begin{tabular}[t]{@{}c@{}}
                  #1\\[\medskipamount]
                  #2
                \end{tabular}%
              }%
          }%
      }%
  }
\newcommand*\MoveB[2]
  {%
    \rlap
      {%
        \raisebox{-\dimexpr\headsep+\height\relax}
          {%
            \rlap
              {%
                \begin{tabular}[t]{@{}c@{}}
                  #1\\[\medskipamount]
                  #2
                \end{tabular}%
              }%
          }%
      }%
  }
\newcommand*\OutputHeadmark
  {%
    \rotatebox{90}{\strut\chaptertitle}%
  }
\newcommand*\MyHeadStyle
  {%
    \LARGE\bfseries
  }

\renewpagestyle{plain}
  {%
    \sethead[\MyHeadStyle\MoveA{\thepage}{\OutputHeadmark}][][]
      {}{}{\MyHeadStyle\MoveB{\thepage}{\OutputHeadmark}}%
  }
\newpagestyle{main}
  {%
    \sethead[\MyHeadStyle\MoveA{\thepage}{\OutputHeadmark}][][]
      {}{}{\MyHeadStyle\MoveB{\thepage}{\OutputHeadmark}}%
  }

\begin{document}
\pagestyle{main}
\chapter{Here}
\section{here}
\lipsum[1-20]
\chapter{There}
\lipsum[1-20]
\lipsum[1-20]
\end{document} 

enter image description here

Skillmon
  • 60,462