Recomendación

Recomendación

Hace medio año, el siguiente código

\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}

Creé este documento ingrese la descripción de la imagen aquípero no, parece que ya no funciona (formateé mi PC y reinstalé Miktex y Texstudio) y ahora se ve como en esta imagen. ingrese la descripción de la imagen aquí ¿Qué puedo hacer para recuperar la salida anterior?

Respuesta1

Recomendación

Cuando lo usas \patchcmd, es muy importante colocar marcadores para cuando las cosas dejen de funcionar, por ejemplo.

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

lo que le muestra que el parche no tuvo éxito cuando examina el resultado. (Por lo general, debería utilizar algo más informativo que lo anterior, por supuesto, para saber qué está mal. Pero esto es sólo para fines de demostración).

Entonces, evidentemente el comando que está parcheando ha cambiado de tal manera que su parche ya no funciona.

Explicación

La definición actual de ese comando es:

\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
}

Por lo tanto, \size@chapter{#1}ya no se usa y etoolboxno puedo encontrar nada para parchear.

Parche

Probablemente quieras algo más como esto:

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

reparchado

información relacionada