From 441728c3fc15c10e69422d748dc214751ef51c17 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 May 2008 01:02:24 +0000 Subject: cd update (5may08) git-svn-id: svn://tug.org/texlive/trunk@7882 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/cd/cd.dtx | 356 +++++++++++++++++++++++++------ Master/texmf-dist/source/latex/cd/cd.ins | 2 +- 2 files changed, 287 insertions(+), 71 deletions(-) (limited to 'Master/texmf-dist/source/latex/cd') diff --git a/Master/texmf-dist/source/latex/cd/cd.dtx b/Master/texmf-dist/source/latex/cd/cd.dtx index 626fa5b7995..32f26fea610 100644 --- a/Master/texmf-dist/source/latex/cd/cd.dtx +++ b/Master/texmf-dist/source/latex/cd/cd.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: cd.dtx Copyright (C) 1998-2002 Sebastiano Vigna +% File: cd.dtx Copyright (C) 1998-2007 Sebastiano Vigna % % This file is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ % % \fi % -% \CheckSum{735} +% \CheckSum{1028} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -39,7 +39,7 @@ % \iffalse % %\NeedsTeXFormat{LaTeX2e} -%\ProvidesClass{cd}[2002/01/10 v1.0 CD Cover Class] +%\ProvidesClass{cd}[2007/10/12 v1.3 CD Cover Class] % %<*driver> \documentclass{ltxdoc} @@ -59,13 +59,16 @@ % \changes{v0.0}{1998/06/04}{Created file.} % \changes{v0.1}{1998/06/15}{New macros for data file handling.} % \changes{v1.0}{2002/01/10}{Bumped revision number 8^).} +% \changes{v1.1}{2005/09/08}{Added support for slim cases. Better positioning, too.} +% \changes{v1.3}{2007/10/12}{Implemented covergraphics, etc. and .dat/.lst filename from job name} % % % \section{Introduction} % % The purpose of this class is to print CD covers. The main design line % is allowing the creation of labels with minimum effort, without restraining the -% freedom to customize. There is also some support for multiple cover printing. +% 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, @@ -95,9 +98,12 @@ % \end{document} % \end{verbatim} % By compiling the file above, you will obtain your first 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 file |CD.dat| containing the lines between % |\begin{document}| and |\makecover| and compile with -% \LaTeX\ the file |CD.tex|. This is a better mechanism---each CD should +% \LaTeX\ the file |CD.tex| (or |slimCD.tex|). This is a better mechanism---each CD should % have its own data (|.dat|) file, which is run through the driver file % |CD.tex| or the more powerful list mechanism described below. % This also allows to set some parameters one for all (for instance, @@ -129,10 +135,11 @@ % The content of a CD cover are set using the self-explaining % |\covertext|, |\backtext|, |\insidetext|, |\leftspine|, |\centerspine|, % |\rightspine|, -% |\leftracklist|, |\leftracklist|, |\leftinfo| -% and |\rightinfo| commands. Note that by default the material contained in +% |\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 bottom-aligned, and -% the the arguments of the spine commands must not contain line breaks. The left +% 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|\marg{n}. The text @@ -148,6 +155,13 @@ % and |\rightspinebis| commands allows you to insert different content into the % ``back'' spine. % +% \section{The Graphic Commands} +% +% In the case you want to fill 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). +% % \section{The Font Commands} % % The |CD| class provides some simple commands for switching the font @@ -172,46 +186,52 @@ % 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. +% explicitly), so usually you do not need to set the former (note +% that, of course, this does \emph{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. Both command have -% an optional argument that can contain any of the letters |lrtbc| (left, -% right, top, bottom, contour). The first four letter create the respective -% crop marks. The last letter is mainly for ``debugging'' purposes, and makes -% evident the contour of the various parts of the cover. The default value is -% |lrtb|. The possibility of partially eliminating crop marks is particularly +% 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. % -% While it is possible to create a single \LaTeX\ document containing a CD -% cover, it is usually more useful to create a data file containing all +% It is possible to create a single \LaTeX\ document containing a CD +% cover, but it is usually more useful to create a data file containing all % |CD|-specific command, and include it from a ``driver'' file, containing -% the |\makeCD| command. With no argument, it checks for the existence -% of a |CD.dat| file. If it exists, it is input and then the CD cover is +% the |\makeCD| or the |\makeslimCD| command. With no argument, it checks for the existence +% of a \textit{jobname}|.dat| file (where \textit{jobname} is the root of the +% \LaTeX file under compilation---e.g., |CD.dat| when compiling |CD.tex|). +% If such a file exists, it is input and then the (slim) CD cover is % generated. Otherwise, the user is asked for a data file 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 can be used to -% specify a data file name. +% is read and processed. Of course, the optional argument (which, note again, +% must be enclosed in brackets) can be used to specify a data file name. % -% Having a database of data files is particularly useful when using the |\makelist| command, which -% processes an entire list of CDs, printing one cover or two -% back covers per page; the crop marks are suitably aligned so to minimize +% Having a database of data files 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 effort. The CD list must be contained in a list file, one -% data file name per line. With no argument, |\makelist| checks for the existence +% data file name per line. With no argument, |\makelist| and |\makeslimlist| check for the existence % of a |CD.lst| file. If it exists, it is input; otherwise, the user is asked % for a list file 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 file name. % -% \section{The options} +% \section{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 fisrt +% |aligninsidetop|, |alignbacktop| and |aligntop| (the last one resumes the first % three ones), and analogously |aligncovercenter|, etc.~that allow to change -% the default alignment behaviour. Finally, the |alignspine| option forces -% vertical centering of the spine text +% the default alignment behaviour. The |covergraphics| option lets you use +% the entire cover area (instead of a centered 10\,cm$\times$10\,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. @@ -252,6 +272,8 @@ \DeclareOption{aligninsidetop}{\def\@ligninside{t}} \DeclareOption{alignbacktop}{\def\@lignback{t}} +\DeclareOption{covergraphics}{\def\@lignback{t}} + \DeclareOption{aligntop}% {\ExecuteOptions{aligncovertop,aligninsidetop,alignbacktop}} @@ -279,9 +301,7 @@ \onecorrection{0} % \end{macrocode} % Now we have all the font and text declaration commands. They -% just define a certain macro to be their argument. This ``double indirection'' -% allows for default text definition, e.g., the back text and font is equal -% the cover ones unless otherwise specified. +% just define a certain macro to be their argument. % \begin{macrocode} \DeclareRobustCommand*\coverfont[1]{\def\coverf@nt{#1}} \DeclareRobustCommand*\backfont[1]{\def\backf@nt{#1}} @@ -299,6 +319,9 @@ \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}} @@ -306,22 +329,20 @@ \DeclareRobustCommand*{\centerspinebis}[1]{\def\centerspin@bis{#1}} \DeclareRobustCommand*{\rightspinebis}[1]{\def\rightspin@bis{#1}} % \end{macrocode} -% We set exactly $1.5$cm of margin around the page. We do not want -% any |lineskip|, as stacked covers should not be separated by any -% space. Analogously, we want no indentation or hyphens. +% 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. Offsets +% will be set command by each command. % \begin{macrocode} -\hoffset=-1in -\voffset=-1in -\evensidemargin=1.5cm -\oddsidemargin=1.5cm -\topmargin=1.5cm +\evensidemargin=0cm +\oddsidemargin=0cm +\topmargin=0cm \headheight=0cm \headsep=0cm \footskip=0cm \textwidth=\paperwidth -\advance\textwidth by -3cm +%\advance\textwidth by -3cm \textheight=\paperheight -\advance\textheight by -3cm +%\advance\textheight by -3cm \lineskip=0pt \lineskiplimit=0pt @@ -413,7 +434,6 @@ \lefttracklist{}% \righttracklist{}% \covertext{}% - \backtext{\c@vertext}% \insidetext{}% \leftspine{}% \centerspine{}% @@ -457,6 +477,7 @@ % matter of laying out the material, and print the requested crop marks. % \begin{macrocode} \DeclareRobustCommand*{\makecover}[1][lrtb]{% +\voffset=0in \begin{picture}(120,240) \end{picture}% \begin{rotate}{90}% @@ -489,20 +510,40 @@ \fi\fi\fi\fi\fi } - \put(10,10){% - \makebox(100,100)[\@ligninside]{% - \parbox{10cm}{% - \raggedright\insidef@nt\insid@text\alignt@baseline + \ifx\insid@graphics\@empty + \put(0,0){% + \makebox(120,120)[\@ligninside]{% + \parbox{12cm}{% + \raggedright\insidef@nt\insid@text\alignt@baseline + }% }% - }% - } - \put(130,10){% - \makebox(100,100)[\@ligncover]{% - \parbox{10cm}{% - \raggedright\coverf@nt\c@vertext\alignt@baseline + } + \else + \put(10,10){% + \makebox(100,100)[\@ligninside]{% + \parbox{10cm}{% + \raggedright\insidef@nt\insid@text\alignt@baseline + }% }% - }% - } + } + \fi + \ifx\c@vergraphics\@empty + \put(120,0){% + \makebox(120,120)[\@ligncover]{% + \parbox{12cm}{% + \raggedright\coverf@nt\c@vertext\alignt@baseline + }% + }% + } + \else + \put(130,10){% + \makebox(100,100)[\@ligncover]{% + \parbox{10cm}{% + \raggedright\coverf@nt\c@vertext\alignt@baseline + }% + }% + } + \fi \end{picture}% \end{rotate}% } @@ -510,9 +551,11 @@ % 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. +% 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 specified. % \begin{macrocode} \DeclareRobustCommand*{\makeback}[1][lrtb]{% +\voffset=-.5in \setindex{1}% \settowidth{\squ@re}{\indexf@nt00}% \settoheight{\@temp}{\indexf@nt0}% @@ -634,7 +677,13 @@ \put(0,82){% \makebox(120,30)[\@lignback]{% \parbox{12.1cm}{% - \raggedright\backf@nt\b@cktext\alignt@baseline + \raggedright\backf@nt + \ifx\b@cktext\undefined + \ifx\c@vergraphics\@empty\else\c@vertext\fi + \else + \b@cktext + \fi + \alignt@baseline }% }% } @@ -679,22 +728,154 @@ \end{picture}% } % \end{macrocode} +% 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. +% \begin{macrocode} +\DeclareRobustCommand*{\makeslimcover}[1][lrtb]{% +\voffset=0in +\setindex{1}% +\settowidth{\squ@re}{\indexf@nt00}% +\settoheight{\@temp}{\indexf@nt0}% +\addtolength{\squ@re}{.4\@temp}% +\setlength{\h@nging}{\squ@re}% +\addtolength{\h@nging}{6pt}% +\settoheight{\@hstrip}{\spinef@nt ABCDEFGHIJKLMNOPQRSTUVWXYZ}% +% +\ifx\righttr@cklist\@empty + \setlength{\wtr@cklist}{10cm}% +\else + \setlength{\wtr@cklist}{4.7cm}% +\fi +% +\ifx\rightinf@\@empty + \setlength{\winf@}{10cm}% +\else + \setlength{\winf@}{4.7cm}% +\fi +% +\begin{picture}(120,240) +\end{picture}% +\begin{rotate}{90}% +\begin{picture}(240,120) + \@tfor\cr@pmark := #1 \do { + \if l\cr@pmark + \put(-1,0){\line(-1,0){5}} + \put(-1,120){\line(-1,0){5}} + \else\if r\cr@pmark + \put(241,0){\line(1,0){5}} + \put(241,120){\line(1,0){5}} + \else\if b\cr@pmark + \put(0,-1){\line(0,-1){5}} + \put(240,-1){\line(0,-1){5}} + \put(120,-1){\line(0,-1){1}} + \put(120,-3){\line(0,-1){1}} + \put(120,-5){\line(0,-1){1}} + \else\if t\cr@pmark + \put(0,121){\line(0,1){5}} + \put(240,121){\line(0,1){5}} + \put(120,121){\line(0,1){1}} + \put(120,123){\line(0,1){1}} + \put(120,125){\line(0,1){1}} + \else\if c\cr@pmark + \put(0,0){\line(1,0){240}} + \put(0,0){\line(0,1){120}} + \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 + }% + }% + } + + \end{picture}% + } + \ifx\c@vergraphics\@empty + \put(120,0){% + \makebox(120,120)[\@ligncover]{% + \parbox{12cm}{% + \raggedright\coverf@nt\c@vertext\alignt@baseline + }% + }% + } + \else + \put(130,10){% + \makebox(100,100)[\@ligncover]{% + \parbox{10cm}{% + \raggedright\coverf@nt\c@vertext\alignt@baseline + }% + }% + } + \fi +\end{picture}% +\end{rotate}% +} +% \end{macrocode} % Finally, we have the high-level commands that allow to produce -% one or several CD from data files, |\makeCD| and |\makelist|. -% Both have an additional argument for the file name, defaulting -% to |CD.dat| and |CD.lst|, respectively. In case the requested -% file does not exist, the user is asked for a manual input. +% one or several CD from data files, |\makeCD|, |\makelist|, |\makeslimCD| and |\makeslimlist|. +% All have an additional argument for the file name, defaulting +% to |\jobname.dat| or |\jobname.lst|. +% +% Two separate commands factor out the checks and the user interaction in case the file +% is not specified or does not exist. % % A data file must contain only text declaration commands from the % |CD| class. All \LaTeX{} stuff (preamble, etc.) and cover generation % commands are handled automatically. A list file must contain a number % of lines, each containing a data file name. % \begin{macrocode} -\DeclareRobustCommand*{\makeCD}[1][]{% +\DeclareRobustCommand*{\@skCDfile}[1]{% \def\CDname{#1}% \ifx\CDname\@empty - \IfFileExists{CD.dat}{% - \def\CDname{CD.dat}% + \IfFileExists{\jobname.dat}{% + \def\CDname{\jobname.dat}% }{% \typein[\CDname]{Please insert CD data file name:}% }% @@ -706,7 +887,14 @@ \ClassError{cd}{CD data file (\CDname.dat or \CDname) not found}{}% } }% -\makecover\par\makeback\par +} + +\DeclareRobustCommand*{\makeCD}[1][]{% +\@skCDfile{#1}\makecover\par\makeback\par +} + +\DeclareRobustCommand*{\makeslimCD}[1][]{% +\@skCDfile{#1}\makeslimcover\par } \newread\CDlist @@ -716,13 +904,13 @@ \newif\ifne@f -\DeclareRobustCommand*{\makelist}[1][]{% +\DeclareRobustCommand*{\@sklistfile}[1]{% \def\CDlistname{#1}% \ifx\CDlistname\@empty - \IfFileExists{CD.lst}{% - \def\CDlistname{CD.lst}% + \IfFileExists{\jobname.lst}{% + \def\CDlistname{\jobname.lst}% }{% - \typein[\CDlistname]{Please insert CD list file name:} + \typein[\CDlistname]{Please insert CD list file name:} }% \fi \IfFileExists{\CDlistname.lst}{% @@ -735,7 +923,10 @@ } } \ne@ftrue -% +} + +\DeclareRobustCommand*{\makelist}[1][]{% +\@sklistfile{#1}% \advance\endlinechar\@M \immediate\read\CDlist to \CDname \advance\endlinechar-\@M @@ -762,6 +953,31 @@ \addtocounter{@cd}{1}% } } + +\DeclareRobustCommand*{\makeslimlist}[1][]{% +\@sklistfile{#1}% +\advance\endlinechar\@M +\immediate\read\CDlist to \CDname +\advance\endlinechar-\@M +\ifeof\CDlist\ne@ffalse\fi +% +\@whilesw \ifne@f \fi {% + \newcd + \InputIfFileExists{\CDname.dat}{% + }{% + \InputIfFileExists{\CDname}{% + }{% + \ClassError{cd}{CD data file (\CDname.dat or \CDname) not found}{}% + }% + }% + \advance\endlinechar\@M + \immediate\read\CDlist to \CDname + \advance\endlinechar-\@M + \ifeof\CDlist\ne@ffalse\fi + \makeslimcover\par +} +} + % % \end{macrocode} % \Finale diff --git a/Master/texmf-dist/source/latex/cd/cd.ins b/Master/texmf-dist/source/latex/cd/cd.ins index a6ee74002f3..6409ce7fd60 100644 --- a/Master/texmf-dist/source/latex/cd/cd.ins +++ b/Master/texmf-dist/source/latex/cd/cd.ins @@ -2,7 +2,7 @@ \input docstrip.tex \preamble -Copyright (C) 1998-2002 by Sebastiano Vigna +Copyright (C) 1998-2007 by Sebastiano Vigna This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.3