Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language TeX/LaTeX

Date:04/20/05
Author:Craig J. Copi
URL:n/a
Comments:4
Info:n/a
Score: (2.95 in 119 votes)
%% TeX/LaTeX version of 99 bottles of Beer
%%
%% Craig J Copi - copi@oddjob.uchicago.edu
%%
\parindent=0pt
\newcount\beercurr
\def\beer#1{\beercurr=#1\let\next=\removebeer\removebeer}
\def\removebeer{
 \ifnum\beercurr>1 
   \the\beercurr\ bottles of beer on the wall,\par 
   \the\beercurr\ bottles of beer,\par 
   take one down, pass it around,\par 
   \advance\beercurr by -1 
   \the\beercurr\ bottle\ifnum1<\beercurr{s}\fi\ of beer on the wall.\par 
   \vskip 2ex\relax
 \else 
   1 bottle of beer on the wall,\par 1 bottle of beer,\par 
   take one down, pass it around,\par no bottles of beer on the wall.\par 
   \vskip .5ex
   Time to buy some more beer\ldots. \let\next=\relax
 \fi 
 \next}

\beer{99}

Download Source | Write Comment

Alternative Versions

Comments

>>  Volker Kuhlmann said on 05/16/05 02:21:49

Volker Kuhlmann This works in neither TeX nor LaTeX. LaTeX just spits a "missing \begin{document}" and calls it quits. TeX doesn't create the last page of output because the whole document is missing termination with \bye.

Does anyone ever test the programs posted here?

>>  Stefan Scheler said on 05/16/05 19:44:36

Stefan Scheler Well, this is material from Tim's first version of the site. This code is ~10 years old. So I assume it worked with a previous version of tex. Try this one http://www.99-bottles-of-beer.net/language-latex2e-354.html instead.

And dude, of course we don't have to time to check all this old stuff. We do this in our free time.

>>  Kiyoshi Akima said on 04/25/06 03:51:29

Kiyoshi Akima It works fine in TeX if you change the \ldots toward the bottom to \dots

>>  Johannes said on 02/02/10 14:08:51

Johannes The assumption that it will work with an earlier version of TeX is most probably wrong. TeX is a *very* stable language, virtually unchanged since 1978 a.f.a.i.k.

BTW, anything free comes with no guarantee.

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: