6

I would like to replicate the following chapter style in LaTeX, so that a title page looks like the mock-up image below. How could I go about achieving this?

enter image description here

Here's a good point to start. I wouldn't like to have the upper box containing "Chapter …" on the contents page, so just the lower line with the text "More about LaTeX" replaced with "Contents", much like in the reference document below,

\documentclass[11pt]{book}
\usepackage[pass,paperwidth=6.85in,paperheight=9.3in]{geometry}
\usepackage[nottoc]{tocbibind}
\usepackage{titlesec}
\usepackage[titles]{tocloft}


\renewcommand\cftchapfont{\normalfont}
\renewcommand\cftchappagefont{\normalfont}

\AtBeginDocument{\renewcommand\contentsname{Table of Contents}}

\titleformat{\chapter}[display]
{}{\hfill\rule{.7\textwidth}{3pt}}{0pt}
{\hspace*{.3\textwidth}\huge\bfseries}[\addvspace{-1pt}]
\titleformat{name=\chapter,numberless}[display]
{}{\hfill\rule{.7\textwidth}{3pt}}{0pt}
{\hspace*{.3\textwidth}\huge\bfseries}[\addvspace{-1pt}]

\begin{document}

\frontmatter
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\chapter{Test Chapter}
\section{Test Subsection}

\end{document}

that gives:

enter image description here

I have added below a mock-up of what I would like to achieve.

enter image description here

6
+25

Here is a simpleminded proposal based on this answer, as well as this answer and this answer.

\documentclass[11pt]{book}
\usepackage[pass,paperwidth=6.85in,paperheight=9.3in]{geometry}
\usepackage[nottoc]{tocbibind}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[titles]{tocloft}
\usepackage{lipsum}

\AtBeginDocument{\renewcommand\contentsname{Table of Contents}}
\renewcommand\cftchapfont{\normalfont}
\renewcommand\cftchappagefont{\normalfont}

% based on https://tex.stackexchange.com/a/335945/121799
\newcommand\CustomChapterTitle[2][]{%
\begin{tikzpicture}
    \path(0,0) coordinate (O);
    \node (A) [right=0.3\textwidth of O,
    rectangle,minimum width=0.7\textwidth, minimum height=1cm,
    text=green!40!black, text width=0.7\textwidth-3mm,align=left,
    path picture={\draw[line width=1mm,orange] (path picture bounding box.south west) |- 
     (path picture bounding box.north east);},
    #1] 
    {#2};
\end{tikzpicture}
}
\newcommand\CustomSectionTitle[2][]{%
\begin{tikzpicture}
    \path(0,0) coordinate (O);
    \node (A) [right=0.45\textwidth of O,
    rectangle,minimum width=0.55\textwidth, minimum height=1cm,
    text=green!40!black, text width=0.55\textwidth-3mm,align=left,
    path picture={\draw[line width=1mm,orange] (path picture bounding box.north west) -- 
     (path picture bounding box.north east);},
    #1] 
    {#2};
\end{tikzpicture}
}
\titleformat{\chapter}[display]
{}{}{0em}
{\CustomChapterTitle[font=\huge\bfseries]{#1}}
\titleformat{name=\chapter,numberless}[display]
{}{}{0em}
{\CustomChapterTitle[font=\huge\bfseries]{#1}}
\titleformat{\section}[display]
{}{}{0em}
{\CustomSectionTitle[font=\large\bfseries]{#1}}
\titleformat{name=\section,numberless}[display]
{}{}{0em}
{\CustomSectionTitle[font=\large\bfseries]{#1}}


% Redefinition of ToC command to get centered heading
\makeatletter% from https://tex.stackexchange.com/a/157411/121799
\renewcommand\tableofcontents{%
  \section*{\contentsname
  \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
  \@starttoc{toc}%
}% from https://tex.stackexchange.com/a/173180/121799
\renewcommand\listoffigures{%
    \section*{\listfigurename
        \@mkboth{%
           \MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
    \@starttoc{lof}%
}%
\renewcommand\listoftables{%
    \section*{\listtablename
        \@mkboth{%
           \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}%
}%
\makeatother

\begin{document}

\frontmatter
\tableofcontents
\listoftables
\listoffigures

\mainmatter
\chapter{Test Chapter}
\section{Test Section}

\end{document}

enter image description here

enter image description here

  • It's not too far away, but see the mock-up image for a clearer picture of what I asked for. – wrb98 Sep 19 '18 at 16:16
  • 1
    @wrb98 I'm sorry, I misinterpreted your question. Better now? – user121799 Sep 19 '18 at 17:19

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.