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 LaTeX2e

(corrected & updated)

Date:08/07/08
Author:David Short
URL:https://launchpad.net/~chameleondave
Comments:0
Info:http://www.latex-project.org/
Score: (3.00 in 13 votes)
\documentclass[12pt,a4paper]{memoir}                         %This doc class enables \numname
\usepackage{ifthen}                                          %This enables conditionals
\newcounter{quantity}\setcounter{quantity}{99}               %This lines up 99 bottles for us
\newcounter{rounds}                                          %This allows us to count rounds
\newcommand{\s}{\ifthenelse{\equal{\thequantity}{1}}{}{s}}   %This deals with pluralisation
\newcommand{\Howmany}{\ifthenelse{\equal{\thequantity}{0}}{No more}{\numtoName{\thequantity}}}
\newcommand{\howmany}{\ifthenelse{\equal{\thequantity}{0}}{no more}{\numtoname{\thequantity}}}

\begin{document}

\whiledo{\value{rounds}<1}{  %Change "1" this value to the number of times to sing the song
	\par
	\noindent
	\Howmany\ bottle\s\ of beer on the wall,
	\howmany\ bottle\s\ of beer.\\
	\ifthenelse{\equal{\thequantity}{0}}
	{Go to the store and buy some more,\addtocounter{quantity}{99}\addtocounter{rounds}{1}}
	{Take one down and pass it around,\addtocounter{quantity}{-1}}
	\howmany\ bottle\s\ of beer on the wall.\\
}

\end{document}

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
Uses only pgf commands and fmtcountJoel Berger04/19/101

Comments

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: