summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/version-for-tex4ht/pgfmanual-tex4ht.cfg
blob: 02bf46fe90b4d16cff5ddabbe7e7771b75ed713f (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>.
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt.

% Make sure to use tex4ht (or htlatex, to be precise) to compile this.

\usepackage{tex4ht}
\def\pgfsysdriver{pgfsys-tex4ht.def}

\usepackage{xkeyval}
\usepackage{colortbl}

\let\originalsetkeys=\setkeys

\makeatletter

\AtBeginDocument{
\let\setkeys=\originalsetkeys
\CutAt{section,part}
\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}
\definecolor{codebackground}{rgb}{0.8,0.8,1}
\definecolor{declarebg}{rgb}{1,0.8,0.8}
\definecolor{gray}{gray}{.5}

% Patches of macros...
\renewenvironment{pgfmanualentry}{\begin{description}}{\end{description}}
\renewcommand\pgfmanualentryheadline[1]{\item[\colorbox{declarebg}{\normalfont{#1}}]\par}
\renewcommand\pgfmanualbody{}

\def\endofcodeexample#1{%
  \endgroup%
  \ifcode@execute%
    \setbox\codeexamplebox=\hbox{%
      {%
        {%
          \returntospace%
          \commenthandler%
          \xdef\code@temp{#1}% removes returns and comments
        }%
        \color{black}\ignorespaces%
          \expandafter\scantokens\expandafter{\code@temp\ignorespaces}\ignorespaces%
      }%
    }%
    \ifdim\wd\codeexamplebox>\codeexamplewidth%
      \box\codeexamplebox
      \begin{tabular}{>{\columncolor{codebackground}}l}
        \begin{minipage}{\textwidth}
      {%
        \let\do\@makeother
        \dospecials
        \frenchspacing\@vobeyspaces
        \normalfont\ttfamily\footnotesize
        \typesetcomment%
        \@tempswafalse
        \def\par{%
          \if@tempswa
          \leavevmode \null \@@par\penalty\interlinepenalty
          \else
          \@tempswatrue
          \ifhmode\@@par\penalty\interlinepenalty\fi
          \fi}%
        \obeylines
        \everypar \expandafter{\the\everypar \unpenalty}%
        #1}
        \end{minipage}
      \end{tabular}%
    \else
      \begin{tabular}{>{\columncolor{graphicbackground}}l>{\columncolor{codebackground}}l}
        \ \box\codeexamplebox\ \par &
        \begin{minipage}[t]{\textwidth}
        {\let\do\@makeother
        \dospecials
        \frenchspacing\@vobeyspaces
        \normalfont\ttfamily\footnotesize
        \typesetcomment%
        \@tempswafalse
        \def\par{%
          \if@tempswa
          \leavevmode \null \@@par\penalty\interlinepenalty
          \else
          \@tempswatrue
          \ifhmode\@@par\penalty\interlinepenalty\fi
          \fi}%
        \obeylines
        \everypar \expandafter{\the\everypar \unpenalty}%
        #1}
        \end{minipage}
      \end{tabular}
    \fi
  \else%
    \begin{tabular}{>{\columncolor{codebackground}}l}
      \begin{minipage}[t]{\textwidth}
      {%
        \let\do\@makeother
        \dospecials
        \frenchspacing\@vobeyspaces
        \normalfont\ttfamily\footnotesize
        \typesetcomment%
        \@tempswafalse
        \def\par{%
          \if@tempswa
          \leavevmode \null \@@par\penalty\interlinepenalty
          \else
          \@tempswatrue
          \ifhmode\@@par\penalty\interlinepenalty\fi
          \fi}%
        \obeylines
        \everypar \expandafter{\the\everypar \unpenalty}%
        #1}
       \end{minipage}
     \end{tabular}%
  \fi%
  \par%
  \end{codeexample}
}
}



\makeatother