1

The following works fine on mactex and on www.overleaf.com, but not on the CentOS 7 at my work.

On CentOS I get complaints about "Package tikz Error: Giving up on this path. Did you forget a semicolon?".

The complaint is about line 25, i.e. the line where I use \r for the first time.

Both on mactex and on CentOS I use AUCTeX. I have a vague feeling it is related to my use of "sin(..)".

Any ideas what could be wrong?

% Geometry
% Author: MK
\documentclass{article}
\usepackage{tikz}
%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength{\PreviewBorder}{10pt}%
%%%>
\begin{comment}
:Title: Geometry
:Tags: Angles;Annotations;Basics;Mathematics;Geometry
:Author: MK
\end{comment}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
  \def\R{10};
  \def\b{45};
  \def\a{\b/2};
  \def\r{\R*sin(\a)/(1+sin(\a))};

  \draw[semithick] ({90+\a}:{\R-2*\r}) -- ({90+\a}:{\R});
  \draw[dashed,semithick] (0,0) -- ({90+\a}:{\R-2*\r});

  \draw[semithick] ({90-\a}:{\R-2*\r}) -- ({90-\a}:{\R});
  \draw[dashed,semithick] (0,0) -- ({90-\a}:{\R-2*\r});

  \draw[semithick] ({90+\a}:{\R}) arc ({90+\a}:{90-\a}:\R);

  \draw[semithick] ({90+\a}:{\R-2*\r}) arc ({90+\a}:{90-\a}:{\R-2*\r});


  \draw (0,{\R-\r}) circle (\r);
\end{tikzpicture}
\end{document}
4
  • Welcome to TeX.SE! I cannot reproduce the error but wonder if replacing \def\r{\R*sin(\a)/(1+sin(\a))} by \pgfmathsetmacro{\r}{\R*sin(\a)/(1+sin(\a))} fixes the problem.
    – user121799
    Feb 5, 2019 at 21:29
  • I will try that at work tomorrow. It works in mactex. Thank you!
    – M.K.
    Feb 5, 2019 at 21:33
  • @marmot CentOS 7 ships PGF 2.10 from 2012. Feb 6, 2019 at 8:27
  • @HenriMenke Thanks! I didn't know that.
    – user121799
    Feb 6, 2019 at 15:15

1 Answer 1

1

Thanks to marmot it now works. I changed \def\r{\R*sin(\a)/(1+sin(\a))} to \pgfmathsetmacro{\r}{\R*sin(\a)/(1+sin(\a))} The working example:

% Geometry
% Author: MK
\documentclass{article}
\usepackage{tikz}
%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength{\PreviewBorder}{10pt}%
%%%>
\begin{comment}
:Title: Geometry
:Tags: Angles;Annotations;Basics;Mathematics;Geometry
:Author: MK
\end{comment}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
  \def\R{10};
  \def\b{45};
  \def\a{\b/2};
  \pgfmathsetmacro{\r}{\R*sin(\a)/(1+sin(\a))};

  \draw[semithick] ({90+\a}:{\R-2*\r}) -- ({90+\a}:{\R});
  \draw[dashed,semithick] (0,0) -- ({90+\a}:{\R-2*\r});

  \draw[semithick] ({90-\a}:{\R-2*\r}) -- ({90-\a}:{\R});
  \draw[dashed,semithick] (0,0) -- ({90-\a}:{\R-2*\r});

  \draw[semithick] ({90+\a}:{\R}) arc ({90+\a}:{90-\a}:\R);

  \draw[semithick] ({90+\a}:{\R-2*\r}) arc ({90+\a}:{90-\a}:{\R-2*\r});


  \draw (0,{\R-\r}) circle (\r);
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .