You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.1 KiB

\usepackage{xifthen}% provides \isempty test
\usepackage{xstring}
\newcommand\chapterillustration{}
\makeatletter
\setkomafont{chapter}{\let\@hangfrom\chapterhang\let\raggedsection\raggedleft\huge}
\makeatother
\newbox\chapternumberbox
\newcommand{\chapterhang}[2]{%
\StrLen{\chapterillustration}[\imgnamelen]\ifthenelse{\imgnamelen > 1}{%
\tikz[remember picture,overlay] \node[opacity=1.0,inner sep=0pt] at (current page.north){\includegraphics[width=\paperwidth,height=.59\paperheight]{\chapterillustration}};%
}{}%
\savebox\chapternumberbox{\fontsize{100}{100}\normalfont\sffamily\bfseries
\thechapter}%
\parbox[t]{\dimexpr\linewidth-\wd\chapternumberbox-1em}{%
\raggedleft
\makebox[1em][l]{\normalfont\normalsize\slshape\chapapp}\\
#2%
}\quad
\raisebox{-1.75\baselineskip}{\usebox\chapternumberbox}\par
}
\iffalse
%https://komascript.de/comment/5067#comment-5067
\setkomafont{chapter}{\huge}
\makeatletter
% Hack: Eigenen, rudimentären Kapitelstil definieren.
\newcommand*{\scr@dsc@def@style@xchapter@command}[1]{%
\scr@dsc@def@style@chapter@command{#1}%
\expandafter\def\csname @@make#1head\endcsname##1{%
\let\orig@raggedchapter\raggedchapter
\let\raggedchapter\raggedleft
\let\orig@hangfrom\@hangfrom
\let\@hangfrom\chapterhang
\scr@@makechapterhead{#1}{##1}%
\let\@hangfrom\orig@saved@hangfrom
\let\raggedchapter\orig@raggedchapter
}%
}
\makeatother
\DeclareSectionCommand[style=xchapter]{chapter}
\newbox\chapternumberbox
\newcommand{\chapterhang}[2]{%
\tikz[remember picture,overlay] \node[opacity=1.0,inner sep=0pt] at (current page.north){\includegraphics[width=\paperwidth,height=.59\paperheight]{\chapterillustration}};%
\savebox\chapternumberbox{\fontsize{100}{100}\normalfont\sffamily\bfseries
\thechapter}%
\parbox[t]{\dimexpr\linewidth-\wd\chapternumberbox-1em}{%
\raggedleft
\makebox[1em][l]{\normalfont\normalsize\slshape\chapapp}\\
#2%
}\quad
\raisebox{-1.75\baselineskip}{\usebox\chapternumberbox}\par
}
\fi
%\pagestyle{scrheadings}
%\ihead[]{\headmark}
%\ohead[]{\pagemark}
%%\cfoot[]{Selfhosting}
%\ifoot[]{ }
%\ofoot[]{ }