1

I'm new to vim-latex and to tikz. I'm trying to create a FSM using tikz library as explained here. I used the same lated code

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,shapes,shadows,arrows,fit}
\begin{document}
%hello world!
%in the document
\begin{tikzpicture}
\node(pseudo) at (-1,0){};
\node(0) at (0,0)[shape=circle,draw]        {$q_0$};
\node(1) at (2,0)[shape=circle,draw]        {$q_1$};
\node(2) at (4,0)[shape=circle,draw]        {$q_2$};
\node(3) at (6,0)[shape=circle,draw,double] {$q_f$};
\path [->]
  (0)      edge                 node [above]  {b}     (1)
  (1)      edge                 node [above]  {a}     (2)
  (2)      edge                 node [above]  {b}     (3)
  (2)      edge [bend left=30]  node [below]  {a}     (0)
  (0)      edge [loop above]    node [above]  {a}     ()
  (1)      edge [loop above]    node [above]  {b}     ()
  (3)      edge [loop above]    node [above]  {a,b}   ()
  (pseudo) edge                                       (0);
\end{tikzpicture}
\end{document}

When I paste this code in Texmaker, it generates the right FSM as described in the link above. But when I paste it in vim (vim-latex installed following this), it just generate a pdf file that has some letters over each other in the middle of the page. Could someone please tell me what is the problem? Thanks

6
  • 1
    Welcome to TeX.SX! Try setting let g:Tex_DefaultTargetFormat='pdf' which will call pdflatex. By default vim-LaTeX uses the dvi->ps->pdf chain rather than pdflatex which I think has caused trouble with TikZ in past questions.
    – Dai Bowen
    Commented Jun 8, 2017 at 11:14
  • See if my answer to Vim Latex ''compacts'' Tikz pictures during compile helps, this may be a dupe.
    – Dai Bowen
    Commented Jun 8, 2017 at 11:15
  • Thank @DaiBowen, it works now fine for me after adding let g: .. to .vimrc. Commented Jun 8, 2017 at 12:03
  • Should I delete the question? Commented Jun 8, 2017 at 12:07
  • No need to delete it, if it's marked as a duplicate then that may make it easier for others to find the solution (different questions appear in different searches) and is sufficient for the question to be treated as resolved. Nothing should stop you deleting the question if you really want to.
    – Dai Bowen
    Commented Jun 8, 2017 at 12:10

0

Browse other questions tagged .