There is a package I'm trying to modify that essentially displays a grid. It uses counters to increment the distance. I want to change the distance each step instead of adding a constant value. In fact, I simply want to multiply the current distance by a constant.
Anyways, I'm confused about how to use counters in TeX, compute things, and mixing LaTeX. When I try to use \setcounter or \newcounter in the package I get errors about redefinitions.
I've tried to use the calc package but cannot get it to mingle with the text.
The code
\advance\pos by 1
which instead of advancing it by 1 I want to advance it by 1, then 0.5, 0.25, etc... (it is in a loop)
I've even tried to advance it by a constant 0.5 and it gives an error. (as if one can only advance by integer amounts)
What I really want is some tutorial or guidance on what a package is and how to go about writing one. Is it TeX only and nothing special (I don't know much about TeX but have used LaTeX for typesetting for a several years)? Is there some special thing about packages? Can one mix TeX and LaTeX in a package? (doesn't seem so)
What I really need to know is how to do simple programmatical things like loops, variables, calculations, etc...
In the package I'm trying to modify I see things like \@whilenum, \multiply, \divide, etc. Which seem to correspond to the things I'm interested in but I can't find any references on the syntax or simple examples. Typing those into Google just returns a bunch of random packages that use them.
What I need to accomplish now is two things. I need to "advance" a counter by a geometrical progression instead of arithmetical (multiply instead of add) and I need to linearly interpolate between two points instead of using a constant.
In fact, in case anyone is interested, the package I'm trying to modify is
http://kasper.phi-sci.com/gchords/
What I want to do is have the fret lines drawn like a real fretboard (or approximately). Make the width of the fretboard start lower and gradually increase (it should be independent of the number of frets). Allow one to color the dots and add fret markers (3, 5, 7, 9, 12,.... frets).
I'd rather learn to write my own. Would be a piece of cake in something like C/C++ but I have no idea about TeX.
\posin this package is defined as acountregister, which can take only integer values. what you need is adimenregister.dimenregisters can be manipulated with\multiplyand\divideso that shouldn't be a problem. but converting all the registers in this package fromcounttodimenis probably going to be somewhat daunting. – barbara beeton Mar 15 '12 at 21:01pt, although internally they are integers insp= 'very small distances'. So for example\newdimen\mydimenthen\advance\mydimen0.5pt. – Joseph Wright♦ Mar 16 '12 at 8:47