# Address book form

I want to create an environment (or any other command) for entering addresses. For example, I want something like this:

\newaddress
\home
\name{John Doe}
\phone{123-456-7890}
\address{100 1st Street, New York, NY}


Then it prints following a certain format like:

\usepackage{wasysym} % Just for \XBox and \Square

\begin{description}
\item[Address Type:] \XBox Home, \Square Work
\item[Name:] John Doe
\item[Phone:] 123-456-7890
\item[Address:] 100 1st Street, New York, NY
\end{description}


How can I do this? I am open to any form of environment, command, or anything else.

-

Here's a quick implementation using xkeyval just to give an idea of what can be done using this approach:

\documentclass{article}
\usepackage{wasysym,xkeyval}% http://ctan.org/pkg/{wasysym,xkeyval}
\makeatletter
\begin{description}
\else None\fi\fi
\end{description}
}}
\makeatother
\begin{document}
\makeaddress[name={John Doe},address={100 1st Street, New York, NY},phone={123-456-7890},type=home]
\bigskip
\end{document}


The main advantage would be that you can specify defaults for keys if they're not supplied, limit certain inputs to specific values and mix them in any order you like. You'll have to peruse the xkeyval documentation to view all the possibilities. I don't think my code is the most optimal or uses all the benefits of xkeyval, but at least it shows a proof of concept that should fit your use case.

-

You can use the directory package (see the example provided with the package at CTAN or from Christophe Geuzaine):

\documentclass[12pt]{article}
\usepackage[break,longdates]{directory}