Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to use TeX macros to store multiple data such as website url/name. Here is an example :


\def\Google{{}{Google Search}}



  Name : \WebSiteName\Google \par
  Url  : \WebSiteUrl\Google


On this example, \WebSiteName\Google should write "Google Search" and \WebSiteUrl\Google should write "".

But the problem is that \WebSiteName\Google writes Search". I try to use \expandafter to combine two arguments in only one. Maybe that's the wrong method.

share|improve this question
Related, maybe a dupe: (Perhaps at another level of abstraction...) – krlmlr Dec 11 '12 at 20:53
Welcome to! – Kurt Dec 11 '12 at 20:53
Thanks Kurt. :) – dieze Dec 13 '12 at 19:19

2 Answers 2

up vote 10 down vote accepted

You're misplacing \expandafter: it must go before \@WebSiteName and \@WebSiteUrl. But it turns out that the two auxiliary macros are already in the LaTeX kernel:



\NewSite{\Google}{}{Google Search}

When \WebSiteName\Google is found, it becomes


and then \Google is expanded, giving

\@secondoftwo{}{Google Search}

and, finally

Google Search
share|improve this answer

Thanks egreg.

Finally, after a little search, i used a different approch using the package datatool.

File: websites.csv

id,     url,                   name
Google,, Google Search

File: document.tex



% set "," as separator between each entry
% "," is the default
% to use <tab> as separator, use \DTLsettabseparator

% loads the database





  % show database


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.