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}
Henry
  • 1,115
  • Could you elaborate on 'did not compile': this is 'works for me' with an up-to-date TeX Live 2013 system. – Joseph Wright Feb 01 '14 at 07:41
  • Works here fine as well. – Uwe Ziegenhagen Feb 01 '14 at 07: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 01 '14 at 07: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 01 '14 at 07: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 01 '14 at 07:56
  • @JosephWright I am currently using CTEX, I think that is a Chinese version, got that from a friend, I am now installing MikTex, by the way, is it alright to have more than one TeX system installed in our computer? I tried pdfLatex but it didn't work either, I don't quite understand what do you mean by .log file, thanks. – Henry Feb 01 '14 at 08:05
  • @Henry When you run TeX, it will always create a .log file telling you what it did. It is in there that you'll find error messages, etc. – Joseph Wright Feb 01 '14 at 08:12
  • @JosephWright No, I don't think there is any such message, it said errors:0 warnings:0. I am now about to install another TeX system to see whether it will work, is it ok to install more than one TeX system, then how could the computer know which system to use? – Henry Feb 01 '14 at 08:19
  • @Henry errors:0 warnings:0 is what WinEdt thinks has happened, but that may be wrong. You really should look in the .log file. You can certainly have more than one TeX system installed: I routinely have two or three available. – Joseph Wright Feb 01 '14 at 08:26

1 Answers1

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.

Henry
  • 1,115
  • Seriously, did you use pdftex for all your documents up to now? – Claudio Fiandrino Feb 01 '14 at 09: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 02 '14 at 14:38