[Tex/LaTex] How to solve the Arithmetic overflow problem

articlecalculationserrorslengths

I was making an article and everything was going alright, when suddenly I got an error:

The error:

Arithmetic overflow.
\calc@Acount

l.78 …qwe dqweqwrwf qewrfrQ aRF EFCas drfFR}{62}

My article looks ike this:

\documentclass [a4paper] {article}
\usepackage [magyar]{babel}
\usepackage {t1enc}
\usepackage [utf8]{inputenc}
\usepackage {calc}
\usepackage{ifthen}
\usepackage {tikz}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usepackage[nomessages]{fp}
\usepackage{xparse}


\title{teszt}



\newcommand*{\getlength}[2]{%
   % Convert to `cm` and round to two fractional digits:
   \pgfmathsetmacro#1{round(3.51459804*#2)/100.0}%
}

\newcommand {\barany}[2] {
%
\newlength{\myoszzhosz}
\newlength{\oszsormag}
\newlength{\osszsormag}

\newcount{\szeles}
\newlength{\sormag}

\szeles=#2
\the\szeles
\settowidth{\sormag}{drfesga}
%
%
\settowidth{\myoszzhosz}{#1}
\getlength{\valueoszhosz}{\myoszzhosz}
\getlength{\valuesormag}{\sormag}
\setlength{\oszsormag}{\myoszzhosz/\szeles}
\setlength{\osszsormag}{\oszsormag*\sormag}

% 

\begin{tikzpicture}[scale=0.5,>=stealth]



   \draw [shift={(0,1)}][domain=270:90]  plot ({cos(\x)}, {sin(\x)});

   \draw [shift={(2,1)}][domain=0:180]  plot ({cos(\x)}, {sin(\x)});

   \draw [shift={(4,1)}][domain=360:180]  plot ({cos(\x)}, {sin(\x)});

   \draw [shift={(6,1)}][domain=270:450]  plot ({cos(\x)}, {sin(\x)});

   \node[\textwidth=#2pt] at (2,0) {#1};


\end{tikzpicture}
}




\begin{document}


\barany{ptn kthkthkt hkthkthk thktfa dsgrf gadf gagag fagaga gadfgfdag fdaarfgg adasad
fggdfgrgdhfb brhgfhb}{62}




\end{document}

Can you help me somehow?

Best Answer

Apart from \textwidth needing to be text width the code generating errors did not appear to be used for anything so I simply deleted it. I also deleted all packages not used in the example.

\documentclass [a4paper] {article}
\usepackage {tikz}


\title{teszt}




\newcommand {\barany}[2]{%
%
\begin{tikzpicture}[scale=0.5,>=stealth]
   \draw [shift={(0,1)}][domain=270:90]  plot ({cos(\x)}, {sin(\x)});
   \draw [shift={(2,1)}][domain=0:180]  plot ({cos(\x)}, {sin(\x)});
   \draw [shift={(4,1)}][domain=360:180]  plot ({cos(\x)}, {sin(\x)});
   \draw [shift={(6,1)}][domain=270:450]  plot ({cos(\x)}, {sin(\x)});
   \node[text width=#2pt] at (2,0) {#1};
\end{tikzpicture}%
}




\begin{document}


\barany{ptn kthkthkt hkthkthk thktfa dsgrf gadf gagag fagaga gadfgfdag fdaarfgg adasad
fggdfgrgdhfb brhgfhb}{62}




\end{document}

This runs without error and produces

enter image description here

Which I assume isn't your desired output but I could not guess your desired output from the description given.

If you have a specific question about how to draw something using tikz it would be better focus in on one specific aspect and ask about that in a new question, rather than posting a large code with syntax errors and just asking how to avoid the error, which can only really be answered as here by fixing the syntax problems rather than producing any reasonable output.

Related Question