6

Half a year ago, the following code

\documentclass[             fontsize=12pt,
% monochrome,
a4paper,               
parskip=half,      
ngerman,
headinclude=true,
footinclude=false,
captions=tableheading,
numbers=noenddot,
headings=big]
%chapterprefix=true]   % 
{scrreprt}

\usepackage[english,ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{blindtext}
\usepackage{etoolbox}

% Define own Chapter style
% Pretty chapter pages
%------------------------------------------
\definecolor{nicered}{rgb}{.647,.129,.149}
\usepackage{soul}
\usepackage{pdfpages}

\makeatletter
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
    \sbox\feline@chapter{%
        \resizebox{!}{#1}{\fboxsep=1pt%
            \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
        }}%
        \rotatebox{90}{%
            \resizebox{%
                \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
            {!}{\scshape\so\@chapapp}}\quad%
        \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
    }
    \newcommand\feline@chm[1][4cm]{%
        \sbox\feline@chapter{\feline@chapter@marker[#1]}%
        \makebox[0pt][l]{% aka \rlap
            \makebox[1cm][r]{\usebox\feline@chapter}%
        }}   

        \renewcommand*{\chapterformat}{%
            \hspace{\leftmargin} \feline@chm[2.5cm] % Height of the colored box
            \hspace{2cm}
        }

        \patchcmd{\@@makechapterhead}
        {\size@chapter{#1}}
        {\size@chapter{\parbox[b]{\dimexpr\textwidth-4cm\relax}{\raggedright#1}}}
        {}
        {}
        \makeatother
        %------------------------------------------

        \begin{document}


            \chapter{Lorem ipsum dolor sit amet, consectetuer adipiscing elit}
            \blindtext[2]
        \end{document}

created this documententer image description here but no it seems that it doesn't work any more (I formated my pc and reinstalled Miktex and Texstudio) and now it looks like in this picture enter image description here What can I do to get the old output back?

jlk
  • 1,729

1 Answers1

6

Recommendation

When you use \patchcmd, it is really important to put markers in for when things stop working e.g.

\patchcmd{\@@makechapterhead}
{\size@chapter{#1}}
{\size@chapter{\parbox[b]{\dimexpr\textwidth-4cm\relax}{\raggedright#1}}}
{\typeout{great}}
{\typeout{too bad}}

which shows you that the patch is not successful when you examine the output. (Usually, you should use something more informative than the above, of course, so you know what is wrong. But this is just for demonstration purposes.)

So, evidently the command you are patching has changed such that your patch no longer takes.

Explanation

The current definition of that command is:

\newcommand*{\@@makechapterhead}[1]{%
  \@tempskipa=\glueexpr \scr@chapter@sectionbeforeskip\relax
  \ifdim\@tempskipa<\z@\@tempskipa-\@tempskipa\fi
  \chapterheadstartvskip
  {%
    \setlength{\parindent}{\z@}\setlength{\parfillskip}{\fill}%
    \normalfont\sectfont\nobreak\nobreak\usekomafont{chapter}{}%
     \def\IfUseNumber{\ifnumbered{chapter}}%
    \if@chapterprefix
      \raggedchapter
      \let\IfUsePrefixLine\@firstoftwo
      \let\@tempa\@firstofone
    \else
      \let\IfUsePrefixLine\@secondoftwo
      \let\@tempa\@hangfrom
    \fi
    \@tempa{%
      \IfUseNumber{%
        \usekomafont{chapter}{%
          \IfUsePrefixLine{%
            {\usekomafont{chapterprefix}{%
                \chapterformat\chapterheadmidvskip
            }}%
          }{%
            \chapterformat
          }%
        }%
      }{}%
    }%
    {%
      \IfUsePrefixLine{}{\raggedchapter}%
      \interlinepenalty \@M
      \usekomafont{chapter}{#1}\par
    }%
  }%
  \nobreak\par\nobreak
  \@tempskipa=\glueexpr \scr@chapter@sectionafterskip\relax
  \ifdim\@tempskipa<\z@\@tempskipa-\@tempskipa\fi
  \chapterheadendvskip
}

So \size@chapter{#1} is no longer used and etoolbox cannot find anything to patch.

Patch

Probably, you want something more like this:

\patchcmd{\@@makechapterhead}
{\usekomafont{chapter}{#1}}
{\parbox[b]{\dimexpr\textwidth-4cm\relax}{\raggedright\usekomafont{chapter}{#1}}}
{\typeout{great}}
{\typeout{too bad}}
\makeatother

repatched

cfr
  • 198,882
  • 2
  • Thank you really much, next time I will try to figure it out on my own. I had similar problems with beamer and the caption package. Is there a away let's say to force miktex to use for all packages let's say the version of a certain date ? – jlk Feb 21 '15 at 11:36
  • @harryhaller Sorry but I know nothing about MiKTeX. I don't do Windows ;). – cfr Feb 21 '15 at 16:39