Chapter section with horizontal line & numbering & color etc = Thesis template nightmare

I am fighting with a very horrible master thesis template. Some smart _ss designed some features which couldn't be done in MS Word without manual correction so I'm trying to make it works in LaTeX to hack it.

Here is some deal breakers:

The chapter format - Times New Roman, 14pt, Red color (incl. chapter number), capitalized, with line at the right side for even page and at the left side for odd page and with the number of the chapter.

The section format - Times New Roman, 12pt, with line at the right side for even page and at the left side for odd page and with the number of the section.

Same with subsection.

Heading and footer have colored line with a different page numbering for odd/even pages.

I've worked with LaTeX in past and I have a decent LaTeX knowledge but this is totally out of my skills. Could somebody, please, help me with definitions of those dealbreaker?

• Welcome to TeX.SX! Nice nickname! It looks like Italian, but you're writing in Czech. Hmm… – egreg Jan 24 '17 at 16:17
• @egreg Just for curiosity, I put "sto cosi cosi" into Google translator from Czech to Italian and I get "un centinaio e qualcosa qualcosa". I'm wondering if they know that in Italian it means "Jsem tak tak"... :):):) – CarLaTeX Jan 24 '17 at 17:10
• @CarLaTeX Ofcourse I do! | Certo, lo so. | Samozřejmě, že vím. ;-) – Sto.cosi.cosi Jan 26 '17 at 6:32
• A very funny thing! – CarLaTeX Jan 26 '17 at 6:34
• It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you. – Dai Bowen Feb 21 '17 at 16:13

Here is a way the sectioning commands layout with titlesec:

\documentclass[a4paper]{report}% http://ctan.org/pkg/amsproc
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[x11names,]{xcolor}
\usepackage{fourier}
\usepackage{microtype}
\SetTracking[no ligatures={f}]{encoding=*}{80}
\usepackage[strict]{changepage}%
\usepackage{lipsum}

\usepackage[explicit]{titlesec}%

\titleformat{\chapter}[hang]
{\bfseries\fontsize{14pt}{14pt}\selectfont\color{IndianRed3}\lsstyle}
{\checkoddpage\ifoddpage\llap{\makebox[\dimexpr\marginparsep+\marginparwidth\relax][l]{\rule[-1.25ex]{\marginparwidth}{0.5ex}\llap{\thechapter}}}\else\thechapter\enspace \fi}
{0pt}
{\MakeUppercase{#1}\checkoddpage\ifoddpage\else\hfill\rlap{\makebox[\dimexpr\textwidth + \marginparsep][l]{\hspace{\marginparsep}\rlap{\rule[-1.25ex]{\marginparwidth}{0.5ex}}\thechapter}}\fi}%\titlerule[1.5pt]
\titlespacing*{\chapter}{0pt}{2ex}{1ex}
%
\titleformat{\section}
{\bfseries\large}
{\checkoddpage\ifoddpage\llap{\makebox[\dimexpr\marginparsep+\marginparwidth\relax][l]{\rule[-1.25ex]{\marginparwidth}{0.5ex}\llap{\thesection}}}\else\thesection\enspace \fi}
{0pt}
{#1\checkoddpage\ifoddpage\else\hfill\rlap{\makebox[\dimexpr\textwidth + \marginparsep][l]{\hspace{\marginparsep}\rlap{\smash{\rule[-1.25ex]{\marginparwidth}{0.5ex}}}\thesection}}\fi}%\titlerule[1.5pt]
\titlespacing*{\section}{0pt}{1ex}{0.5ex}

\titleformat{\subsection}
{\bfseries}
{\checkoddpage\ifoddpage\llap{\makebox[\dimexpr\marginparsep+\marginparwidth\relax][l]{\rule[-1.25ex]{\marginparwidth}{0.5ex}\llap{\thesubsection}}}\else\thesubsection\enspace \fi}
{0pt}
{#1\checkoddpage\ifoddpage\else\hfill\rlap{\makebox[\dimexpr\textwidth + \marginparsep][l]{\hspace{\marginparsep}\rlap{\smash{\rule[-1.25ex]{\marginparwidth}{0.5ex}}}\thesubsection}}\fi} \titlespacing*{\subsection}{0pt}{1ex}{0.5ex}

\begin{document}

\chapter{Introduction}

\lipsum[1]

\section{Motivation}
\lipsum[2]

\subsection{A First Motivation}

\lipsum[3]
\newpage

\chapter{Introduction}

\lipsum[1]

\section{Motivation}
\lipsum[2]

\subsection{A First Motivation}

\lipsum[3]

\end{document}


• Bernard, thank you! It is possible to do it somehow with side numbers only on even pages? The odd pages should be only with the color line and no numbers. – Sto.cosi.cosi Jan 25 '17 at 8:38
• @Sto.cosi.cosi: Please see my updated answer. I do it with the \isoddpage test from changepage. Note it requires two compilations. – Bernard Jan 25 '17 at 9:42
• Thx for the updated version. The lines should at odd pages should be on the left edge, next to numbers. I've tried to mess around little bit with your code but again, I wasn't successful. Could you help me again, please? – Sto.cosi.cosi Feb 2 '17 at 13:51
• @Sto.cosi.cosi: I've adjusted my answer. Does it fit better what you want? – Bernard Feb 3 '17 at 1:31
• I think the lines should be in the outer margin, and the OP just confused stuff. – Johannes_B Feb 21 '17 at 17:42