hcar.sty 5.0 KB

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