2

I am using the setting from this post

Chapter Style- Report Class

With the solution developed by Gonzalo Medina

\documentclass{report}
\usepackage{graphicx} 
\usepackage{titlesec} 
\usepackage{lipsum} %just to generate text for the example

\newcommand*\HUGE{\Huge}
\newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase}
\newcommand*\chapnumfont{\normalfont\HUGE}
\newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}

\newlength\beforechapskip
\newlength\midchapskip
\setlength\midchapskip{\paperwidth}
\addtolength\midchapskip{-\textwidth}
\addtolength\midchapskip{-\oddsidemargin}
\addtolength\midchapskip{-1in}
\setlength\beforechapskip{18mm}

\titleformat{\chapter}[display]
  {\normalfont\filleft}
  {{\chapnamefont\chaptertitlename}%
    \makebox[0pt][l]{\hspace{.8em}%
      \resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}%
      \hspace{.8em}%
      \rule{\midchapskip}{\beforechapskip}%
    }%
  }%
  {25pt}
  {\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}

\begin{document}

\chapter{Demonstration of the veelo chapter style}
\lipsum[2]

\end{document}

I found this problem. For example, the code works fine from Chapter 1 to 9, but after I have this problem, the Black bar disappear.

enter image description here

I tried to work to setting the line

\makebox[0pt][l]{\hspace{.8em}%

changing for example, from .8em to -1.8em but from 1 to 9 the black bar is longer than chapter >= 10

enter image description here

enter image description here

The solution given by @Bernard (see below) do not work if you set

\documentclass[12pt,a4paper]{report}

For example I had the same problem

enter image description here

enter image description here

Improviing the code with the help of @Bernard (see below) I wrote the following code in order to have only numbers and not the write Chapter.

\documentclass[12pt,a4paper]{report}

\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{lipsum} %just to generate text for the example
\usepackage[a4paper]{geometry}
\geometry{right=120pt}


\newcommand*\HUGE{\Huge}
\newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase}
\newcommand*\chapnumfont{\normalfont\HUGE}
\newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}

\newlength\beforechapskip
\newlength\midchapskip
\setlength\midchapskip{\paperwidth}
\addtolength\midchapskip{-\textwidth}
\addtolength\midchapskip{-\oddsidemargin}
\addtolength\midchapskip{-1in}
\setlength\beforechapskip{18mm}

\titleformat{\chapter}[display]
  {\normalfont\filleft}
{{\chapnamefont\chaptertitlename}%
\rlap{\hspace{.8em}%
\makebox[\dimexpr\oddsidemargin+\hoffset+1in+30pt][s]{{\resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}}\hfill%
\rule{46pt}{\beforechapskip}}%
}%
}%
  {25pt}
  {\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}

\makeatletter
\renewcommand{\@chapapp}{}
\makeatother

\begin{document}

\chapter{Demonstration of the veelo chapter style}
\lipsum[1]

\setcounter{chapter}{22}
\chapter{Demonstration of the veelo chapter style}
\lipsum[2]
\end{document} 

Using this approach I got the following results

enter image description here enter image description here

This is the most unaesthetic solution, but it's work.

\documentclass[12pt,a4paper]{report}

\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{lipsum} %just to generate text for the example

\newcommand*\HUGE{\Huge}
\newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase}
\newcommand*\chapnumfont{\normalfont\HUGE}
\newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}

\newlength\beforechapskip
\newlength\midchapskip
\setlength\midchapskip{\paperwidth}
\addtolength\midchapskip{-\textwidth}
\addtolength\midchapskip{-\oddsidemargin}
\addtolength\midchapskip{-1in}
\setlength\beforechapskip{18mm}


\makeatletter
\renewcommand{\@chapapp}{}
\makeatother

\begin{document}

\titleformat{\chapter}[display]
  {\normalfont\filleft}
{{\chapnamefont\chaptertitlename}%
\rlap{\hspace{+34.8em}%
\makebox[\dimexpr\oddsidemargin+\hoffset+0in][s]{{\resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}}\hfill%
\rule{46pt}{\beforechapskip}}%
}%
}%
  {25pt}
  {\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}
\chapter{Demonstration of the veelo chapter style}
\lipsum[1]

\setcounter{chapter}{22}
\titleformat{\chapter}[display]
  {\normalfont\filleft}
{{\chapnamefont\chaptertitlename}%
\rlap{\hspace{+31.8em}%
\makebox[\dimexpr\oddsidemargin+\hoffset+0in][s]{{\resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}}\hfill%
\rule{46pt}{\beforechapskip}}%
}%
}%
  {25pt}
  {\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}


\chapter{Demonstration of the veelo chapter style}
\lipsum[2]
\end{document} 

enter image description here

3

Here is a small modification of the code which does what you want, if I've well understood:

\documentclass{report}
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{lipsum} %just to generate text for the example

\newcommand*\HUGE{\Huge}
\newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase}
\newcommand*\chapnumfont{\normalfont\HUGE}
\newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}

\newlength\beforechapskip
\newlength\midchapskip
\setlength\midchapskip{\paperwidth}
\addtolength\midchapskip{-\textwidth}
\addtolength\midchapskip{-\oddsidemargin}
\addtolength\midchapskip{-1in}
\setlength\beforechapskip{18mm}

\titleformat{\chapter}[display]
  {\normalfont\filleft}
{{\chapnamefont\chaptertitlename}%
\rlap{\hspace{.8em}%
\makebox[\dimexpr\oddsidemargin+\hoffset+1in][s]{{\resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}}\hfill%
\rule{46pt}{\beforechapskip}}%
}%
}%
  {25pt}
  {\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}

\begin{document}

\chapter{Demonstration of the veelo chapter style}
\lipsum[1]

\setcounter{chapter}{22}
\chapter{Demonstration of the veelo chapter style}
\lipsum[2]
\end{document} 

enter image description here

To format according to the latest wishes of the O.P. (only the chapter number and a black box above the title), here is a simple code:

\documentclass[12pt, a4paper]{report}

\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{lipsum} %just to generate text for the example

\newcommand*\HUGE{\Huge}
\newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase}
\newcommand*\chapnumfont{\normalfont\HUGE}
\newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}

\newlength\beforechapskip
\newlength\midchapskip
\setlength\midchapskip{\paperwidth}
\addtolength\midchapskip{-\textwidth}
\addtolength\midchapskip{-\oddsidemargin}
\addtolength\midchapskip{-1in}
\setlength\beforechapskip{18mm}

\titleformat{\chapter}[display]
  {\normalfont\filleft}
{\rlap{%
\makebox[\dimexpr\paperwidth-\evensidemargin-\hoffset-1in][r]{{\resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}}\quad%
\rule{46pt}{\beforechapskip}}%
}}%
  {25pt}
  {\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}

\begin{document}

\chapter{Demonstration of the veelo chapter style}
\lipsum[1]

\chapter{Demonstration of the veelo chapter style}
\lipsum[2]

\end{document} 

enter image description here

  • Thanks for your Help. I am sorry but doesn't works. I still have the same problem. I use \documentclass[12pt,a4paper]{report} \begin{document} \input{Exercise1.tex} \setcounter{chapter}{22} \input{Exercise11.tex} \end{document} – Gianni Spear Apr 27 at 19:52
  • see the example above. I updated my post – Gianni Spear Apr 27 at 20:19
  • @GianniSpear: This is a problem with the right margin, which is too short. If you load geometry with option verbose, you'll see in the .log file the right margin is nearly 90pt. You can choose \geometry{right=120pt} in the preamble, and add 30pt to the makebox command in \titleformat, like this: \makebox[\dimexpr\oddsidemargin+\hoffset+1in+30pt]. – Bernard Apr 27 at 22:22
  • yes I understand. Figth with Latex geometry it's not easy. For example see the new updatade in my post please – Gianni Spear Apr 27 at 22:55
  • probably the best option is setting chapter by chapeter the black bar size – Gianni Spear Apr 27 at 23:06

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.