3

This code snippet compiles fine on Windows 7. However, when I ran it on Linux, the compiler complained that it couldn't find the key /tikz/align. Obviously, get rid of the option align=flush center solved the compiler errors, but the consequence was I don't get my expected display. Am I missing some other packages here? or there are several differences between TeXLive and MikTeX?

\documentclass[10pt,letterpaper]{article}

\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{ntheorem}
\usepackage{polynomial}
\usepackage{layouts}
\usepackage{enumerate}
\usepackage{mdwtab}


\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,backgrounds,petri,positioning}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.fractals}
\usetikzlibrary{decorations.footprints}
\usetikzlibrary{shadows}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\usepackage[bookmarksopen,bookmarksdepth=3]{hyperref}
\usepackage{titlesec}
\usepackage{xcolor}

%define new colors
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}

%set up color for table of contents
\hypersetup{
    colorlinks, linkcolor={medium-blue},
    citecolor={dark-blue}, urlcolor={medium-blue}
}

\usepackage{tocloft}

%preven linebreak between subsection header and its content
\usepackage{titlesec}
\titleformat{\subsection}[runin]{\normalfont\bfseries}{\thesubsection.}{3pt}{}
\titleformat{\section}[runin]{\normalfont\bfseries}{\thesection.}{3pt}{}
%title
\title{\textbf{Solution for Chapter 1}}

\begin{document}

    \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
        \node[state,initial]    (q_1)                           {$q_1$}; 
        \node[state,accepting]  (q_2)   [right=of q_1]          {$q_2$}; 
        \node[state]            (q_3)   [below right=of q_1]    {$q_3$}; 

        \path[->]
        (q_1) edge  [bend left]     node {a}            (q_2)
        (q_1) edge  [loop above]    node {b}            (q_1)
        (q_2) edge  [bend left]     node {a,b}          (q_3)
        (q_3) edge  [bend left]     node {a}            (q_2)
        (q_3) edge  [bend left]     node {b}            (q_1);

        \node [below=1cm, align=flush center,text width=8cm] at (q_3)
        {
            $M_1$
        };
    \end{tikzpicture}
\end{document}
Werner
  • 603,163
roxrook
  • 9,907
  • 5
    Have you checked that your TikZ versions are identical on both systems? You can check your version by inserting \pgfversion after \begin{document}; the version will then be printed in your document. I suspect your Linux version is older than 2.1, and should really be updated. – Jake Aug 05 '11 at 05:06
  • @Jake: You're right. On my Linux system, it is 2.00. I do need an update. Thanks a lot. – roxrook Aug 05 '11 at 05:21
  • You might find this question useful on getting the most recent version of TikZ/PGF: http://tex.stackexchange.com/q/2044/86 – Andrew Stacey Aug 05 '11 at 08:44

1 Answers1

5

The only way to obtain an up-to-date version of both systems (TeX Live and MiKTeX) would be via the respective update managers (tlmgr and mpm). However, in general, this is not the case.

The most recent download of TeX Live is 2011 (dated July 20, 2011), while the most recent version of MiKTeX is 2.9 (dated October 2010). If these versions are downloaded as-is, they would have different versions of the packages, possibly leading to different compatibility issues.

The best way to assess the differences between an installation would be to check your .log file, which should output some version information for each package. That way you'll see which version has the most up-to-date (and likely, more compatible) packages.

Werner
  • 603,163
  • Thanks a lot. So should I update TikZ itself rather than the whole TeXLive? and what's the easiest way to update TeXLive? – roxrook Aug 05 '11 at 05:31
  • The easiest, and possibly quickest, way is to only update what you need via tlmgr [pkg]. The tlmgr documentation gives all the options needed to update single packages (by specifying the package, say pgf) to everything (by specifying the option -all). – Werner Aug 05 '11 at 05:40
  • I tried tlmgr but seemed like this command does not come with TeXlive2009. I'm running Ubuntu 10.04. I think I have to manually re-install TeXLive again. – roxrook Aug 05 '11 at 06:22
  • The version of TeXlive found in Ubuntu's repositories does not have tlmgr. To get that, you have to install TL with the installer found on the TL website. – Torbjørn T. Aug 05 '11 at 07:22