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 have difficulty in using standalone package along with TikZ.

I have the following standalone file: l1NormInAction.tex



\draw [thick, ->] (-1.5,0)--(3,0);
\draw [thick, ->] (0,-1.5)--(0,2);
\draw[blue,dashed, thick] (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
\node[above right] at (0,1) {$\hat{\mathbf{x}}$};
\node[below left] at (0,0) {$\mathbf{x}$};
\draw[<->,shorten <=-1cm, shorten >=-3mm,thick] (0,1)--(2,0) node [right, above] {$\mathbf{D}$};



Using standalone package I used the following code in my document.


The output is attached here. This is not in the expected format and it contains some strange number. Where am I going wrong?

enter image description here

share|improve this question

closed as unclear what you're asking by cfr, Papiro, Werner, Masroor, Jesse Oct 14 '14 at 3:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Sorry, but I can't reproduce the problem. What TeX distribution are you using? – egreg Jul 15 '14 at 22:33
My Tex version is TeX 3.1415926 (TeX Live 2013/Debian). Please see my comment for Andrew's answer. – Sooraj Jul 15 '14 at 22:54

For me this works fine, producing the image:

enter image description here

You didn't say what your main tex file looks like, so perhaps that's the problem? I used:





(I renamed your standaline file to f.tex.)

If you are still having problems then post a full MWE.

share|improve this answer
Thanks for your efforts. I could also compile the minimum version you provided. But my original code is very lengthy and I may not be able to provide it here. But I think, the numbers printed on the left side of the figure has some information about the error. Any clue in that direction? – Sooraj Jul 15 '14 at 22:52
@Sooraj The numbers are likely to be tikz dimensions, but they could be anything. As your "code is lengthy" I suggest that you try selectively commenting out things until you can isolate what is causing the problem. – Andrew Jul 16 '14 at 8:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.