File: colorcode.fmt

package info (click to toggle)
lhs2tex 1.24-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,976 kB
  • sloc: haskell: 4,408; makefile: 314; sh: 221
file content (71 lines) | stat: -rwxr-xr-x 1,785 bytes parent folder | download | duplicates (7)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
%if False
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% colorcode.fmt
%
% colored code for poly style in lhs2TeX
%
% Permission is granted to include this file (or parts of this file) 
% literally into other documents, regardless of the conditions or 
% license applying to these documents.
%
% Andres Loeh, January 2008, ver 1.7
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%endif
%if not lhs2tex_colorcode_fmt_read
%let lhs2tex_colorcode_fmt_read = True
%include polycode.fmt
%
%if style /= newcode
\ReadOnlyOnce{colorcode.fmt}%

\RequirePackage{colortbl}
\RequirePackage{calc}

\makeatletter
\newenvironment{colorhscode}%
  {\hsnewpar\abovedisplayskip
   \hscodestyle
   \tabular{@@{}>{\columncolor{codecolor}}p{\linewidth}@@{}}%
   \let\\=\@@normalcr
   \(\pboxed}%
  {\endpboxed\)%
   \endtabular
   \hsnewpar\belowdisplayskip
   \ignorespacesafterend}

\newenvironment{tightcolorhscode}%
  {\hsnewpar\abovedisplayskip
   \hscodestyle
   \tabular{@@{}>{\columncolor{codecolor}\(}l<{\)}@@{}}%
   \pmboxed}%
  {\endpmboxed%
   \endtabular
   \hsnewpar\belowdisplayskip
   \ignorespacesafterend}

\newenvironment{barhscode}%
  {\hsnewpar\abovedisplayskip
   \hscodestyle
   \arrayrulecolor{codecolor}%
   \arrayrulewidth=\coderulewidth
   \tabular{||p{\linewidth-\arrayrulewidth-\tabcolsep}@@{}}%
   \let\\=\@@normalcr
   \(\pboxed}%
  {\endpboxed\)%
   \endtabular
   \hsnewpar\belowdisplayskip
   \ignorespacesafterend}
\makeatother

\def\colorcode{\columncolor{codecolor}}
\definecolor{codecolor}{rgb}{1,1,.667}
\newlength{\coderulewidth}
\setlength{\coderulewidth}{3pt}

\newcommand{\colorhs}{\sethscode{colorhscode}}
\newcommand{\tightcolorhs}{\sethscode{tightcolorhscode}}
\newcommand{\barhs}{\sethscode{barhscode}}

\EndFmtInput
%endif
%endif