# How to solve the Arithmetic overflow problem?

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}

fggdfgrgdhfb brhgfhb}{62}

\end{document}


Can you help me somehow?

• I think it would be useful to specify what you want to achieve here. The overflow itself is easy enough to pin down it's in \setlength{\osszsormag}{\oszsormag*\sormag}) but without really knowing what you want to do it's hard to suggest a better way. – Joseph Wright Dec 22 '14 at 9:23
• I want to make a special textbox wich has a special frame. I decided to do it with one TikZ picture and a node in it, but I need to know the nodes height to make the frame. I wanted to do this so that already in the parameter of the command I get the width(#2) and from the calc package I divide the width of the whole text by the width(#2), so we would get the number of the rows in the text. Then I multiplied it with the height of the rows (8.83118pt). Like this we would get the height of the textbox, so that we could write a program that would make a frame for it from repeating shapes. – encuka Dec 22 '14 at 10:30
• it's clear that \textwidth= should be text width = in the node key, and that all the \newlength commands should be outside your macro definition, not inside it, and that there should be % at the end of most of the lines, but really there is far too much code with too little explanation of its intention to be able to debug it easily. – David Carlisle Dec 22 '14 at 11:32
• We are a little group of two people. We aren’t really good at LaTeX, because we haven’t used it for other purposes then writing a text in it. We have to be ready with a package till 21. December. In this package we have to make a function that makes a textbox inside a sheep that writes out the first parameter, and the textbox width of the textbox is #2(like a parbox). So, because non of us has ever made a „program” in LaTeX before, we have no clue what does the % sign do on the end of the lines other then making a comment. – encuka Dec 22 '14 at 13:15
• The way we started to make this is: We will draw out the head, the tail, and the legs of the sheep in a concrete scale, and beside that we would genrate the other parts of the sheep from half circles, with the dimensions of our node with loops what are the size of the margin + the heigth of the node divided by the size of a half circle and rounded up gives us the width of the sheep. From this we cut down the size of the head, and the tail of the sheep so we would get the size the wool of the sheep. This will give us that how many half circles there are on the edge of the sheep. – encuka Dec 22 '14 at 13:16

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}