\documentclass[english,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[margin=1cm,nohead,nofoot]{geometry}
%\usepackage{xspace}
%\usepackage{array}
\usepackage{color}
\usepackage{graphicx}
%\usepackage{tabularx}
%\usepackage{colortbl}
\usepackage{multicol}
\usepackage{times}

% Experiment with simplified playlist...

% The title that will be printed on the sides of the case
\def\cdtitle{The Alan Parsons Project} 

% the name of the playlist to include - this is the file
% that was produced with the python program
\def\playlist{plx}

% The number of columns that the listing should have
\def\numcols{4}

% \dot is the separator between the track name and the artist;
% we don't actually use a dot but switch to slanted type
\def\dot{\unskip\space\itshape}

% \grayrule is like \rule, only in a light gray shade. It is used
% to indicate the folding lines for the CD-case inlay.
\def\grayrule#1#2{\begingroup\color[gray]{.7}\rule{#1}{#2}\endgroup}

% \rotatedtitle will print the CD title sideways on the sides of the
% case
\def\rotatedtitle#1{%
  \makebox[.6cm]{%
    \raisebox{\height}[0pt][0pt]{%
      \rotatebox[origin=Bc]{#1}{%
        \makebox[11.7cm][l]{\space\cdtitle}%
      }%
    }%
  }%
}

% this length matches three digits in the current font; used for
% calculating the left margin on continuation lines
\newlength{\threedigs}

% the title macro resets the customised paragraph parameters to
% typeset a boldface title. A break is OK before, but not after;
% hence the \vadjust which inserts a \nobreak into the main vertical
% list.
\def\title#1.{\vskip \baselineskip\penalty-100{\everypar{}\leavevmode
    \rightskip0pt\leftskip0pt%
    \hangafter0\hangindent0pt%
    \parfillskip \fill
%    \fontseries{bc}\selectfont#1\vadjust{\nobreak}\par}}
    \fontseries{bc}\selectfont#1\par\nobreak}}

% \subtitle is mostly the same as \title, except no bold
\def\subtitle#1.{{\everypar{}\leavevmode
    \global\rightskip0pt\leftskip0pt%
    \global\hangafter0\global\hangindent0pt%
    \global\parfillskip \fill #1\vadjust{\nobreak}\par}}

% each line is preceded by \entry; trackleaders form the dotted line
\def\entry#1 #2...(#3).{#1\track#2\tracktime(#3)\par}%

% a simple dotted line, at least half an em
\def\trackleaders{\leaders\hbox to .5em{\hss.\hss}\hskip .5em plus 1fil}

% the real workhorse of this script. This odd mixture of penalties,
% boxes and glue is discussed in the article.
%\def\tracktime(#1){\upshape\penalty9999\hbox{}\nobreak
%\trackleaders (#1)\nobreak
%\hskip-\rightskip\hbox{}}
\def\tracktime(#1){\upshape\penalty100\hbox{}\nobreak\trackleaders (#1)}

% all typesetting in helvetica
\renewcommand{\familydefault}{\sfdefault}

% no page numbers
\pagestyle{empty}

% tight fbox around the whole thing for cut-out marking
\fboxsep=0pt

\def\track{\kern.5em}% the space between track number and track title

\begin{document}

% the sans font from 'SliTeX'
\fontsize{7}{7}\fontfamily{lcmss}\selectfont

\fbox{% box around it
\makebox[15cm][s]{% width of the paper
\rotatedtitle{90}% print a CD title at the bottom left, turned up
\grayrule{.4pt}{11.7cm}% a folding line marker
\hfill%
\parbox[b][11.7cm][t]{13cm}{% the contents
\sffamily\fontsize{6}{6}\fontseries{mc}\selectfont% even smaller font
\multicolsep=0pt% no space between columns
\hyphenpenalty=500% no hyphens, please
\vfill% center vertically
\begin{multicols}{\numcols}%
  \settowidth{\threedigs}{000\track}% calculate left margin offset
\everypar{\hangafter1\hangindent \threedigs% 'hanging' indent
\parindent0pt%
\leftskip 0em%
\rightskip2em plus 1.5em%
\parfillskip -\rightskip% makes the last line flush right
\entry}
\input{\playlist}% read the playlist
\end{multicols}
\vspace*{\fill}\hbox{}}% vertically center
\hfill% horizontally center
\grayrule{.4pt}{11.7cm}% the foldline on the right
\rotatedtitle{-90}% the CD title on the other side
}%
}

\end{document}
