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 get strings from an external program, as shown in this example:

  \immediate\write18{/home/rpinson/bas/tex/diatheke2tex "Jn 3:16" "FreMartin" "\roman{verse}" "\jobname.verses"}

Where diatheke2tex is:



echo "\\newcommand\\verse${ID}{%" >> $FILE

diatheke -o plain -b "$VERSION" -k "$REF" | \
  head -n -1 | \
  sed -e 's/^[^:]\+ [0-9:]\+://' >> $FILE

echo "}" >> $FILE

The \versei is kind of a hack, as it's not possible to use spaces and numbers in a macro name. Obviously, this is not a proper solution…

How can I build an associative array of some sort associating references (like Jn 3:16) to the result of the command (in this case Car Dieu a tant aimé le monde, qu'il a donné son Fils unique, afin que quiconque croit en lui ne périsse point, mais qu'il ait la vie éternelle.)?

share|improve this question
up vote 2 down vote accepted

Actually, spaces and numbers can be used in a macro name (csname), see an example of definition and usage of an associating reference below:

\expandafter\def\csname[Jn 3:16]\endcsname{Car Dieu a tant aimé le monde\dots}
\csname[Jn 3:16]\endcsname
share|improve this answer
Great, thank you! – ℝaphink Mar 26 '13 at 9:18

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.