Take the 2-minute tour ×
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 using Stata to run some simultions, and my data change every time I run my do file. My data have a discontinuity that changes with each run and I'd like a curly brace that reflects the size of the discontinuity. I thought I could do this by having Stata write to file the following info, where the numbers change with every run:

\draw[decorate,decoration={brace},thick] (axis cs:0.1,0.846) to
       node[midway,right] (bracket) {0.339}
       (axis cs:0.1,0.507);

And then using an \insert{filename} command to call that, as below:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
ylabel={$\hat{\delta}$},
xlabel={$x$},
xmin=-4.5,
xmax=4.5
]
\addplot coordinates {(-4.5,0) (0,.507)};
\addplot coordinates {(0,.8456) (4.5,1)};
\insert{filename};
\end{axis}
\end{tikzpicture}
\end{document}

But I receive the following error:

ERROR: Missing number, treated as zero.

--- TeX said ---
<to be read again> 
               {
l.39 \insert{
         _filename_};

Any ideas?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Use \input instead of \insert. I'm not sure what \insert does, so I don't know why that doesn't work (\show\insert helpfully says \insert=\insert), but \input does work so use that.

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
ylabel={$\hat{\delta}$},
xlabel={$x$},
xmin=-4.5,
xmax=4.5
]
\addplot coordinates {(-4.5,0) (0,.507)};
\addplot coordinates {(0,.8456) (4.5,1)};
\input{pgfplotsinsertion};
\end{axis}
\end{tikzpicture}
\end{document}

Result:

inserted file

share|improve this answer
    
Hmm, image doesn't show for some reason. I'm pretty sure I uploaded one. –  Andrew Stacey Mar 18 '11 at 19:55
    
The image shows now. Sometimes imgur takes a while to process the image. –  Caramdir Mar 18 '11 at 20:18
    
According to TeX by Topic (chapter 29), \insert adds a floating box (or something like that, seems to be complicated). –  Caramdir Mar 18 '11 at 20:25
    
I think I just misread the manual. mea culpa - thanks for straightening me out! –  PaulB Mar 18 '11 at 20:43
add comment

Your Answer

 
discard

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.