[texhax] macro expansion trouble

Neal H. Walfield neal at walfield.org
Sat Aug 4 16:09:31 CEST 2012


I have written a program that does some data processing and then
generates a plot using pgfplots.  I want to include the plot from a
LaTeX document, but I don't want to embed parts of my document in my
data analysis program, such as, how wide the plot should be.

I decided to add a hook (in this case, called \Arg) to the generated
plot, which I could set from my document:

    \addplot[only marks, mark=o] coordinates {
      (3.000000, 1469.000000)
       (4.000000, 461.000000)

And then define a macro that sets the hook variable and \input's the
plot commands:


In my document, I use the macro as follows:


When I process this with LaTeX, I get the following error:

  ! Missing \endcsname inserted.
  <to be read again> 
  l.1 \begin{axis}[\Arg]

The generated pdf is actually correct (when I use \nonstopmode to
ignore errors), but I want to figure out what the problem is.  The
following is a minimal working example:


To process the example, use pdflatex and save the above plot data
(from \begin{axis} to \end{axis}) as /tmp/plot.tex.

Any ideas what I am doing wrong?



More information about the texhax mailing list