1

I gave a try to the proposition with a full exemple, but the chapter are not modified.

\documentclass[%
    paper=A4,                   % paper size --> A4 is default in Germany
    twoside=true,               % onesite or twoside printing
    openright,                  % doublepage cleaning ends up right side
    parskip=full,               % spacing value / method for paragraphs
    chapterprefix=true,         % prefix for chapter marks
    10pt,                       % font size
    headings=normal,            % size of headings
    bibliography=totoc,         % include bib in toc
    listof=totoc,               % include listof entries in toc
    titlepage=on,               % own page for each title page
    captions=tableabove,        % display table captions above the float env
    draft=false,                % value for draft version
 ]{scrreprt}%

 \usepackage{tikz}
 \usepackage{xcolor}

 \definecolor{ctcolormain}{cmyk}{1,.60,0,.40}
 \definecolor{ctcolorblack}{gray}{0}

 \newcommand\chapterpagedecoration{%
 \begin{tikzpicture}[remember picture,overlay,shorten >= -10pt]

 \coordinate (aux1) at ([yshift=-15pt]current page.north east);
 \coordinate (aux2) at ([yshift=-410pt]current page.north east);
 \coordinate (aux3) at ([xshift=-4.5cm]current page.north east);
 \coordinate (aux4) at ([yshift=-150pt]current page.north east);

 \begin{scope}[ctcolormain!40,line width=12pt,rounded corners=12pt]
 \draw
 (aux1) -- coordinate (a)
  ++(225:5) --
  ++(-45:5.1) coordinate (b);
 \draw[shorten <= -10pt]
  (aux3) --
  (a) --
  (aux1);
 \draw[opacity=0.6,ctcolormain,shorten <= -10pt]
  (b) --
  ++(225:2.2) --
  ++(-45:2.2);
\end{scope}
\draw[ctcolormain,line width=8pt,rounded corners=8pt,shorten <= -10pt]
  (aux4) --
  ++(225:0.8) --
  ++(-45:0.8);
 \begin{scope}[ctcolormain!70,line width=6pt,rounded corners=8pt]
 \draw[shorten <= -10pt]
  (aux2) --
  ++(225:3) coordinate[pos=0.45] (c) --
  ++(-45:3.1);
 \draw
  (aux2) --
  (c) --
  ++(135:2.5) --
  ++(45:2.5) --
  ++(-45:2.5) coordinate[pos=0.3] (d);   
 \draw 
  (d) -- +(45:1);
 \end{scope}
 \end{tikzpicture}%
}

 \let\cchapter\chapter
 \makeatletter
 \def\mchapter{% 
 \@ifstar{\@Starred}{\@nonStarred}%
 }
 \def\@Starred{%
 \@ifnextchar[%
 {\GenericWarning{}{Warning: A starred chapter can not have parameters. I am going to ignore them!}\@StarredWith}%
 {\@StarredWithout}%
 }      
 \def\@StarredWith[#1]#2{%
 \cchapter*{#2}%
 }
 \def\@StarredWithout#1{
 \cchapter*{#1}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\cchapter[#1]{#2}%
\clearpage
\refstepcounter{chapter}
\pagestyle{empty}

\begin{titlepage}

\noindent

\parbox[b]{\dimexpr\textwidth-3em\relax}{\raggedright \color{ctcolormain}
\titlefont Chapitre \thechapter \newline \newline \newline
\color{ctcolorblack} \subtitlefont #1}

 \null\vfill
 \vspace*{1cm}
\noindent
\hfill
\begin{minipage}{1\linewidth}
    \begin{abstract}\parbox[b]{\dimexpr\textwidth-2.5em\relax}{
#2}\end{abstract}
 \end{minipage}

 \chapterpagedecoration
 \end{titlepage}

 \addcontentsline{toc}{chapter}{\thechapter\hspace{1em}#1}
 \clearpage
 \pagestyle{plain}
}
\def\@nonStarredWithout#1{%
 \cchapter{#1}%
}
\makeatother

 \begin{document}

 \cchapter{First}{first comment}

 \cchapter{Second}

 \end{document}

What am I doing wrong ?

  • 1
    Welcome to TeX.SE. You have put all ingredients together to cook the meal named how do I screw up class and package code by mixing minitoc and scrreprt etc. You have to use \refstepcounter{chapter} not \stepcounter to get the references working. All other things are only guessing since there is no compilable code at all. – user31729 Sep 1 '17 at 15:36
  • See my answer below. Your basic mistake is the usage of \newcommand instead of \def which can take care of one two and more parameters in the same definition. Edit (The following may not be true according to other answer in the link I provide below): Using \newcommand means you can not handle starred, stared with optional, non starred and nonstarred with optional with the same name. just replace my \oldchapter and it's arguments with your functionality – koleygr Sep 1 '17 at 21:28
1

Edit After OP's comment

Full code with your decoration:

\documentclass[%
    paper=A4,                   % paper size --> A4 is default in Germany
    twoside=true,               % onesite or twoside printing
    openright,                  % doublepage cleaning ends up right side
    parskip=full,               % spacing value / method for paragraphs
    chapterprefix=true,         % prefix for chapter marks
    10pt,                       % font size
    headings=normal,            % size of headings
    bibliography=totoc,         % include bib in toc
    listof=totoc,               % include listof entries in toc
    titlepage=on,               % own page for each title page
    captions=tableabove,        % display table captions above the float env
    draft=false,                % value for draft version
 ]{scrreprt}%

 \usepackage{tikz}
 \usepackage{xcolor}

 \definecolor{ctcolormain}{cmyk}{1,.60,0,.40}
 \definecolor{ctcolorblack}{gray}{0}

 \newcommand\chapterpagedecoration{%
 \begin{tikzpicture}[remember picture,overlay,shorten >= -10pt]

 \coordinate (aux1) at ([yshift=-15pt]current page.north east);
 \coordinate (aux2) at ([yshift=-410pt]current page.north east);
 \coordinate (aux3) at ([xshift=-4.5cm]current page.north east);
 \coordinate (aux4) at ([yshift=-150pt]current page.north east);

 \begin{scope}[ctcolormain!40,line width=12pt,rounded corners=12pt]
 \draw
 (aux1) -- coordinate (a)
  ++(225:5) --
  ++(-45:5.1) coordinate (b);
 \draw[shorten <= -10pt]
  (aux3) --
  (a) --
  (aux1);
 \draw[opacity=0.6,ctcolormain,shorten <= -10pt]
  (b) --
  ++(225:2.2) --
  ++(-45:2.2);
\end{scope}
\draw[ctcolormain,line width=8pt,rounded corners=8pt,shorten <= -10pt]
  (aux4) --
  ++(225:0.8) --
  ++(-45:0.8);
 \begin{scope}[ctcolormain!70,line width=6pt,rounded corners=8pt]
 \draw[shorten <= -10pt]
  (aux2) --
  ++(225:3) coordinate[pos=0.45] (c) --
  ++(-45:3.1);
 \draw
  (aux2) --
  (c) --
  ++(135:2.5) --
  ++(45:2.5) --
  ++(-45:2.5) coordinate[pos=0.3] (d);   
 \draw 
  (d) -- +(45:1);
 \end{scope}
 \end{tikzpicture}%
 %\cleardoublepage% Uncomment if you want the content to start in next page after an empty one.
}

 \let\cchapter\chapter
 \makeatletter
 \def\mchapter{% 
 \@ifstar{\@Starred}{\@nonStarred}%
 }
 \def\@Starred{%
 \@ifnextchar[%
 {\GenericWarning{}{Warning: A starred chapter can not have parameters. I am going to ignore them!}\@StarredWith}%
 {\@StarredWithout}%
 }      
 \def\@StarredWith[#1]#2{%
 \cchapter*{#2}%
 \chapterpagedecoration
 }
 \def\@StarredWithout#1{
 \cchapter*{#1}%
 \chapterpagedecoration
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\cchapter[#1]{#2}%
\chapterpagedecoration
}
\def\@nonStarredWithout#1{%
 \cchapter{#1}%
 \chapterpagedecoration
}
\makeatother

 \begin{document}
 \tableofcontents

 \mchapter{First chapter}

 Some content

 \mchapter[Second changed toc title]{Second with other toc title}

 Some content 

 \mchapter*{Third Starred}

 Some content

 \section{test section}

 \mchapter{Fourth numbered 3}

 Final content

 \end{document}

Old answer

According to my answer here: https://tex.stackexchange.com/a/380116/120578

You could redefine chapter or section or whatever you want with the code:

\let\oldchapter\chapter
\makeatletter
\def\mchapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred chapter can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}      
\def\@StarredWith[#1]#2{%
\oldchapter*{#2}%
}
\def\@StarredWithout#1{
\oldchapter*{#1}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
}
\makeatother

Inside this code you can do anything you want and you have an additional starred chapter with optional argument for additional use like different page header than the original name of the chapter.

This method takes care of any kind of change on sectioning commands.

  • I have used oldchapter just to give the opportunity to change the real chapter command. – koleygr Sep 1 '17 at 21:24
  • Thanks for your solution. I tryed it but I guess I'm doing something wrong as the chapter modifications I have done have no impact. – user1595929 Sep 13 '17 at 9:40
  • @user1595929 Do you want the chapter title to have it's own page? Or just the decoration and content to same page? – koleygr Sep 13 '17 at 10:15
  • I added the code for what I suppose you want... – koleygr Sep 13 '17 at 10:20
  • @user1595929 Then, please accept the answer to show to next visitors that it works. – koleygr Sep 13 '17 at 21:26

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.