summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tex-overview/tex-overview-aux.tex
blob: 6991a789b13d840aba354ff7b2b098383a6a75ed (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
%% This document is part of the package tex-overview and is only useable with the main file tex-overview.tex.
%% author: Arno Trautmann

% !TeX root = tex-overview.tex
%% (for the TeXworks-users.)

\usepackage{
  bookmark,
  cooltooltips,
  dtklogos,  %% for \NTS etc.
  fontspec,
  geometry,
  hyperref,
  pdftexcmds,
  tikz,
  xcolor,
  xparse
}
%% circumventing a bug in cooltooltips
\makeatletter
  \let\topdfescapestring\pdf@escapestring
\makeatother

\ExplSyntaxNamesOn


%% define the look-and-feel of the document
\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Pagella}


%% setup the style of hyperlinks.
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  urlcolor=blue,
  pdfborder=0 0 0   %% don’t like these boxes
}

%% page layout, headings
\pagestyle{empty}
\addtokomafont{disposition}{\color[rgb]{.4 0 0}}
\addtokomafont{section}{\Huge}
\addtokomafont{subsection}{\LARGE}
\addtokomafont{subsubsection}{\Large}

%% some missing definitions for \TeX-like things
\tl_set:Nn\XeT{X\kern -.1667em\lower .5ex\hbox {E}\kern -.125emT\@}
\tl_set:Nn\ConTeXt{Con\TeX{}t}

%% constants for the colors. Might change from time to time …
\tl_set:Nn\vip{red}
\tl_set:Nn\normalimportant{blue}
\tl_set:Nn\experimental{yellow}
\tl_set:Nn\fonttechnology{pink}
\tl_set:Nn\program{black}
\tl_set:Nn\package{green}
\tl_set:Nn\distro{orange}
\tl_set:Nn\histdistro{purple}

%% shorthand to keep a good structure of the node positions
\fp_new:N\layer
\fp_new:N\layerdist
\fp_set:Nn\layer{0}
\fp_set:Nn\layerdist{-1}

%% width of the tooltip-boxes (negative value to make them disappear at all)
\dim_set:Nn\fboxrule{-1mm}

%% to separate important from not-so-important nodes
\bool_new:N\to_short

%% the token list to save all the textviews. When set once, it is reset. May be useful anyhow
\tl_set:Nn\to_textviews{}
\NewDocumentCommand\settextviews{}{
  \to_textviews
  \tl_set:Nn\to_textviews{}
}
\cs_gset:Nn\addtotextviews:f{\tl_gput_right:No\to_textviews{#1}}

%% environment to set the graphs
\NewDocumentCommand\tograph{sD(){}+m}
{
  \IfBooleanT{#1}{
    \ExplSyntaxNamesOn
    \bool_gset_true:N\to_short
    \ExplSyntaxNamesOff
    #2
    \begin{tikzpicture}
      #3
    \end{tikzpicture}
    \clearpage
  }
  \ExplSyntaxNamesOn
  \bool_gset_false:N\to_short
  \ExplSyntaxNamesOff
  #2
  \begin{tikzpicture}
  	#3
  \end{tikzpicture}
}

%% Style of the nodes: shade from a light 
\tikzstyle{coolnode} = [
	draw=\nodecolor!50!black!70,
	top color=\nodecolor!10!white!105,
	bottom color= \nodecolor!50!black!50
]

%% set the first default node style (will change to \distro or \program in the document)
\cs_set_eq:NN\tonodestyle\normalimportant

%% tonode ⇒ tex-overview node, now with better argument specifier
\NewDocumentCommand\tonode{O{\tonodestyle}D(){no label given}D(){no position given}D<>{no description given}m}{
%% save the content pdfescaped
  \tl_set:No\tonodecontent{\topdfescapestring{#4}}

%% test if we are in the short or full view
  \tl_gset:Nn\nodecolor{#1}
  \bool_if:NTF\to_short{
  %% short view
    \tl_if_eq:NNT#1{\vip}{   %% then check if this is an important node
      \node[coolnode]
	(#2) at (#3) {
        \cooltooltip{#2}{\tonodecontent}{\tonodecontent}{}{#5\strut}
      };
    }
  }{
  %% long view
    \node[coolnode] (#2) at (#3) {
      \cooltooltip{#2}{\tonodecontent}{\tonodecontent}{}{#5\strut}
    };
  %% and the text view, to be added only once!
  \addtotextviews:f{\subsubsection*{\color{blue}#5}\parbox{\columnwidth}{#4}}
  }
}

%% we want to make use of two pdf layers: the upper (main) one for the nodes
%% and the lower (background) one for the lines. That way, the lines will not cross the nodes
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

%% the command to draw from one node to the other one. Fine tuning is possible via optional argument #3
\NewDocumentCommand{\todraw}{st{'}t{.}t{-}O{}d()d()}{
  \begin{pgfonlayer}{background}
    %% draw in the case that: either a * is given (always draw) or (' is given and \to_short) or nothing is given
    \bool_if:nT{#1 || (#2 && \to_short) || !(#2 || \to_short)}
      {\draw [thick,gray,\IfBooleanT{#3}{dotted},\IfBooleanT{#4}{dashed},#5] (#6) to (#7);}  %% I’m just loooving expl3!
  \end{pgfonlayer}
}

%% a nice way to control the vertical position of nodes
\NewDocumentCommand{\setlayer}{m}{
  \fp_set:Nn\layer{#1}
}
\NewDocumentCommand{\steplayer}{O{\layerdist}}{
  \fp_add:Nn\layer{#1}
}

\NewDocumentCommand\topart{m}{
  \clearpage
  \dim_set:Nn\pdfpagewidth{9cm}       %% make a smaller paper so the header won’t feel so alone on the big, cold paper
  \dim_set:Nn\pdfpageheight{4cm}
  \newgeometry{margin=1cm}
	\part{#1}
	\newpage
  \restoregeometry
  \dim_set:Nn\pdfpagewidth{21cm}     %% back to a4
  \dim_set:Nn\pdfpageheight{29.7cm}
}

%% the following code is made to avoid code doubling on cost of readability. It is more an experiment of mine. This code is neither stable nor exemplary …
%% the first argument, given in (), determines the level of the d
\NewDocumentCommand\tostruct{D(){0}omO{\tonodestyle}}{
  \tl_set:Nn\to_disp{section}
  \int_compare:nT{#1 > 0}{\tl_put_left:Nn\to_disp{sub}}
  \int_compare:nT{#1 > 1}{\tl_put_left:Nn\to_disp{sub}}
  \bool_if:NTF\to_short
  {
    \int_compare:nT{#1 = 0}{\stepcounter{section}}
    \tl_gset:cn{\to_disp mand}{\cs:w the\to_disp\cs_end:.\hspace{.175em} #3\newline short view}
    \IfNoValueTF{#2}{\tl_gset:cn{\to_disp opt}{\tl_use:c{\to_disp mand}}}{\tl_gset:cn{\to_disp opt}{#2, short view}}
    \cs:w \to_disp \cs_end:*{\cs:w\to_disp mand\cs_end:}
    \int_compare:nT{#1 = 0}{\addtocounter{section}{-1}}
  }
  {
    \tl_gset:cn{\to_disp mand}{#3}
    \IfNoValueTF{#2}{\tl_gset:cn{\to_disp opt}{\cs:w \to_disp mand\cs_end:}}{\tl_gset:cn{\to_disp opt}{#2}}
    \addtotextviews:f{\cs:w \to_disp\cs_end:[#2]{#3}}
    \cs:w \to_disp\cs_end:[\cs:w \to_disp opt\cs_end:]{\cs:w \to_disp mand\cs_end:}
  }
  \cs_gset_eq:NN\tonodestyle#4
}

\NewDocumentCommand\overviewsection{omO{\tonodestyle}}{
  \bool_if:NTF\to_short
  {
    \stepcounter{section}
    \tl_gset:Nn\to_mandsect{\thesection.\hspace{.2em} #2\newline short view}
    \IfNoValueTF{#1}{\tl_gset:Nn\to_optsect{\to_mandsect}}{\tl_gset:Nn\to_optsect{#1, short view}}
    \section*{\to_mandsect}
    \addtocounter{section}{-1}
  }
  {
    \tl_gset:Nn\to_mandsect{#2}
    \IfNoValueTF{#1}{\tl_gset:Nn\to_optsect{\to_mandsect}}{\tl_gset:Nn\to_optsect{#1}}
    \addtotextviews:f{\section[#1]{#2}}
    \section[\to_optsect]{\to_mandsect}
  }
  \cs_gset_eq:NN\tonodestyle#3
}

\NewDocumentCommand{\overviewsubsection}{omO{\tonodestyle}}{
  \tl_set:Nn\to_mandsubsect{#2}
  \bool_if:NTF\to_short
  {
    \IfNoValueTF{#1}{\tl_set:Nn\to_optsubsect{\to_mandsubsect}}{\tl_set:Nn\to_optsubsect{#1, short view}}
    \subsection*{\to_mandsubsect}
  }
  {
    \IfNoValueTF{#1}{\tl_set:Nn\to_optsubsect{\to_mandsubsect}}{\tl_set:Nn\to_optsubsect{#1}}
    \addtotextviews:f{\subsection[#1]{#2}} %% there should be \to_opt[]sec in the first arg, but I’m too dumb to get it right
    \subsection[\to_optsubsect]{\to_mandsubsect}
  }
  \cs_gset_eq:NN\tonodestyle#3
}

\NewDocumentCommand{\overviewsubsubsection}{omO{\tonodestyle}}{
  \tl_set:Nn\to_mandsubsubsect{#2}
  \bool_if:NTF\to_short
  {
    \IfNoValueTF{#1}{\tl_set:Nn\to_optsubsubsect{\to_mandsubsubsect}}{\tl_set:Nn\to_optsubsubsect{#1, short view}}
  }
  {
    \IfNoValueTF{#1}{\tl_set:Nn\to_optsubsubsect{\to_mandsubsubsect}}{\tl_set:Nn\to_optsubsubsect{#1}}
    \addtotextviews:f{\subsubsection[#1]{#2}}  %% there should be \to_opt[]sec in the first arg, but I’m too dumb to get it right
  }

  \subsubsection[\to_optsubsubsect]{\to_mandsubsubsect}
  \cs_gset_eq:NN\tonodestyle#3
}

%% a command for creation of bib-items.
\NewDocumentCommand\tobibsection{m}{
  \subsection*{#1}
}
\NewDocumentCommand\tobibsubsection{m}{
  \subsection*{#1}
}
\NewDocumentCommand\tobib{mD<>{}O{}}{
  \vspace*{1.5ex}
\begin{minipage}{\textwidth}  %% to prevent page breaks
  \large #1\normalsize\\ \hspace*{1em} \parbox{\textwidth-1.5em}{\url{#2} #3}
\end{minipage}
}

\ExplSyntaxNamesOff

\AtBeginDocument{
  {
    \centering
    \huge\bfseries An overview of \TeX, its children\\ and their friends~\dots\par
    \flushright\parbox{4cm}{
    \Large \color[rgb]{.4 0 0} Arno Trautmann\\ \fontsize{9.85}{10}\selectfont arno.trautmann@gmx.de}
	\hspace*{2cm}\par
  }
	\vspace*{1cm}
}