Background
Would like to use values from macros that reference other macros (n-levels deep) and apply their values to the \path command.
Problem
(Scenario A) The following works:
\usepackage{url}
\newcommand*{\filename}[1]{\expandafter\path\expandafter{#1}}
\newcommand*{\filephpdemo}{index.php}
\path{c:\programs\Apache\htdocs\}\filename{\filephpdemo}
Result:
c:\programs\Apache\htdocs\index.php
(Scenario B) This fails:
\newcommand*{\dirname}[1]{\expandafter\path\expandafter{#1}}
\newcommand*{\dirhomeapachehttp}{c:\programs\Apache\}
\newcommand*{\dirhomeapachehttpdocs}{\dirhomeapachehttp\docs\}
\dirname{\dirhomeapachehttpdocs}\filename{\filephpdemo}
Actual result is an error:
Missing }.
(Scenario C) This fails:
\newcommand*{\dirhomeapachehttp}{c:\programs\Apache\}
\newcommand*{\dirhomeapachehttpdocs}{c:\programs\Apache\hdtocs}
Actual result:
c:\programs \Apache \htdocs index.php
Question
How can the \path command be used to expand and use the value of \dirhomeapachehttpdocs from Scenario B?
\pathmacro once. I suppose it doesn't much matter: the important part is that the directory names are written only once. – Dave Jarvis Dec 15 '10 at 14:46