0% found this document useful (0 votes)
34 views

A CD Cover Class: Sebastiano Vigna Printed May 4, 2008

The document describes a CD Cover Class for LaTeX. It allows users to create CD covers with commands to set the cover text, back text, track lists, and other elements. Key features include: - Commands like \covertext, \lefttracklist, and \makecover to set content and generate covers. - Support for single covers, slim covers, and generating multiple covers in a list. - Options for font size, alignment, and graphics instead of text. - The ability to create data files for each CD cover and compile them all at once.

Uploaded by

Geraldo Coelho
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

A CD Cover Class: Sebastiano Vigna Printed May 4, 2008

The document describes a CD Cover Class for LaTeX. It allows users to create CD covers with commands to set the cover text, back text, track lists, and other elements. Key features include: - Commands like \covertext, \lefttracklist, and \makecover to set content and generate covers. - Support for single covers, slim covers, and generating multiple covers in a list. - Options for font size, alignment, and graphics instead of text. - The ability to create data files for each CD cover and compile them all at once.

Uploaded by

Geraldo Coelho
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

A CD Cover Class

Sebastiano Vigna Printed May 4, 2008

Introduction

The purpose of this class is to print CD covers. The main design line is allowing the creation of labels with minimum eort, without restraining the freedom to customise. There is also some support for multiple cover printing. Since version 1.1, slim CD boxes are supported. Each CD cover is created by a number of commands which set the content of the front cover, back cover, track lists etc. After everything is ready, additional commands actually generate the covers. This is a very simple example:
\documentclass{cd} \begin{document} \covertext{ The Artist\\ \bfseries The Title } \leftspine{THE ARTIST} \centerspine{THE TITLE} \lefttracklist{ \track Song 1 \track Song 2 \track Song 3 } \leftinfo{Words and Music by The Artist} \makecover\par \makeback\par \end{document}

By compiling the le above, you will obtain your rst CD cover. Using \makeslimcover instead of \makecover and \makeback, you will obtain a single cover for a slim CD box. Equivalently, you can create a le CD.dat containing the lines between A \begin{document} and \makecover and compile with L TEX the le CD.tex (or slimCD.tex). This is a better mechanismeach CD should have its own data (.dat) le, which is run through the driver le CD.tex or the more powerful list 1

mechanism described below. This also allows to set some parameters one for all (for instance, the font family) in the driver le. My driver le, for instance, is as follows (see below for the non-standard commands):
\documentclass[a4paper]{cd} \usepackage[latin1]{inputenc} \usepackage{avant} \renewcommand\rmdefault{\sfdefault} \onecorrection{.2} \begin{document} \makeCD \end{document}

The CD class loads the article class, so commands like \Large or \smallskip are available. However, the CD class provides its own precise size-switching commands, A and for greater accuracy it is advisable to use L TEXs \\[ vspace ] mechanism in order to generate vertical spacing. Note that the class uses heavily the rotating package, so you must convert the resulting dvi le into PostScript R , or use directly pdflatex.

The Text Commands

The content of a CD cover are set using the self-explaining \covertext, \backtext, \insidetext, \leftspine, \centerspine, \rightspine, \lefttracklist, \righttracklist, \leftinfo and \rightinfo commands (\insidetext, \leftspine, \centerspine and \rightspine are ignored for slim covers). Note that by default the material contained in \covertext, \backtext and \insidetext is bottomaligned, and the arguments of the spine commands must not contain line breaks. The left and right track lists should use the \track command, which inserts a \par and an automatically numbered box with the track number. Should you need to set manually the track number, use \setindex{ n }. The text contained in \leftinfo and \rightinfo is bottom-aligned just under the respective track lists. Note that if the right information or track list box is empty, the left one will span across the whole cover. By default everything is typeset with no justication, and no paragraph indentation. One tenth of the current baseline skip is inserted between paragraphs. In extreme cases you may want to create dierent spines (e.g., for R.E.M.s Fables Of The Reconstruction); the \leftspinebis, \centerspinebis and \rightspinebis commands allows you to insert dierent content into the back spine.

The Graphic Commands

In the case you want to ll the cover or the inside of your CD with a picture, the commands \covergraphics and \insidegraphics work like \covertext and \insidetext, but they create no border (as opposed to the standard 1 cm border for text).

The Font Commands

The CD class provides some simple commands for switching the font dimension and line spacing. The command \fh{ height } sets the font height to the given number of points (line spacing is not aected), while \fhb{ height }{ baselineskip } sets both the font height and the baseline skip (usually 6/5 of the font height will work). Note that you can just write \fh7 in order to switch to a 7 point font, and that the \fhb command always sets \parskip to 1/10 of the current baseline skip, so \par will always space a little more than \\. When you issue a \newcd command, all fonts are reset to their default values. But there are a number of self-explaining commands, i.e., \coverfont, \backfont, \insidefont, \spinefont, \tracklistfont, \infofont and \indexfont, that allow to change the font assigned to a part of the cover. In fact, they are just oneargument macros whose arguments are expanded just before the corresponding text commands, and can contain other formatting parameters.

The Cover Creation Commands

Before setting the content of the cover, the \newcd command takes care of resetting everything to default values. In particular, \backtext is the same as \covertext (unless you change it explicitly), so usually you do not need to set the former (note that, of course, this does not happen with \covergraphics). Analogously, \backfont is the same as \coverfont. Once everything is set up, the \makecover and \makeback commands will create a cover and a back cover using the data set so far, whereas the \makeslimcover will create a slim cover. Both command have an optional argument that can contain any of the letters lrtb (left, right, top, bottom), which create the respective crop marks (note that the argument must be enclosed in brackets). The default value is lrtb. The possibility of partially eliminating crop marks is particularly useful when stacking several covers in the same sheet. A It is possible to create a single L TEX document containing a CD cover, but it is usually more useful to create a data le containing all CD-specic command, and include it from a driver le, containing the \makeCD or the \makeslimCD command. With no argument, it checks for the existence of a jobname.dat le A (where jobname is the root of the L TEXle under compilatione.g., CD.dat when compiling CD.tex). If such a le exists, it is input and then the (slim) CD cover is generated. Otherwise, the user is asked for a data le name (the CD class will try automatically to append the .dat extension to the name), which is read and processed. Of course, the optional argument (which, note again, must be enclosed in brackets) can be used to specify a data le name. Having a database of data les is particularly useful when using the \makelist or the \makeslimlist commands, which process an entire list of CDs, printing one cover (or two back covers) per page; the crop marks are suitably aligned so to minimise the cutting eort. The CD list must be contained in a list le, one data le name per line. With no argument, \makelist and \makeslimlist check for the existence of a CD.lst le. If it exists, it is input; otherwise, the user is asked for a list le name (the CD class will try automatically to append the .lst extension to the name), which is read and processed. Again, the optional argument can be used to specify a list le name.

The Options

You can pass to the CD class all the options of the article class (e.g., paper size). Moreover, there are options aligncovertop, aligninsidetop, alignbacktop and aligntop (the last one resumes the rst three ones), and analogously aligncovercenter, etc. that allow to change the default alignment behaviour. The covergraphics option lets you use the entire cover area (instead of a centered 10 cm10 cm square). Finally, the alignspine option forces vertical centring of the spine text on the real height of the box involved, rather than on the height of a generic upper case character. This is not usually what you want, since, e.g., accents can lead to ugly results. Experiment.

Getting Obsessed

PostScript fonts usually are set up in such a way that the metric of all digits is the same, regardless of the actual appearance. This (in particular with sansserif fonts) can lead to a very ugly alignment of two-digit track numbers in which either the rst or the last digit is a 1. The solution is to put in the preamble a \onecorrection{ fraction } command: the positioning of two-digit numbers either starting or ending with 1 will be corrected by the given fraction of the width of a 1. For instance, \onecorrection{.2} works great for AvantGarde. The values for other fonts must be set by trial-and-error.

The Code

First of all we manage all options. This is done with a \newif for alignspine, and by dening suitably some macros representing the alignment option for the cover, inside and back text. Default is b. All options we do not process are passed to the article class.
class \newif\if@lignspine 3 \@lignspinefalse
1 2 4 5 6 7 8 10 11 12 13 14 15 16 17 18 19 20 21

\DeclareOption{alignspine}{\@lignspinetrue}

\def\@ligncover{b} \def\@ligninside{b} 9 \def\@lignback{b} \DeclareOption{aligncovertop}{\def\@ligncover{t}} \DeclareOption{aligninsidetop}{\def\@ligninside{t}} \DeclareOption{alignbacktop}{\def\@lignback{t}} \DeclareOption{covergraphics}{\def\@lignback{t}} \DeclareOption{aligntop}% {\ExecuteOptions{aligncovertop,aligninsidetop,alignbacktop}} \DeclareOption{aligncovercenter}{\def\@ligncover{c}} \DeclareOption{aligninsidecenter}{\def\@ligninside{c}}

22 23 24 25 26 27 28 29

\DeclareOption{alignbackcenter}{\def\@lignback{c}} \DeclareOption{aligncenter}% {\ExecuteOptions{aligncovercenter,aligninsidecenter,alignbackcenter}} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax

Now we load the article class and the rotating package, which is fundamental in typesetting the spine text.
30 31

\LoadClass{article} \RequirePackage{rotating}

The \onecorrection command denes a the fraction used for correcting the alignment of 1s. The default is 0.
32 33

\DeclareRobustCommand*\onecorrection[1]{\def\onec@rrfrac{#1}} \onecorrection{0}

Now we have all the font and text declaration commands. They just dene a certain macro to be their argument.
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

\DeclareRobustCommand*\coverfont[1]{\def\coverf@nt{#1}} \DeclareRobustCommand*\backfont[1]{\def\backf@nt{#1}} \DeclareRobustCommand*\insidefont[1]{\def\insidef@nt{#1}} \DeclareRobustCommand*\spinefont[1]{\def\spinef@nt{#1}} \DeclareRobustCommand*\tracklistfont[1]{\def\tracklistf@nt{#1}} \DeclareRobustCommand*\infofont[1]{\def\infof@nt{#1}} \DeclareRobustCommand*\indexfont[1]{\def\indexf@nt{#1}} \DeclareRobustCommand{\lefttracklist}[1]{\def\lefttr@cklist{#1}} \DeclareRobustCommand{\righttracklist}[1]{\def\righttr@cklist{#1}} \DeclareRobustCommand{\leftinfo}[1]{\def\leftinf@{#1}} \DeclareRobustCommand{\rightinfo}[1]{\def\rightinf@{#1}} \DeclareRobustCommand{\covertext}[1]{\def\c@vertext{#1}} \DeclareRobustCommand{\backtext}[1]{\def\b@cktext{#1}} \DeclareRobustCommand{\insidetext}[1]{\def\insid@text{#1}} \DeclareRobustCommand{\covergraphics}[1]{\def\c@vertext{#1}\def\c@vergraphics{}} \DeclareRobustCommand{\insidegraphics}[1]{\def\insid@text{#1}\def\insid@graphics{}} \DeclareRobustCommand*{\leftspine}[1]{\def\leftspin@{#1}} \DeclareRobustCommand*{\centerspine}[1]{\def\centerspin@{#1}} \DeclareRobustCommand*{\rightspine}[1]{\def\rightspin@{#1}} \DeclareRobustCommand*{\leftspinebis}[1]{\def\leftspin@bis{#1}} \DeclareRobustCommand*{\centerspinebis}[1]{\def\centerspin@bis{#1}} \DeclareRobustCommand*{\rightspinebis}[1]{\def\rightspin@bis{#1}}

We do not want any lineskip, as stacked covers should not be separated by any space. Analogously, we want no margins, no indentation and no hyphens. Osets will be set command by each command.
59 60 61 62 63

\evensidemargin=0cm \oddsidemargin=0cm \topmargin=0cm \headheight=0cm \headsep=0cm

64 65 66 67 68 69 70 71 72 73 74

\footskip=0cm \textwidth=\paperwidth %\advance\textwidth by -3cm \textheight=\paperheight %\advance\textheight by -3cm \lineskip=0pt \lineskiplimit=0pt \parskip=0pt \parindent=0pt \hyphenpenalty=10000

We set the unit for the picture environment to 1mm, and prepare a number of lengths which will be useful in aligning track numbers and spine text. \squ@re holds the side length of the square framing the track numbers. \h@nging is its hanging amount. \@hstrip and \@wstrip are used when aligning the spine. \winf@ and \wtr@cklist are the width of the information and tracklist minipages.
75 76 77 78 79 80 81 82 83

\setlength{\unitlength}{1mm} \newlength{\squ@re} \newlength{\@temp} \newlength{\h@nging} \newlength{\@hstrip} \newlength{\@wstrip} \newlength{\winf@} \newlength{\wtr@cklist} \newlength{\onec@rrection}

The \track command typesets a hanging framed box with a small number inside. The number is given by a counter which is reset to 1 at each \makeback, and can be changed manually with the \setindex command. The alignment inside the small box will be corrected for numbers either starting or ending with a 1 by the fraction of the width of 1 specied with the \onecorrection command.
84 85 86 87 88

\newcounter{tr@ckindex} \DeclareRobustCommand*{\setindex}[1]{\setcounter{tr@ckindex}{#1}}

\DeclareRobustCommand*{\track}{% \par 89 \let\@firstdigit=\@empty 90 \setlength{\onec@rrection}{0pt}% 91 \settowidth{\@temp}{\indexf@nt1} 92 \expandafter\@tfor \expandafter\@digit 93 \expandafter:\expandafter=\number\value{tr@ckindex}\do {% 94 \ifx\@firstdigit\@empty 95 \let\@firstdigit=\@digit 96 \else 97 \if 1\@firstdigit 98 \if 1\@digit\else 99 \setlength{\onec@rrection}{-\onec@rrfrac\@temp}% 100 \fi 101 \else 102 \if 1\@digit 103 \setlength{\onec@rrection}{\onec@rrfrac\@temp}% 104 \fi

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

\fi \fi }% \settoheight{\@temp}{M}% \addtolength{\@temp}{-\squ@re}% \raisebox{.5\@temp}{% \setlength{\unitlength}{\squ@re}% \hspace*{-\h@nging}% \begin{picture}(1,1) \put(0,0){% \framebox(1,1){\hspace*{\onec@rrection}\indexf@nt\thetr@ckindex}% } \end{picture}% }% \hspace*{6pt}% \addtocounter{tr@ckindex}{1}% }

We declare some utility commands which allow for easy font dimension switch. The \newcd command resets to defaults all the fonts and the text defaults.
\AtBeginDocument{% \pagestyle{empty}% 124 \thispagestyle{empty}% 125 \newcd 126 }
122 123 127

\DeclareRobustCommand*{\fhb}[2]{% \fontsize{#1pt}{#2pt}\selectfont 130 \parskip=.1\baselineskip 131 }


128 129 132 133 134 135 136

\DeclareRobustCommand*{\fh}[1]{\fontsize{#1pt}{\baselineskip}\selectfont}

\DeclareRobustCommand*{\newcd}{% \lefttracklist{}% 137 \righttracklist{}% 138 \covertext{}% 139 \insidetext{}% 140 \leftspine{}% 141 \centerspine{}% 142 \rightspine{}% 143 \leftspinebis{\leftspin@}% 144 \centerspinebis{\centerspin@}% 145 \rightspinebis{\rightspin@}% 146 \leftinfo{}% 147 \rightinfo{}% 148 \coverfont{\fhb{16}{19}}% 149 \backfont{\coverf@nt}% 150 \insidefont{\fhb{10}{12}}% 151 \spinefont{\fhb{9}{11}\bfseries}% 152 \tracklistfont{\fhb{9}{10.5}}% 153 \infofont{\fhb{7}{8.3}}% 154 \indexfont{\fhb{5}{0}}% 155 }

The following two commands are useful in alignment. The rst command decides the height and width of a given strip of text, to be inserted in the spine. The point is that unless the alignspine option has been requested, we do not set \@hstrip, which has been set previously to the maximum height of a capital letter. The \alignt@baseline command is used at the end of boxes which could be bottom aligned: it eliminates the additional height inserted when a box last line has a descendant.
\DeclareRobustCommand*{\@sethwstrips}[1]{% \settowidth{\@wstrip}{\spinef@nt #1}% 158 \if@lignspine 159 \settoheight{\@hstrip}{\spinef@nt #1}% 160 \fi 161 }
156 157 162

\DeclareRobustCommand*{\alignt@baseline}{% \settodepth{\@temp}{gjpqy}% 165 \vphantom{gjpqy}\par 166 \vspace*{-\@temp}\par 167 }


163 164

It is now easy to write down the \makecover command. It is just a matter of laying out the material, and print the requested crop marks.
\DeclareRobustCommand*{\makecover}[1][lrtb]{% \voffset=0in 170 \begin{picture}(120,240) 171 \end{picture}% 172 \begin{rotate}{90}% 173 \begin{picture}(240,120) 174 \@tfor\cr@pmark := #1 \do { 175 \if l\cr@pmark 176 \put(-1,0){\line(-1,0){5}} 177 \put(-1,120){\line(-1,0){5}} 178 \else\if r\cr@pmark 179 \put(241,0){\line(1,0){5}} 180 \put(241,120){\line(1,0){5}} 181 \else\if b\cr@pmark 182 \put(0,-1){\line(0,-1){5}} 183 \put(240,-1){\line(0,-1){5}} 184 \put(120,-1){\line(0,-1){1}} 185 \put(120,-3){\line(0,-1){1}} 186 \put(120,-5){\line(0,-1){1}} 187 \else\if t\cr@pmark 188 \put(0,121){\line(0,1){5}} 189 \put(240,121){\line(0,1){5}} 190 \put(120,121){\line(0,1){1}} 191 \put(120,123){\line(0,1){1}} 192 \put(120,125){\line(0,1){1}} 193 \else\if c\cr@pmark 194 \put(0,0){\line(1,0){240}} 195 \put(0,0){\line(0,1){120}} 196 \put(120,0){\line(0,1){120}} 197 \put(0,120){\line(1,0){240}} 198 \put(240,0){\line(0,1){120}} 199 \fi\fi\fi\fi\fi
168 169

200 201 202 203

\ifx\insid@graphics\@empty \put(0,0){% 204 \makebox(120,120)[\@ligninside]{% 205 \parbox{12cm}{% 206 \raggedright\insidef@nt\insid@text\alignt@baseline 207 }% 208 }% 209 } 210 \else 211 \put(10,10){% 212 \makebox(100,100)[\@ligninside]{% 213 \parbox{10cm}{% 214 \raggedright\insidef@nt\insid@text\alignt@baseline 215 }% 216 }% 217 } 218 \fi 219 \ifx\c@vergraphics\@empty 220 \put(120,0){% 221 \makebox(120,120)[\@ligncover]{% 222 \parbox{12cm}{% 223 \raggedright\coverf@nt\c@vertext\alignt@baseline 224 }% 225 }% 226 } 227 \else 228 \put(130,10){% 229 \makebox(100,100)[\@ligncover]{% 230 \parbox{10cm}{% 231 \raggedright\coverf@nt\c@vertext\alignt@baseline 232 }% 233 }% 234 } 235 \fi 236 \end{picture}% 237 \end{rotate}% 238 }

The \makeback command is slightly more complicated, as it must set up come values for the \track command to work. Moreover, it has to check for empty right information or tracklist minipages, as in this case the left ones must be enlarged, and it must try to use the text from the cover page if no back text has been specied.
\DeclareRobustCommand*{\makeback}[1][lrtb]{% \voffset=-.5in 241 \setindex{1}% 242 \settowidth{\squ@re}{\indexf@nt00}% 243 \settoheight{\@temp}{\indexf@nt0}% 244 \addtolength{\squ@re}{.4\@temp}% 245 \setlength{\h@nging}{\squ@re}% 246 \addtolength{\h@nging}{6pt}% 247 \settoheight{\@hstrip}{\spinef@nt ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
239 240

% \ifx\righttr@cklist\@empty 250 \setlength{\wtr@cklist}{12cm}% 251 \else 252 \setlength{\wtr@cklist}{5.5cm}% 253 \fi 254 % 255 \ifx\rightinf@\@empty 256 \setlength{\winf@}{12cm}% 257 \else 258 \setlength{\winf@}{5.5cm}% 259 \fi 260 % 261 \begin{picture}(151,118) 262 \@tfor\cr@pmark := #1 \do { 263 \if l\cr@pmark 264 \put(-1,0){\line(-1,0){5}} 265 \put(-1,118){\line(-1,0){5}} 266 \else\if r\cr@pmark 267 \put(152,0){\line(1,0){5}} 268 \put(152,118){\line(1,0){5}} 269 \else\if b\cr@pmark 270 \put(0,-1){\line(0,-1){5}} 271 \put(151,-1){\line(0,-1){5}} 272 \put(6.5,-1){\line(0,-1){1}} 273 \put(6.5,-3){\line(0,-1){1}} 274 \put(6.5,-5){\line(0,-1){1}} 275 \put(144.5,-1){\line(0,-1){1}} 276 \put(144.5,-3){\line(0,-1){1}} 277 \put(144.5,-5){\line(0,-1){1}} 278 \else\if t\cr@pmark 279 \put(0,119){\line(0,1){5}} 280 \put(151,119){\line(0,1){5}} 281 \put(6.5,119){\line(0,1){1}} 282 \put(6.5,121){\line(0,1){1}} 283 \put(6.5,123){\line(0,1){1}} 284 \put(144.5,119){\line(0,1){1}} 285 \put(144.5,121){\line(0,1){1}} 286 \put(144.5,123){\line(0,1){1}} 287 \else\if c\cr@pmark 288 \put(0,0){\line(1,0){151}} 289 \put(0,0){\line(0,1){118}} 290 \put(151,0){\line(0,1){118}} 291 \put(0,118){\line(1,0){151}} 292 \put(6.5,0){\line(0,1){118}} 293 \put(144.5,0){\line(0,1){118}} 294 \fi\fi\fi\fi\fi 295 }
248 249 296 297 298 299 300 301

\@sethwstrips{\leftspin@} \put(0,4){% \makebox(6.5,110)[b]{% \makebox[\@hstrip][r]{%

10

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

\begin{rotate}{90}\spinef@nt\leftspin@\end{rotate}% }% }% } \@sethwstrips{\centerspin@} \put(0,4){% \makebox(6.5,110){% \raisebox{0pt}[\@wstrip]{\makebox[\@hstrip][r]{% \begin{rotate}{90}\spinef@nt\centerspin@\end{rotate}% }}% }% } \@sethwstrips{\rightspin@} \put(0,4){% \makebox(6.5,110)[t]{% \raisebox{0pt}[\@wstrip]{\makebox[\@hstrip][r]{% \begin{rotate}{90}\spinef@nt\rightspin@\end{rotate}% }}% }% } \@sethwstrips{\leftspin@bis} \put(144.5,4){% \makebox(6.5,110)[t]{% \makebox[\@hstrip][l]{% \begin{rotate}{-90}\spinef@nt\leftspin@bis\end{rotate}% }% }% } \@sethwstrips{\centerspin@bis} \put(144.5,4){% \makebox(6.5,110){% \raisebox{\@wstrip}[\@wstrip]{\makebox[\@hstrip][l]{% \begin{rotate}{-90}\spinef@nt\centerspin@bis\end{rotate}% }}% }% } \@sethwstrips{\rightspin@bis} \put(144.5,4){% \makebox(6.5,110)[b]{% \raisebox{\@wstrip}[\@wstrip]{\makebox[\@hstrip][l]{% \begin{rotate}{-90}\spinef@nt\rightspin@bis\end{rotate}% }}% }% }

11

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

\put(17,0){% \begin{picture}(121,118) \put(0,82){% \makebox(120,30)[\@lignback]{% \parbox{12.1cm}{% \raggedright\backf@nt \ifx\b@cktext\undefined \ifx\c@vergraphics\@empty\else\c@vertext\fi \else \b@cktext \fi \alignt@baseline }% }% } \put(0,5){% \makebox(55,70)[tl]{% \begin{minipage}{\wtr@cklist}% \lineskip=.5pt\lineskiplimit=1pt\raggedright \tracklistf@nt\lefttr@cklist \end{minipage}% }% } \put(65,5){% \makebox(55,70)[tl]{% \begin{minipage}{\wtr@cklist}% \lineskip=.5pt\lineskiplimit=1pt\raggedright \tracklistf@nt\righttr@cklist \end{minipage}% }% } \put(0,5){% \makebox(0,0)[bl]{% \parbox{\winf@}{% \raggedright\infof@nt\leftinf@\alignt@baseline }% }% } \put(65,5){% \makebox(0,0)[bl]{% \parbox{\winf@}{% \raggedright\infof@nt\rightinf@\alignt@baseline }% }% } \end{picture}% }

12

410 411

\end{picture}% }

The \makeslimcover command is essentially a mix of the previous two, as a single slim cover must contain the front matter and the track lists. Note that we have much less space.
\DeclareRobustCommand*{\makeslimcover}[1][lrtb]{% \voffset=0in 414 \setindex{1}% 415 \settowidth{\squ@re}{\indexf@nt00}% 416 \settoheight{\@temp}{\indexf@nt0}% 417 \addtolength{\squ@re}{.4\@temp}% 418 \setlength{\h@nging}{\squ@re}% 419 \addtolength{\h@nging}{6pt}% 420 \settoheight{\@hstrip}{\spinef@nt ABCDEFGHIJKLMNOPQRSTUVWXYZ}% 421 % 422 \ifx\righttr@cklist\@empty 423 \setlength{\wtr@cklist}{10cm}% 424 \else 425 \setlength{\wtr@cklist}{4.7cm}% 426 \fi 427 % 428 \ifx\rightinf@\@empty 429 \setlength{\winf@}{10cm}% 430 \else 431 \setlength{\winf@}{4.7cm}% 432 \fi 433 % 434 \begin{picture}(120,240) 435 \end{picture}% 436 \begin{rotate}{90}% 437 \begin{picture}(240,120) 438 \@tfor\cr@pmark := #1 \do { 439 \if l\cr@pmark 440 \put(-1,0){\line(-1,0){5}} 441 \put(-1,120){\line(-1,0){5}} 442 \else\if r\cr@pmark 443 \put(241,0){\line(1,0){5}} 444 \put(241,120){\line(1,0){5}} 445 \else\if b\cr@pmark 446 \put(0,-1){\line(0,-1){5}} 447 \put(240,-1){\line(0,-1){5}} 448 \put(120,-1){\line(0,-1){1}} 449 \put(120,-3){\line(0,-1){1}} 450 \put(120,-5){\line(0,-1){1}} 451 \else\if t\cr@pmark 452 \put(0,121){\line(0,1){5}} 453 \put(240,121){\line(0,1){5}} 454 \put(120,121){\line(0,1){1}} 455 \put(120,123){\line(0,1){1}} 456 \put(120,125){\line(0,1){1}} 457 \else\if c\cr@pmark 458 \put(0,0){\line(1,0){240}} 459 \put(0,0){\line(0,1){120}}
412 413

13

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 500 501 502 503 504 505 506 507 508 509 510 511 512 513

\put(120,0){\line(0,1){120}} \put(0,120){\line(1,0){240}} \put(240,0){\line(0,1){120}} \fi\fi\fi\fi\fi } \put(12,10){% \begin{picture}(100,100) \put(0,80){% \makebox(100,30)[\@lignback]{% \parbox{10.1cm}{% \raggedright\backf@nt \ifx\b@cktext\undefined \ifx\c@vergraphics\@empty\else\c@vertext\fi \else \b@cktext \fi \alignt@baseline }% }% } \put(0,15){% \makebox(47,60)[tl]{% \begin{minipage}{\wtr@cklist}% \lineskip=.5pt\lineskiplimit=1pt\raggedright \tracklistf@nt\lefttr@cklist \end{minipage}% }% } \put(55,15){% \makebox(47,60)[tl]{% \begin{minipage}{\wtr@cklist}% \lineskip=.5pt\lineskiplimit=1pt\raggedright \tracklistf@nt\righttr@cklist \end{minipage}% }% } \put(0,0){% \makebox(0,0)[bl]{% \parbox{\winf@}{% \raggedright\infof@nt\leftinf@\alignt@baseline }% }% } \put(55,0){% \makebox(0,0)[bl]{% \parbox{\winf@}{% \raggedright\infof@nt\rightinf@\alignt@baseline }% }%

14

514 515 516

\end{picture}% } 518 \ifx\c@vergraphics\@empty 519 \put(120,0){% 520 \makebox(120,120)[\@ligncover]{% 521 \parbox{12cm}{% 522 \raggedright\coverf@nt\c@vertext\alignt@baseline 523 }% 524 }% 525 } 526 \else 527 \put(130,10){% 528 \makebox(100,100)[\@ligncover]{% 529 \parbox{10cm}{% 530 \raggedright\coverf@nt\c@vertext\alignt@baseline 531 }% 532 }% 533 } 534 \fi 535 \end{picture}% 536 \end{rotate}% 537 }
517

Finally, we have the high-level commands that allow to produce one or several CD from data les, \makeCD, \makelist, \makeslimCD and \makeslimlist. All have an additional argument for the le name, defaulting to \jobname.dat or \jobname.lst. Two separate commands factor out the checks and the user interaction in case the le is not specied or does not exist. A data le must contain only text declaration commands from the CD class. A All L TEX stu (preamble, etc.) and cover generation commands are handled automatically. A list le must contain a number of lines, each containing a data le name.
\DeclareRobustCommand*{\@skCDfile}[1]{% \def\CDname{#1}% 540 \ifx\CDname\@empty 541 \IfFileExists{\jobname.dat}{% 542 \def\CDname{\jobname.dat}% 543 }{% 544 \typein[\CDname]{Please insert CD data file name:}% 545 }% 546 \fi 547 \InputIfFileExists{\CDname.dat}{% 548 }{% 549 \InputIfFileExists{\CDname}{% 550 }{% 551 \ClassError{cd}{CD data file (\CDname.dat or \CDname) not found}{}% 552 } 553 }% 554 }
538 539 555 556

\DeclareRobustCommand*{\makeCD}[1][]{%

15

557 558 559 560 561 563 564 565 566 567 568 569 570 571 572

\@skCDfile{#1}\makecover\par\makeback\par }

\DeclareRobustCommand*{\makeslimCD}[1][]{% \@skCDfile{#1}\makeslimcover\par 562 } \newread\CDlist \newcounter{@cd} \setcounter{@cd}{0} \newif\ifne@f

\DeclareRobustCommand*{\@sklistfile}[1]{% \def\CDlistname{#1}% 573 \ifx\CDlistname\@empty 574 \IfFileExists{\jobname.lst}{% 575 \def\CDlistname{\jobname.lst}% 576 }{% 577 \typein[\CDlistname]{Please insert CD list file name:} 578 }% 579 \fi 580 \IfFileExists{\CDlistname.lst}{% 581 \immediate\openin\CDlist=\CDlistname.lst 582 }{% 583 \IfFileExists{\CDlistname}{% 584 \immediate\openin\CDlist=\CDlistname 585 }{% 586 \ClassError{cd}{CD list (\CDlistname.lst or \CDlistname) not found}{}% 587 } 588 } 589 \ne@ftrue 590 }
591

\DeclareRobustCommand*{\makelist}[1][]{% \@sklistfile{#1}% 594 \advance\endlinechar\@M 595 \immediate\read\CDlist to \CDname 596 \advance\endlinechar-\@M 597 \ifeof\CDlist\ne@ffalse\fi 598 % 599 \@whilesw \ifne@f \fi {% 600 \newcd 601 \InputIfFileExists{\CDname.dat}{% 602 }{% 603 \InputIfFileExists{\CDname}{% 604 }{% 605 \ClassError{cd}{CD data file (\CDname.dat or \CDname) not found}{}% 606 }% 607 }% 608 \advance\endlinechar\@M 609 \immediate\read\CDlist to \CDname 610 \advance\endlinechar-\@M
592 593

16

611 612 613 614 615 616 617 618 619 620 621 622

\ifeof\CDlist\ne@ffalse\fi \ifodd\value{@cd}% \makeback[lrb]\par\makecover\par \else \makecover\par\ifne@f\makeback[lrt]\else\makeback\fi\par \fi \addtocounter{@cd}{1}% } }

\DeclareRobustCommand*{\makeslimlist}[1][]{% \@sklistfile{#1}% 623 \advance\endlinechar\@M 624 \immediate\read\CDlist to \CDname 625 \advance\endlinechar-\@M 626 \ifeof\CDlist\ne@ffalse\fi 627 % 628 \@whilesw \ifne@f \fi {% 629 \newcd 630 \InputIfFileExists{\CDname.dat}{% 631 }{% 632 \InputIfFileExists{\CDname}{% 633 }{% 634 \ClassError{cd}{CD data file (\CDname.dat or \CDname) not found}{}% 635 }% 636 }% 637 \advance\endlinechar\@M 638 \immediate\read\CDlist to \CDname 639 \advance\endlinechar-\@M 640 \ifeof\CDlist\ne@ffalse\fi 641 \makeslimcover\par 642 } 643 }
644 645

/class

17

You might also like