My background is software-development and object-oriented programming. Therefore I got the following question about LaTeX.
I got the following command, which defines the properties of a contact person.
\usepackage{tabularx}
\usepackage{xkeyval}
\usepackage{hyperref}
% define the key (arguments)
\makeatletter
\define@key{personkeys}{name}{%
\def\personname{#1}
}
\define@key{personkeys}{phone}{%
\def\personphone{#1}
}
\define@key{personkeys}{email}{%
\def\personemail{#1}
}
\makeatother
% end of key definition
\newcommand{\contact}[2][]{%
\setkeys{personkeys}{#1}%
\personname \newline
\href{mailto:\personemail}{\nolinkurl{\personemail}} \newline
\personphone \bigskip
}
The command is then used to specify persons that are used often throughout the document. Such person is then accessed by the command \johndoe.
\newcommand{\johndoe}{
\contact[
name={Mr John Doe},
email={john@doe.co},
phone={+00 00 012345}
];
}
The problem is, that some persons would like to include their phone number and others don't. Nevertheless I want the number filled out in the command and just set a flag like hidePhone that is then interpreted by the command definition.
\newcommand{\johndoe}{
\contact[
name={Mr John Doe},
email={john@doe.co},
phone={+00 00 012345},
hidePhone=True
];
}
Question: Is there a way to have a command show or hide a text depending on the flag? Otherwise I have to simply leave the phone number and/or Email address blank.
Remark: I had a look into this posting and also this one, but both care about document wide enabling/disabling of text fragments. I need it per command.
