0

I want to integrate this tikz code in my thesis, but when I do that I get 2 errors and lots of warning.

Errors :

1) Package tikz Error: + or - expected. ...ht=of $(A-4.east)!0.45!(A-5.east)$] (a1);
2) Missing $ inserted. ...ht=of $(A-4.east)!0.45!(A-5.east)$] (a1);

Both errors are in this line: \coordinate[right=of $(A-4.east)!0.45!(A-5.east)$] (a1);

I don't know what is wrong that I did, my document compiles perfectly before adding the tikz code. Any idea how to solve this?

My Code :

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, chains, positioning}

\begin{document}
    \begin{tikzpicture}[
    node distance = 6mm and 15mm,
    start chain = A going below,
    ]
    \tikzstyle{base}=[rectangle, draw, thick,
    text width=8em, minimum height=3.5em, align=flush center,
    on chain=A, join=by LA]
        \tikzstyle{box}=[base, rounded corners]
    \tikzstyle{EL}=[% Edge Labels
    font=\footnotesize, align=left]
    \tikzstyle{LA}=[% Line with Arrowhead
    thick, -Stealth]


    \node [box]     {User Requirements};            % A-1
    \node [base]    {Informal Specification};
    \node [base]    {Formal Specification};
    \node [base]    {Protocol Verfication};         % A-4
    \node [base]    {Implementation Development};
    \node [base]    {Conformance Testing};
    \node [base]    {Interoperability Testing};
    \node [box]     {Maintenance};                  % A-8
    %
    \draw [LA]  (A-4.east) -- ++ (1.5,0) |-
    ($(A-2)!0.45!(A-3)$) node[EL,pos=0.25,right]{Errors\\ Detected};
    % auxilary coordinates
    \coordinate[right=of $(A-4.east)!0.45!(A-5.east)$] (a1);
    \coordinate[right=of a1] (a2);
    \draw [LA]  (A-6) -| (a1) node[EL,pos=0.75,right] {Errors\\ Detected};
    \draw [LA]  (A-7) -| (a2) node[EL,pos=0.75,right] {Errors\\ Detected};
    \draw [LA]  (a2)  -- (a2 -| A-5);

    \end{tikzpicture}
\end{document}

Thanks in advance

Nousa
  • 525
  • do you have the same libraries in your main document as are used in standalone document? for test, what is going on, please provide shortened main document with only this code. – Zarko Sep 28 '17 at 14:46
  • yes, I have the same, along with other packages needed. – Nousa Sep 28 '17 at 15:03
  • 1
    It's hard to debug when the code you show us does work ... You can try using \coordinate (a1) at ($(A-4.east)!0.45!(A-5.east) + (15mm,0)$); instead, but if you want to learn what the problem is, then you'll probably need to make a minimal example that reproduces the error. – Torbjørn T. Sep 28 '17 at 15:51
  • Actually, I had a thought: try adding \usetikzlibrary{babel}. – Torbjørn T. Sep 28 '17 at 15:51
  • @TorbjørnT. oh my god it works with \usetikzlibrary{babel}, I really appreciate, thank you so much! – Nousa Sep 28 '17 at 16:00
  • 1
    If you use TikZ along with the babel package, it's often a good idea to include that library. It depends on language though, but for some languages the character codes of certain characters are changed by the babel package, which messes things up when those characters are used for specific things in TikZ. The babel library tries to fix such incompatibilities. – Torbjørn T. Sep 28 '17 at 16:02

0 Answers0