-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathspine.tex
500 lines (463 loc) · 18 KB
/
spine.tex
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% spine.tex
%% NOVA thesis document template
%%
%% This work is licensed under the
%% The LaTeX project public license (LPPL), version 1.3c
%% To view a copy of this license, visit
%% https://www.latex-project.org/lppl/lppl-1-3c/
%%
%% Authors / Contributors:
%% - João Lourenço <[email protected]>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{NT FILE spine.tex}%
% Draw the book spine
% usable range: 145 to 425 pages, maximum characters for the title 140 and 22 for the author name
% usable range: 75 to 145 pages, maximum characters for the title 70 and 22 for the author name
\makeatletter
\input{NOVAthesisFiles/fitbox2.sty}
\spine(tab,spec):=?{{@{}c@{}}}
% \def\def@ult#1(#2)=#3{\ifdatadefined{#1}(#2){}{\csname#1\endcsname(#2)={#3}}}
\spine(author):=?{\thedocauthor(name,short)}
\datamatch{\match}{doctitle}({\@LANG@COVER,spine,cover},{\@LANG@COVER,spine})%
\spine(title):=?{\match}
% \typeout{SPINE=[\@LANG@COVER][\thespine(title)]}
\spine(date)=?{\thentdocdate(submission,year)}
% Defaults for spine
\spine(logo):=?{none}
\spine(order):=?{date,title,author,logo}
\spine(order,widthskip):={}
\spine(order,widthskip):={logo,\thespine(order,widthskip)}
\spine(angle):=?{0}
\spine(boxsep):=?{0.5cm}
\spine(image):=?{none}
\spine(bg,color):=?{none}
\spine(frame,color):=?{black!50}
\spine(text,color):=?{black}
\spine(text,align):=?{c}
\spine(margin,top):=?{1mm}
\spine(margin,bottom):=?{1mm}
\spine(margin,left):=?{0.5cm}
\spine(margin,right):=?{0.5cm}
\spine(tikzbg):=?{}
% Defaults for spine boxes
\spine(box,margin):=?{0.5mm}
\spine(box,bg,color):=?{none}
\spine(box,text,color):=?{black}
\spine(box,logo,len):=?{4.1cm}
\spine(box,logo,angle)=?{0}
\spine(box,logo,align):=?{c}
\spine(box,logo,raise):=?{0pt}
\spine(box,logo,scale):=?{1}
\spine(box,logo,margin,left)=?{0mm}
\spine(box,logo,margin,right):=?{0mm}
\spine(box,logo,margin,sep):=?{1mm}
\spine(box,author,len):=?{4.0cm}
\spine(box,author,angle)=?{\thespine(angle)}
\spine(box,author,align)=?{\thespine(text,align)}
\spine(box,author,margin,left):=?{0pt}
\spine(box,author,margin,right):=?{0pt}
\spine(box,title,len):=?{16.7cm}
\spine(box,title,angle)=?{\thespine(angle)}
\spine(box,title,align):=?{\thespine(text,align)}
\spine(box,title,margin,left):=?{0pt}
\spine(box,title,margin,right):=?{0pt}
\spine(box,date,len):=?{2.0cm}
\spine(box,date,angle)=?{\thespine(angle)}
\spine(box,date,align):=?{\thespine(text,align)}
\spine(box,date,margin,left):=?{0pt}
\spine(box,date,margin,right):=?{0pt}
\newif\ifisdim
\newcommand{\@setifisdim}[1]{%
\StrLeft{#1}{1}[\@dimleft]%
\StrRight{#1}{1}[\@dimright]%
\IfInteger{\@dimleft}{%
\IfInteger{\@dimright}{%
% Is a number
\isdimfalse%
}{%
% May be a dimension
\isdimtrue%
}%
}{%
% Is a string
\isdimfalse%
}%
}
\newcommand{\IfIsDim}[3]{%
\@setifisdim{#1}%
\ifisdim#2\else#3\fi%
}
\ifoptioncontains{/novathesis/debug}{spine}{%
\def\@spineboxdrawopacity{1}%
\newcommand{\DEBUG}[1]{\typeout{#1}}%
}{%
\def\@spineboxdrawopacity{0}%
\newcommand{\DEBUG}[1]{}%
}%
\newdimen\@spinelen % total spine length
\newcommand{\@checkspinelen}[1][\paperheight]{%
\@tempdima=\thespine(margin,left)\relax%
\@tempdimb=\thespine(margin,right)\relax%
\DEBUG{SPINELEN MARGIN [left] = \the\@tempdima}%
\DEBUG{SPINELEN MARGIN [right] = \the\@tempdimb}%
\@tempdima=\dimexpr\@tempdima+\@tempdimb\relax%
\DEBUG{SPINELEN ACCUMULATED = \the\@tempdima}%
\StrCount{\thespine(order)}{,}[\@nBoxSep]%
% \@tempdimb=\dimexpr\thespine(boxsep)*\@nBoxSep\relax%
% \DEBUG{SPINELEN BOXSEP [all] = \the\@tempdimb}%
% \@tempdima=\dimexpr\@tempdima+\@tempdimb\relax%
% \DEBUG{SPINELEN ACCUMULATED = \the\@tempdima}%
\@for\myi:=\expanded{\thespine(order)}\do{%
\DEBUG{SPINELEN BOXLEN [\myi]}%
\@tempdimb=\thespine(box,\myi,len)\relax%
\DEBUG{SPINELEN BOXLEN [\myi] = \the\@tempdimb}%
\@tempdima=\dimexpr\@tempdima+\@tempdimb\relax%
\DEBUG{SPINELEN ACCUMULATED = \the\@tempdima}%
}
\DEBUG{SPINELEN MAX = \the#1}%
\@spinelen=\@tempdima%
}
\newcommand{\@reverelist}[2]{%
% % #1 = list to be reversed
\def\@rvstmp{}%
\@for\myi:={#1}\do{%
\epreto\@rvstmp{,\myi}%
}%
\edef\@rvstmp{\expandafter\@gobble\@rvstmp}%
\edef#2{\@rvstmp}%
}
\providecommand*{\DivideLengths}[2]{%
\strip@pt\dimexpr\number\numexpr\number\dimexpr#1\relax*65536/\number\dimexpr#2\relax\relax sp\relax
}
\newcommand{\@setlength}[2]{%
\defifundef{#1}{\newlength}%
\@tempdima=\dimexpr#2\relax%
\setlength{#1}{\the\@tempdima}%
}
\newcommand{\ifnotnone}[2]{%
\IfStrEq{#1}{none}{}{#2}%
}
\newcommand{\@ntprintspine}{%x§
% If angle is 0 revere the order of the logos
\IfStrEqCase{\thespine(angle)}{%
{0}{\@reverelist{\expanded{\thespine(logo)}}\@logoorder%
\spine(logo):={\@logoorder}}%
{180}{\spine(margin,left2):={\thespine(margin,left)}%
\spine(margin,left):={\thespine(margin,right)}%
\spine(margin,right):={\thespine(margin,left2)}%
% \spine(box,logo,angle):={\number\numexpr\thespine(box,logo,angle)+180\relax}%
\@reverelist{\expanded{\thespine(order)}}\spineorder%
\spine(order):={\spineorder}}%
}[\CalssError{novathesis}{Invalid spine angle: \thespine(angle)! Should be wither “0” or “180”.}{}]
\@checkspinelen
% Increase box spacing if necessary
% Reduce default boxes length and keep given/forces boxes length
\@tempdima=\dimexpr\paperheight-\@spinelen\relax% = remaining space to fill spine
\ifdim\@tempdima>0pt\relax%
% spine FITS into paper height
\@tempdima=\dimexpr\@tempdima/\@nBoxSep\relax% = new box sep size
% \DEBUG{NEW BOXSEP=\the\@tempdima}
\spine(boxsep):={\the\@tempdima}% = set new boxsep
\else\ifdim\@tempdima<0pt\relax%
% spine DOES NOT FIT into paper height
\ClassError{novathesis}{Spine is \the\@tempdima\space too long: \the\@spinelen\space instead of \the\paperheight}
{Get some insight with “fgrep SPINELEN *.log”}{}
\fi\fi%
% % SPINE boxes are to large for the spine size, decrease spacing in the not-explicitly defined boxes
% \@tempdima=\dimexpr\paperheight-\@spinefixedlen\relax
% % \showthe\@tempdima
% \@tempdimb=\dimexpr\@spinelen-\@spinefixedlen\relax
% % \showthe\@tempdimb
% % \StrGobbleRight{\the\@tempdimb}{2}[\@SPVAR]
% \DEBUG{DL 1=[\the\@tempdima] 2=[\the\@tempdimb]}\AAAA
% \edef\@spinevarratio{\DivideLengths{\@tempdima}{\@tempdimb}}
% % \show\@spinevarratio
% \@for\myi:=\expanded{\thespine(order)}\do{%
% \ifdatadefined{spine}(box,\myi,len){%
% % Fixed box length, do not touch
% }{%
% % Variable box length, apply ratio
% \@tempdima=\dimexpr\thespine(box,\myi,len)\relax%
% % \DEBUG{OLD SPINEBOXLEN[\myi]=\the\@tempdima}
% \@tempdima=\dimexpr \@spinevarratio\@tempdima\relax
% % \DEBUG{NEW SPINEBOXLEN[\myi]=\the\@tempdima}
% \spine(box,\myi,len):={\the\@tempdima}
% }%
% }%
% \displayspinealyout
\@checkspinelen
% \DEBUG{PAPER HEIGHT=\the\paperheight}
% \DEBUG{SPINELEN[FINAL]=\the\@spinelen}
% \PAUSETHIS
% Calculate box[lef], box[len], box[right] if undefined
\@tempdima=\dimexpr\thespine(margin,left)-\thespine(boxsep)\relax%
\@for\myi:=\expanded{\thespine(order)}\do{
\ifdatadefined{spine}(box,\myi,left){%
\@tempdima=\thespine(box,\myi,left)%
}{%
\@tempdima=\dimexpr\@tempdima+\thespine(boxsep)\relax%
}%
\spine(box,\myi,left):={\the\@tempdima}%
\@tempdima=\dimexpr\@tempdima+\thespine(box,\myi,len)\relax%
\spine(box,\myi,right):={\the\@tempdima}
% \DEBUG{BOX[\myi,left]=\thespine(box,\myi,left)}
% \DEBUG{BOX[\myi,len]=\thespine(box,\myi,len)}
% \DEBUG{BOX[\myi,right]=\thespine(box,\myi,right)}
}%
\@for\myi:=\expanded{\thespine(order)}\do{%
% \DEBUG{TEXT[\myi]}
\datamatchtf{\@boxml}{spine}({box,\myi,margin,left},{box,margin,left}){}{\def\@boxml{0pt}}%
\datamatchtf{\@boxmr}{spine}({box,\myi,margin,right},{box,margin,right}){}{\def\@boxmr{0pt}}%
% \DEBUG{TEXT[\myi] [\@boxml] [\@boxmr]}
\@tempdima=\dimexpr\thespine(box,\myi,len)\relax%
\spine(box,\myi,len):={\the\@tempdima}%
\@tempdima=\dimexpr\@tempdima-\@boxml-\@boxmr\relax%
\spine(box,\myi,len2):={\the\@tempdima}%
% \DEBUG{TEXT[\myi,len]=\thespine(box,\myi,len)}
% \DEBUG{TEXT[\myi,len2]=\thespine(box,\myi,len2)}
}
\ifoptionequal{/novathesis/spine/layout}{none}{}{%
\parindent=0pt%
\sffamily%
\linespread{0.85}%
\normalsize%
\ifdim\option{/novathesis/spine/width}=0pt\relax%
\@setlength{\@spinewidth}{0.05mm * (\thelastsheet+1)}%
% \DEBUG{NOVATHESIS spine width for \thelastsheet\space pages is \the\@spinewidth!}%
\ifdim\@spinewidth < 6mm\relax% Force book spine to be at least 6mm
% \DEBUG{NOVATHESIS spine width was \the\@spinewidth, forcing to 6mm!}%
\@setlength{\@spinewidth}{6mm}%
\fi%
\else%
\@setlength{\@spinewidth}{\option{/novathesis/spine/width}}%
% \DEBUG{NOVATHESIS spine width user forced by user to \the\@spinewidth!}%
\fi%
% \DEBUG{NOVATHESIS \string\@spinewidth=\the\@spinewidth}%
\@setlength{\@thespinewidth}
{\dimexpr\@spinewidth-\thespine(margin,top)-\thespine(margin,bottom)\relax}%
\def\@fbratio{9999}%
\@for\myi:=\expanded{\thespine(order)}\do{%
\IfStrEq{\myi}{title}{%
\fitboxratio{@\myi RT}{\thespine(box,\myi,len2)}{\@thespinewidth}{\thespine(\myi)}%
\fitboxratio{@\myi 2RT}{\thespine(box,\myi,len2)}{\@thespinewidth}{\def\\{ }\thespine(\myi)}%
\pgfmathparse{\csuse{@\myi RT}}%
\edef\@tone{\pgfmathresult}%
\pgfmathparse{\csuse{@\myi 2RT}}%
\edef\@ttwo{\pgfmathresult}%
% \DEBUG{T1=\@tone\space T2=\@ttwo}\AAAAA%
\ifdim\@tone pt < \@ttwo pt\relax%
% \BBBBBBB%
\spine(\myi):={\def\\{ }\thespine(\myi)}%
\fi%
}{}%\ASDSDDSAS
\IfSubStr{,\thespine(order,widthskip),}{,\myi,}{}{%
\fitboxratio{@\myi RT}{\thespine(box,\myi,len2)}{\@thespinewidth}{\thespine(\myi)}%
% \DEBUG{NOVATHESIS RATIO[\myi]=\csuse{@\myi RT}}%
\pgfmathparse{min(\@fbratio,\csuse{@\myi RT})}%
% \DEBUG{NOVATHESIS RATIO MIN(\@fbratio,\csuse{@\myi RT})=\pgfmathresult}%
\edef\@fbratio{\pgfmathresult}%
}%
}%
% \DEBUG{NOVATHESIS RATIO=\@fbratio}
\currentpdfbookmark{\thebkmstring(spine)}{thespine}%
\ifoptionequal{/novathesis/spine/layout}{trim}{%
\stockwidth=\stockheight%
\stockheight=\@spinewidth%
}{\ifoptionequal{/novathesis/spine/layout}{full}{%
\let\oldstockwidth=\stockwidth
\stockwidth=\stockheight%
\stockheight=21cm%
}{%
\ClassError{novathesis}{Unknown page dimensions for “spine/layout=\option{/novathesis/spine/layout}”}
}}%
\paperwidth=\stockwidth%
\paperheight=\stockheight%
\setstocksize{\stockheight}{\stockwidth}%
\settrimmedsize{\stockheight}{\stockwidth}{*}%
% \paperheight=\@spinewidth%
\setlrmarginsandblock{0pt}{0pt}{*}%
\setulmarginsandblock{0pt}{*}{1}%
\setheaderspaces{0pt}{*}{*}%
\footskip = 0pt
\checkandfixthelayout[fixed]%
\ifluatex%
\pagewidth=\paperwidth%
\pageheight=\paperheight% \pageheight=3in
\else%
\pdfpagewidth=\paperwidth%
\pdfpageheight=\paperheight% \pageheight=3in
\fi%
\thispagestyle{empty}%
\NTRunHook{spine/pre}%
% \PAUSETHIS
\ifoptionequal{/novathesis/spine/layout}{trim}
{\@tempdima=0pt}
{\@tempdima=\dimexpr(\stockheight-\@spinewidth)/2\relax}%
\begin{tikzpicture}[remember picture, overlay,yscale=-1,yshift=-10.75pt+\@tempdima]%
% print spine bg color IF DEFINED
\datamatchtf{\arg}{spine}(%
{\@DOCTYPE,bg,color},%
{\@DOCCLASS,bg,color},%
{bg,color}%
){\ifnotnone{\arg}{\pagecolor{\arg}}}{%
\ClassError{novathesis}{Undefined spine “bg,color”}{}%
}%
% print frame IF DEFINED
\ifoptionequal{/novathesis/spine/layout}{full}{%
\datamatchtf{\arg}{spine}(%
{\@DOCTYPE,frame,color},%
{\@DOCCLASS,frame,color},%
{frame,color}%
){\ifnotnone{\arg}{\draw [color=\arg] (0,0) rectangle (\paperwidth-0.4pt,\@spinewidth-0.4pt);}}{%
\ClassError{novathesis}{Undefined spine “frame,color”}{}%
}%
}{}%
% print bg image IF DEFINED
\datamatchtf{\arg}{thesiscover}({\@DOCTYPE,spine,image},{\@DOCCLASS,spine,image},{spine,image}){%
\ifnotnone{\arg}{%
\node[inner sep=0] at (current page.center)
{\includegraphics[width=\paperheight,height=\paperwidth,
angle=\number\numexpr\thespine(angle)-90\relax]{\arg}};
}}{%
\datamatchtf{\arg}{spine}(%
{\@DOCTYPE,image},%
{\@DOCCLASS,image},%
{image},%
){%
\ifnotnone{\arg}{%
\node[inner sep=0] at (current page.center)
{\includegraphics[width=\paperheight,height=\paperwidth,
angle=\number\numexpr\thespine(angle)-90\relax]{\arg}};
}}{%
\ClassError{novathesis}{Undefined spine “image”}{}%
}%
}%
\@for\myi:=\expanded{\thespine(order)}\do{%
\datamatch{\@boxcolor}{spine}({box,\myi,bg,color},{box,bg,color})%
\node[rectangle,
inner sep = 0pt,
anchor = north west,
draw, color = red, draw opacity=\@spineboxdrawopacity,
fill = {\@boxcolor},
minimum width = \expanded{\thespine(box,\myi,len)},
minimum height = \@thespinewidth,
] (r\myi) at (\thespine(box,\myi,left),\expanded{\thespine(margin,top)}) {};
\datamatchtf{\@align}{spine}({box,\myi,align},{\myi,align},{text,align}){}{%
\ClassError{novathesis}{Invalid spine text alignment for “\myi”}{}%
}%
\IfStrEqCase{\@align}{%
{l}{\node [inner sep=0, anchor=west] at (r\myi.west)
{\printspinebox{\myi}{\@fbratio}};}%
{c}{\node [inner sep=0, anchor=center] at (r\myi)
{\printspinebox{\myi}{\@fbratio}};}%
{r}{\node [inner sep=0, anchor=east] at (r\myi.east)
{\printspinebox{\myi}{\@fbratio}};}%
}[{\node [inner sep=0, anchor=center] at (r\myi)
{\printspinebox{\myi}{\@fbratio}};}]%
}%
\end{tikzpicture}%
\ifoptioncontains{/novathesis/DEBUG}{cover}{%
\NTRunHook{cover/spine/grid/pre}%
\DEBUGgrid%
\NTRunHook{cover/spine/grid/post}%
}{}%
}%
}
\newcommand{\printspinebox}[2]{%
% 1=spine box name
% 2=ratio
\datamatchtf{\@item}{spine}(%
{#1,\@DOCCLASS},%
{#1,\@DOCTYPE},%
{#1}%
){}{\ClassError{novathesis}{Undefined spine element: #1}{}}%
\datamatchtf{\@angle}{spine}(%
{box,#1,\@DOCTYPE,angle},%
{box,#1,\@DOCCLASS,angle},%
{box,#1,angle},%
{#1,\@DOCTYPE,angle},%
{#1,\@DOCCLASS,angle},%
{#1,angle}%
){}{\def\@angle{\thespine(angle)}}%
\datamatchtf{\@scale}{spine}(%
{box,#1,\@DOCTYPE,scale},%
{box,#1,\@DOCCLASS,scale},%
{box,#1,scale},%
{#1,\@DOCTYPE,scale},%
{#1,\@DOCCLASS,scale},%
{#1,scale}%
){}{\def\@scale{1}}%
\datamatchtf{\@raise}{spine}(%
{box,#1,\@DOCTYPE,raise},%
{box,#1,\@DOCCLASS,raise},%
{box,#1,raise},%
{#1,\@DOCTYPE,raise},%
{#1,\@DOCCLASS,raise},%
{#1,raise}%
){}{\def\@raise{0pt}}%
% \DEBUG{L=[\thespine(logo)] IT(#1)=[\@item]}%
% \DEBUG{PRINT BOX #1 ITEM=\@item}%
% \DEBUG{PRINT BOX #1 ANGLE=\@angle}%
% \DEBUG{PRINT BOX #1 SCALE=\@scale}%
% \DEBUG{PRINT BOX #1 RAISE=\@raise}%
% \AAAA%
\IfStrEq{#1}{logo}{%
% IMAGE
\IfStrEq{\@item}{none}{}{%
\edef\@lspace{\thespine(box,logo,margin,sep)}%
\edef\@lwidth{\thespine(box,logo,len2)}%
\edef\@lheight{\@thespinewidth}%
% \DEBUG{W=\@lwidth\space H=\the\@lheight\space S=\@lspace}\FILE
\setbox1=\hbox{\hspace*{-\@lspace}}%
\@for\myj:={\@item}\do{%
\StrCut{\myj}{/}\@@lspace\@lfile%
% \DEBUG{LS=\@@lspace\space F=\@lfile}\FILE
\IfIsDim{\@@lspace}{}{\edef\@lfile{\@@lspace/\@lfile}\edef\@@lspace{0pt}}%
\StrCut{\@lfile}{/}\@lfile\@langle%
% \DEBUG{F=\@lfile\space A=\@langle}\FILE
\StrCut{\@langle}{/}\@langle\@lscale%
% \DEBUG{F=\@lfile\space A=\@langle\space S=\@lscale}\FILE
\IfStrEq{\@langle}{}{\edef\@langle{\@angle}}{}%
\IfStrEq{\@lscale}{}{\edef\@lscale{\@scale}}{}%
% \DEBUG{F=\@lfile\space A=\@langle\space S=\@lscale}\FILE
\setbox0=\hbox to \thespine(box,logo,len){\includegraphics[height=\@thespinewidth,angle=\number\numexpr\@langle-90\relax,
scale=\@lscale,origin=c]{\@lfile}}%
\setbox1=\hbox{\minipage{\wd1}\box1\endminipage\hspace*{\@lspace}\minipage{\wd1}\box0\endminipage\hspace{\@@lspace}}%
}
\ifdim\dimexpr\wd1\relax>\@lwidth\relax%
\setbox1=\hbox{\resizebox*{\@lwidth}{!}{\box1}}%
\fi%
\ifdim\dimexpr\ht1+\dp1\relax>\@lheight\relax%
\setbox1=\hbox{\rotatebox{-90}{\box1}}%
\setbox1=\hbox{\resizebox*{\@lheight}{!}{\box1}}%
\setbox1=\hbox{\rotatebox{90}{\box1}}%
\fi%
\box1%
}%
}{%
% \DEBUG{IT=[#1] V=[\thespine(#1)]}\AAAAA%
% TEXT
\rotatebox[origin=c]{\@angle}{%
\scalebox{\@fbratio}{%
\datamatchtf{\arg}{spine}({box,#1,text,gz},{box,text,color},{text,color}){\color{\arg}}{}%
\ifdatadefined{spine}(#1,\@UNIV/\@SCHL){%
\tabular{@{}c@{}}\thespine(#1,\@UNIV/\@SCHL)\endtabular%
}{%
\edef\@IT{#1}
\edef\@TABSPEC{\thespine(tab,spec)}%
\thespine(#1,font)\expandafter\tabular\@TABSPEC%
\ifdatadefined{spine}(#1,1)
{\@for\myi:={1,2,3,4,5,6,7,8,9}\do{%
\ifdatadefined{spine}(\@IT,\myi)
{\thespine(\@IT,\myi)}
{}%
}}
{\thespine(#1)}%
\endtabular%
}%
}%
}%
}%
% \PAUSETHIS
}