real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language LaTeX2e

(Uses only pgf commands and fmtcount)

Author:Joel Berger
Score: (3.00 in 9 votes)
%% 99 Bottles of Beer on the Wall
%% Distinction: Uses only pgf commands and fmtcount
%% Author: Joel Berger
\documentclass[twocolumn]{article} % Use twocolumn option to ... um ... save paper
\usepackage{tikz} % Loads all three packages above (plus lots of other things)
\usepackage{fmtcount} % Provides commands for converting numbers to words

%% key-value pairs which, when combined with mathematical tests replace "if" statements
% keys-value pairs to add pluralization (called singular as we test for \x = 1 which is false if
% keys-value code pairs to either display the \y converted to text or if \y = 0 say "No more"
\pgfkeys{/text/0.0/.code={no more}}

\foreach \x in {99, 98 , ..., 1} {
  \pgfmathequalto{\x}{1} % if \x = 1 set \pgfmathresult = 1.0 else 0.0
  \Numberstringnum{\x} bottle\pgfkeys{/singular/\pgfmathresult} of beer of the wall,\\
  \numberstringnum{\x} bottle\pgfkeys{/singular/\pgfmathresult} of beer.\\
  Take one down pass it around,\\
  \pgfmathtruncatemacro{\y}{\x - 1} % set \y = int(\x - 1)
  \pgfmathgreaterthan{\y}{0} % if \y > 0 set \pgfmathresult = 1.0 else 0.0
    bottle\pgfkeys{/singular/\pgfmathresult} of beer on the wall.\\


Download Source | Write Comment

Alternative Versions

corrected & updatedDavid Short08/07/080


>>  ella said on 09/24/10 10:17:09

ella The beauty of the leather is always un beatable one in front of any treatment or detailing done later. This Carlos Falchi Gathered Python Pouf Satchel has that kind of natural beauty,coach handbags on sale,coach handbags,coach outlet online,
Nike air max 2010,air max 2009,air max shoes on sale.Buy nike air max shoes on low at $62,especially air max 2010,air max 2009,nike air max shoes,nike air max,nike air max 2011
taylor made golf

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!




Security Code: