# Unknown package calc error in bibliography

I am using a style file prescribed by Riton Press to write an article. They have a bibliography format (described in their style file as):

\renewenvironment{thebibliography}[1]
{\frenchspacing
\small\rm\baselineskip=11pt
\begin{list}{\arabic{enumi}.}
{\usecounter{enumi}\setlength{\parsep}{0pt}
%          \setlength{\leftmargin 12.7pt}{\rightmargin 0pt}%FOR 1--9 ITEMS
\setlength{\leftmargin 17pt}{\rightmargin 0pt}  %FOR 10--99 ITEMS
%         \setlength{\leftmargin 22pt}{\rightmargin 0pt}   %FOR 100+ABOVE ITEMS
\setlength{\itemsep}{0pt} \settowidth
{\labelwidth}{#1.}\sloppy}}{\end{list}}


However, this keeps giving the following error while compiling the tex file:

! Package calc Error: 0' invalid at this point.

See the calc package documentation for explanation.
Type  H <return>  for immediate help.
...

l.1 \begin{thebibliography}{10}

?
! Missing number, treated as zero.
\protect
l.1 \begin{thebibliography}{10}

?
! Illegal unit of measure (pt inserted).
\protect
l.1 \begin{thebibliography}{10}

?

! LaTeX Error: \begin{list} on input line 1 ended by \end{thebibliography}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.136 \end{thebibliography}

?
) [32

]


But if I ignore these errors, all the references are displayed. It displays the text "pt!" in the references page.

Kindly help me know how I can avoid the errors from the bibliography part.

-
We'll need a link to try this out, but \setlength{\leftmargin 17pt}{\rightmargin 0pt} is out-and-out wrong (although it doesn't fail if calc is not loaded). Looks like a bug in the class to me. – Joseph Wright Aug 14 '13 at 9:16
I presume you asked for a link to the style file containing the above \setlength{...}{...} command. Here is a zip file containing the style file: rintonpress.com/style/QIC-latex2e.zip . When I use the package qic with amsmath,amssymb,xfig,algorithm} it is giving the error I had mentioned. – Pavithran Iyer Aug 14 '13 at 9:53
Yes, that was the one: it's horrible! – Joseph Wright Aug 14 '13 at 10:17

 \setlength{\leftmargin 17pt}{\rightmargin 0pt}


(tries to) set a length register called \leftmargin17pt to the value \rightmargin0pt

By an accident of the original definition of \setlength this does not generate an error and sets \leftmargin to 17pt and \rightmargin to 0pt by luck.

If you load calc your luck changes.

-
Thanks. I learn from your post that the solution is either to not load the calc package or to not use \setlength{\leftmargin 17pt}{\rightmargin 0pt} . However, I have not loaded calc explicitly nor is it loaded on the style file. Is there any way of explicitly un-loading the calc package ? – Pavithran Iyer Aug 14 '13 at 9:45
@PavithranIyer whether you load calc or not you should fix \setlength{\leftmargin 17pt}{\rightmargin 0pt} as it is just wrong. You can't Unload" a package once it is loaded. – David Carlisle Aug 14 '13 at 9:47
God bless you for figuring this out before me; I am also trying to use qic.sty and they haven't fixed it yet. I will send them a note. – user41292 Nov 19 '13 at 15:37

Having the same problem, with he same style file (QIC from Rinton press) two years later, I give here the hack I deduced from David Carlisle's answer : one just have to refine (correctly !) the bibliography environment before calling it in the tex file. The end of your tex file should then look like:

\nonumsection{Acknowledgements}
\noindent
I thank P. Iyer and D. Carlisle for saving a lot of time debugging this
\TeX file !

\renewenvironment{thebibliography}[1]
{\frenchspacing
\small\rm\baselineskip=11pt
\begin{list}{\arabic{enumi}.}
{\usecounter{enumi}\setlength{\parsep}{0pt}
%          \setlength{\leftmargin}{12.7pt}%FOR 1--9 ITEMS
\setlength{\leftmargin}{17pt}  %FOR 10--99 ITEMS
%         \setlength{\leftmargin}{22pt}   %FOR 100+ABOVE ITEMS
\setlength{\rightmargin}{0pt}
\setlength{\itemsep}{0pt} \settowidth
{\labelwidth}{#1.}\sloppy}}{\end{list}}
\nonumsection{References}
\noindent
\bibliographystyle{unsrt}
\bibliography{bibfile}
\end{document}
`
-