2

I tried to type a TikZ code for the first time but it did not compile, and I have no idea why. Is there any other packages that I have to use or is there anything wrong with the syntax?

\documentclass[11pt,twoside,a4paper]{article}
\usepackage{tikz}    
\begin{document}
\begin{tikzpicture}
\node (h) at (0,0) {hello};
\node (w) at (2,3) {world};
\draw (h) edge (w);
\end{tikzpicture}
\end{document}
  • Could you elaborate on 'did not compile': this is 'works for me' with an up-to-date TeX Live 2013 system. – Joseph Wright Feb 1 '14 at 7:41
  • Works here fine as well. – Uwe Ziegenhagen Feb 1 '14 at 7:41
  • @Joseph Wright, Uwe Ziegenhagen: I am using WinEdt as the editor, and there is this TeXify to see the preview, but if it just didn't work for this one. The preview did not appear, but it worked for my other tex documents.. – Henry Feb 1 '14 at 7:46
  • the environment tikzpicture is underlined in red, not like the other environment such as document, itemize, etc. Does that mean it is not installed yet? – Henry Feb 1 '14 at 7:50
  • @Henry Your editor is just a front-end for LaTeX: id doesn't actually set what will work. Which TeX system do you use (MiKTeX, TeX Live, ...?). If you run pdfLaTeX on your file (rather than TeXify), what does your .log file say? – Joseph Wright Feb 1 '14 at 7:56
1

I think I have found a way to make the document working. Instead of TeXify or PDFTeX, try PDFLaTeX. Somehow I managed to create a PDF document with all the graphics displayed exactly as what the codes should do. Although I don't entirely understand the reason, I got this idea when I glanced through this question: What's the difference between pdfTeX and pdfLaTeX?

If anyone could add some more explanations that would be very great.

| improve this answer | |
  • Seriously, did you use pdftex for all your documents up to now? – Claudio Fiandrino Feb 1 '14 at 9:51
  • @ClaudioFiandrino: Well, I couldn't remember which one I used, I use the one that works.. but now I just realised that there are differences between the two. prior to this, I always use TeXify and it always works, just for this tikz case that it fails to work, that's the reason for my confusion.. – Henry Feb 2 '14 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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