Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LaTeX \divide

879 views
Skip to first unread message

Anish Tondwalkar

unread,
Jul 5, 2009, 4:17:01 PM7/5/09
to
I am trying to label axes in a graph, I get the error:

! You can't use `the character 1' after \divide.

My code is:

[...]

\usepackage{pstricks}

\newcommand{\XMAX}{10}
\newcommand{\YMAX}{10}
\newcommand{\XMIN}{0}
\newcommand{\YMIN}{0}
\newcommand{\XUNIT}{1}
\newcommand{\YUNIT}{1}

\setlength{\unitlength}{.3cm}

\begin{picture}(10,10)(\XMIN,\YMIN)
\put(0,0){\line(0,1){\XMAX}}
\put(0,0){\line(1,0){\YMAX}}
\put(0,0){\line(0,-1){\XMIN}}
\put(0,0){\line(-1,0){\YMIN}}
\multiput(0,0)(0,\XUNIT){\XMAX \divide \XUNIT}{\line(-1,0){.2}}
\put(0,0){\circle{.2}}
\end{picture}

[...]

Robin Fairbairns

unread,
Jul 5, 2009, 4:49:44 PM7/5/09
to
Anish Tondwalkar <twilig...@gmail.com> writes:
>I am trying to label axes in a graph, I get the error:
>
>! You can't use `the character 1' after \divide.

\divide isn't a binary operator, it's described in the texbook, not in
any latex manual.

syntax

\divide <register> by <number>

(iirc); <register> is a \count or a \dimen. it's a tex primitive,
nothing (direct) to do with latex.

>My code is:
>
>[...]
>
>\usepackage{pstricks}
>
>\newcommand{\XMAX}{10}
>\newcommand{\YMAX}{10}
>\newcommand{\XMIN}{0}
>\newcommand{\YMIN}{0}
>\newcommand{\XUNIT}{1}
>\newcommand{\YUNIT}{1}
>
>\setlength{\unitlength}{.3cm}
>
>\begin{picture}(10,10)(\XMIN,\YMIN)
>\put(0,0){\line(0,1){\XMAX}}
>\put(0,0){\line(1,0){\YMAX}}
>\put(0,0){\line(0,-1){\XMIN}}
>\put(0,0){\line(-1,0){\YMIN}}
>\multiput(0,0)(0,\XUNIT){\XMAX \divide \XUNIT}{\line(-1,0){.2}}
>\put(0,0){\circle{.2}}
>\end{picture}
>
>[...]

(a) it's not a minimal example -- i can't compile that
(b) i don't understand what pstricks has to do with it
(c) latex provides a package package calc for doing calculations,
which hides the use of \divide (which i had to dig in my memory about,
since i've not used it for ages ... having first used it in the 1980s).
--
Robin Fairbairns, Cambridge

Anish Tondwalkar

unread,
Jul 5, 2009, 5:57:47 PM7/5/09
to
Thank you; I could not find that syntax. It solved my problem.

>\divide isn't a binary operator, it's described in the texbook, not in
>any latex manual.

Having learnt by jumping manual to manual, I haven't read any
textbooks on the matter. Which would you recommend?

zugzwang

unread,
Jul 5, 2009, 6:46:42 PM7/5/09
to

see comp.text.tex(Writing something left-justified and something right-
justified), 01-06-2009, re the last entry, by
buyoni...@bluebottle.com.


Robin Fairbairns

unread,
Jul 5, 2009, 6:56:29 PM7/5/09
to

it depends what you're trying to do. if you're trying to use pstricks
(as your code suggested), then there's some good pstricks manuals on
the web and so on. i believe there are ways of doing arithmetic in
pstricks, but i'm really no expert.

if you want to use latex picture mode, then you have to fall back on
the calc package to do your sums. "texdoc calc" on a texlive or tetex
system would help; otherwise grab it from the web

http://mirror.ctan.org/macros/latex/required/tools/calc.pdf
--
Robin Fairbairns, Cambridge

0 new messages