forked from Open-Advice/Open-Advice
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Open-Advice.sty
39 lines (38 loc) · 1.22 KB
/
Open-Advice.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\newif\ifusinght
\makeatletter
\@ifundefined{HCode}{\usinghtfalse}{\usinghttrue}
\makeatother
\newcommand{\authorbio}[1]{\vspace{-14pt}\noindent\textit{#1}\vspace{14pt}\noindent}
\usepackage{ifthen}
\ifusinght
\newcommand*{\chapterwithauthor}[3][\empty]{%
\ifthenelse{\equal{#1}{\empty}}
{\chapter{#3}{#2}}%
{\chapter[#1]{#3}{#2}}%
}
\else
\renewcommand*{\chaptermarkformat}{}
\renewcommand*{\chapterheadstartvskip}{\vspace*{0.5\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace*{1\baselineskip}}
\makeatletter
\newcommand*{\chapterwithauthor}[3][\empty]{%
\ifthenelse{\equal{#1}{\empty}}
{\gdef\chapterauthor{#2}\chapter{#3}}%
{\gdef\chapterauthor{#2}\chapter[#1]{#3}}%
}
\renewcommand*{\chapterformat}{\thechapter\autodot\hskip 1pc}
\newlength{\authorindent}
\gdef\chapterauthor{}
\renewcommand*{\chapterheadendvskip}{%
\ifx\chapterauthor\@empty\else
\markright{\chapterauthor}%
\vskip\baselineskip\nobreak
\settowidth{\authorindent}{{%
\usekomafont{sectioning}\usekomafont{chapter}\chapterformat
}}%
\begin{flushright}\sffamily\hspace*{\authorindent}\chapterauthor\par\nobreak
\global\let\chapterauthor\@empty\end{flushright}
\fi
\noindent\par\nobreak\vskip 2\baselineskip%
}
\fi