Graphics, Figures & Tablespgfplots | Error Runaway argument \else \expandafter

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Aarran89
Posts: 2
Joined: Sat Mar 31, 2012 8:53 pm

pgfplots | Error Runaway argument \else \expandafter

Post by Aarran89 »

Hi everyone, first post here so please be gentle!

I seem to be having a problem with the creation of a graph using pgfplots in LaTeX. Here is my code:

Code: Select all

\documentclass[traditabstract]{aa}
\usepackage{helvetica}
\usepackage[tbtags]{amsmath}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{ulem}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{pgfplots}
\newcommand{\tab}{\hspace*{2em}}

\begin{tikzpicture}
    \begin{axis}[ xmin=-16000, xmax=0, ymin=0, ymax=770,
        xlabel=$t_{off}$,
        ylabel=$\chi^2$
    ]
      \addplot plot coordinates {
(-1.4965E+04, 6.90020E+02)
(-1.5965E+04, 6.93870E+02)
(-1.5914E+04, 6.93110E+02)
(-1.5862E+04, 6.92440E+02)
(-1.5811E+04, 6.91870E+02)
(-1.5760E+04, 6.91400E+02)
(-1.5709E+04, 6.91020E+02)
(-1.5657E+04, 6.90730E+02)
(-1.5606E+04, 6.90520E+02)
(-1.5555E+04, 6.91280E+02)
(-1.5503E+04, 6.90870E+02)
(-1.5452E+04, 2.49120E+05
(-1.5401E+04, 7.68160E+02)
(-1.5350E+04, 7.10330E+02)
(-1.5298E+04, 6.98870E+02)
(-1.5247E+04, 6.94550E+02)
(-1.5196E+04, 6.92410E+02)
(-1.5144E+04, 6.91210E+02)
(-1.5093E+04, 6.90520E+02)
(-1.5042E+04, 6.90150E+02)
    };
     \end{axis}
\end{tikzpicture}
\end{document}
I'm using all the correct packages in my preamble and such I think, but when I compile I seem to get this error:

Code: Select all

Runaway argument?
4]\else \expandafter \expandafter \csname pgfflt@2Y1.5401e4]\endcsname 
\ETC.
./Final_Report-draft.tex:173: Paragraph ended before
\pgfflt@readlowlevelfloat
was complete.
<to be read again>
                   \par
l.173

? 
The error is pointing to line 173, which isn't part of my graph, however if I remove all that code then the document compiles as normal.
Has anyone any ideas? I tried supplying definite minimum and maximum xaxis and yaxis values.


Thank you in advance,
Aarran

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

pgfplots | Error Runaway argument \else \expandafter

Post by Stefan Kottwitz »

Hi Aarran,

welcome to the board!

The problem is caused by a missing right parenthesis here:

Code: Select all

(-1.5503E+04, 6.90870E+02)
(-1.5452E+04, 2.49120E+05
(-1.5401E+04, 7.68160E+02)
Just add it.

Some additional advice: for a better chance to get a solution, make it possible for the reader to test and reproduce the problem. You did it nearly good, though
  • You used a custom class which is not available for a reader - or what document class is aa in \documentclass[traditabstract]{article}?
  • I don't know a package helvetica, perhaps you mean helvet.
  • \begin{document} is missing.
So a reader has to "repair" this code to make it compilable. Instead of copying some relevant code, better would be hacking down a real copy, reducing it, or posting code which does produce this error. This code gave just other errors.

Stefan
LaTeX.org admin
Aarran89
Posts: 2
Joined: Sat Mar 31, 2012 8:53 pm

Re: pgfplots | Cryptic Error

Post by Aarran89 »

Thank you for the reply, I knew it'd be a stupid error! Haha.
Thanks for the hints also, helvetica is a custom .sty, whereas aa.cls is a template from Astronomy and Astrophysics, which is the style I'm trying to emulate with this report. \begin{document} was something I forgot to copy in when I posted this message, sorry about that :(
Thanks again for your swift reply, I've fixed it all now, and I'll be sure to keep everything in mind for the inevitable next time I post!
Aarran
Post Reply