TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


\def\Google{{http://www.google.com}{Google Search}}



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


On this example, \WebSiteName\Google should write "Google Search" and \WebSiteUrl\Google should write "http://www.google.com".

But the problem is that \WebSiteName\Google writes http://www.google.comGoogle 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: tex.stackexchange.com/q/48938/8057 (Perhaps at another level of abstraction...) – krlmlr Dec 11 '12 at 20:53
Welcome to TeX.sx! – Kurt Dec 11 '12 at 20:53
Thanks Kurt. :) – dieze Dec 13 '12 at 19:19
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}{http://www.google.com}{Google Search}

When \WebSiteName\Google is found, it becomes


and then \Google is expanded, giving

\@secondoftwo{http://www.google.com}{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, http://www.google.com, 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.