try Apple AArch64 again
[cabal.git] / doc / hcar / hcar.sty
blob0d45bdc71a4fccf46ef2f608b7cf4ac4f3f82f6c
1 \ProvidesPackage{hcar}
3 \newif\ifhcarfinal
4 \hcarfinalfalse
5 \DeclareOption{final}{\hcarfinaltrue}
6 \ProcessOptions
8 \RequirePackage{keyval}
9 \RequirePackage{color}
10 \RequirePackage{array}
12 \ifhcarfinal
13 \RequirePackage[T1]{fontenc}
14 \RequirePackage{lmodern}
15 \RequirePackage{tabularx}
16 \RequirePackage{booktabs}
17 \RequirePackage{framed}
18 \RequirePackage[obeyspaces,T1]{url}
19 \RequirePackage
20 [bookmarks=true,colorlinks=true,
21 urlcolor=urlcolor,
22 linkcolor=linkcolor,
23 breaklinks=true,
24 pdftitle={Haskell Communities and Activities Report}]%
25 {hyperref}
26 \else
27 \RequirePackage[obeyspaces]{url}
28 \fi
29 \urlstyle{sf}
31 \definecolor{urlcolor}{rgb}{0.1,0.3,0}
32 \definecolor{linkcolor}{rgb}{0.3,0,0}
33 \definecolor{shadecolor}{rgb}{0.9,0.95,1}%{0.98,1.0,0.95}
34 \definecolor{framecolor}{gray}{0.9}
35 \definecolor{oldgray}{gray}{0.7}
37 \newcommand{\Contact}{\subsubsection*{Contact}}
38 \newcommand{\FurtherReading}{\subsubsection*{Further reading}}
39 \newcommand{\FuturePlans}{\subsubsection*{Future plans}}
40 \newcommand{\WhatsNew}{\subsubsection*{What is new?}}
42 \newcommand{\Separate}{\smallskip\noindent}
43 \newcommand{\FinalNote}{\smallskip\noindent}
45 \newcommand{\urlpart}{\begingroup\urlstyle{sf}\Url}
46 \newcommand{\email}[1]{\href{mailto:\EMailRepl{#1}{ at }}{$\langle$\urlpart{#1}$\rangle$}}
47 \newcommand{\cref}[1]{($\rightarrow\,$\ref{#1})}
49 \ifhcarfinal
50 \let\hcarshaded=\shaded
51 \let\endhcarshaded=\endshaded
52 \else
53 \newsavebox{\shadedbox}
54 \newlength{\shadedboxwidth}
55 \def\hcarshaded
56 {\begingroup
57 \setlength{\shadedboxwidth}{\linewidth}%
58 \addtolength{\shadedboxwidth}{-2\fboxsep}%
59 \begin{lrbox}{\shadedbox}%
60 \begin{minipage}{\shadedboxwidth}\ignorespaces}
61 \def\endhcarshaded
62 {\end{minipage}%
63 \end{lrbox}%
64 \noindent
65 \colorbox{shadecolor}{\usebox{\shadedbox}}%
66 \endgroup}
67 \fi
69 \ifhcarfinal
70 \newenvironment{hcartabularx}
71 {\tabularx{\linewidth}{l>{\raggedleft}X}}
72 {\endtabularx}
73 \else
74 \newenvironment{hcartabularx}
75 {\begin{tabular}{@{}m{.3\linewidth}@{}>{\raggedleft}p{.7\linewidth}@{}}}
76 {\end{tabular}}
77 \fi
79 \ifhcarfinal
80 \let\hcartoprule=\toprule
81 \let\hcarbottomrule=\bottomrule
82 \else
83 \let\hcartoprule=\hline
84 \let\hcarbottomrule=\hline
85 \fi
87 \define@key{hcarentry}{chapter}[]{\let\level\chapter}
88 \define@key{hcarentry}{section}[]{\let\level\section}
89 \define@key{hcarentry}{subsection}[]{\let\level\subsection}
90 \define@key{hcarentry}{subsubsection}[]{\let\level\subsubsection}
91 \define@key{hcarentry}{level}{\let\level=#1}
92 %\define@key{hcarentry}{label}{\def\entrylabel{\label{#1}}}
93 \define@key{hcarentry}{new}[]%
94 {\let\startnew=\hcarshaded\let\stopnew=\endhcarshaded
95 \def\startupdated{\let\orig@addv\addvspace\let\addvspace\@gobble}%
96 \def\stopupdated{\let\addvspace\orig@addv}}
97 \define@key{hcarentry}{old}[]{\def\normalcolor{\color{oldgray}}\color{oldgray}}%
98 \define@key{hcarentry}{updated}[]%
99 {\def\startupdated
100 {\leavevmode\let\orig@addv\addvspace\let\addvspace\@gobble\hcarshaded}%
101 \def\stopupdated{\endhcarshaded\let\addvspace\orig@addv}}
103 \def\@makeheadererror{\PackageError{hcar}{hcarentry without header}{}}
105 \newenvironment{hcarentry}[2][]%
106 {\let\level\subsection
107 \let\startupdated=\empty\let\stopupdated=\empty
108 \let\startnew=\empty\let\stopnew=\empty
109 %\let\entrylabel=\empty
110 \global\let\@makeheaderwarning\@makeheadererror
111 \setkeys{hcarentry}{#1}%
112 \startnew\startupdated
113 \level{#2}%
114 % test:
115 \global\let\@currentlabel\@currentlabel
116 %\stopupdated
117 \let\report@\empty
118 \let\groupleaders@\empty
119 \let\members@\empty
120 \let\contributors@\empty
121 \let\participants@\empty
122 \let\developers@\empty
123 \let\maintainer@\empty
124 \let\status@\empty
125 \let\release@\empty
126 \let\portability@\empty
127 \let\entry@\empty}%
128 {\stopnew\@makeheaderwarning}%
130 \renewcommand{\labelitemi}{$\circ$}
131 \settowidth{\leftmargini}{\labelitemi}
132 \addtolength{\leftmargini}{\labelsep}
134 \newcommand*\MakeKey[2]%
135 {\expandafter\def\csname #1\endcsname##1%
136 {\expandafter\def\csname #1@\endcsname{\Key@{#2}{##1}}\ignorespaces}}
137 \MakeKey{report}{Report by:}
138 \MakeKey{status}{Status:}
139 \MakeKey{groupleaders}{Group leaders:}
140 \MakeKey{members}{Members:}
141 \MakeKey{contributors}{Contributors:}
142 \MakeKey{participants}{Participants:}
143 \MakeKey{developers}{Developers:}
144 \MakeKey{maintainer}{Maintainer:}
145 \MakeKey{release}{Current release:}
146 \MakeKey{portability}{Portability:}
147 \MakeKey{entry}{Entry:}
149 \newcommand\Key@[2]{#1 & #2\tabularnewline}
151 \newcommand\makeheader
152 {\smallskip
153 \begingroup
154 \sffamily
155 \small
156 \noindent
157 \let\ohrule\hrule
158 \def\hrule{\color{framecolor}\ohrule}%
159 \begin{hcartabularx}
160 \hline
161 \report@
162 \groupleaders@
163 \members@
164 \participants@
165 \developers@
166 \contributors@
167 \maintainer@
168 \status@
169 \release@
170 \portability@
171 \hcarbottomrule
172 \end{hcartabularx}
173 \endgroup
174 \stopupdated
175 \global\let\@makeheaderwarning\empty
176 \@afterindentfalse
177 \@xsect\smallskipamount}
179 % columns/linebreaks, interchanged
180 \newcommand\NCi{&\let\NX\NCii}%
181 \newcommand\NCii{&\let\NX\NL}%
182 \newcommand\NL{\\\let\NX\NCi}%
183 \let\NX\NCi
184 \newcommand\hcareditor[1]{&#1 (ed.)&\\}
185 \newcommand\hcarauthor[1]{#1\NX}%
186 \newcommand\hcareditors[1]{\multicolumn{3}{c}{#1 (eds.)}\\[2ex]}