AH! Thank you very much. I found out that it's not the package per se, but that it hates the guts out of \value{counter} (It pretty much puts in a tab everytime it's used in the same line, say Array(\value{row},\value{column}).) I just changed them all to \arabic{counter}, and it worked like a charm.
As a side note, are all counters global variables, or is it possible to define a counter only within a certain scope? (I already had that minor problem when trying to get \name[full]{person} to recursively call \name[first]{person} \name[last]{person}, although it helped that the row variable would necessarily be the same when it returned back.)
General ⇒ Latex as a programming language
NEW: TikZ book now 40% off at Amazon.com for a short time.

Latex as a programming language
Counters defined with \newcounter are global.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Latex as a programming language
Depending on your intent, you could use some of the TeX conditionals (perhaps an \ifcase command could be useful for you); Chapter 13 "Conditionals" in TeX by topic, by Victor Eijkhout, contains an excellent description of the various types of conditionals.lalop wrote:...Still missing the switch *hint hint* <3
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Latex as a programming language
Thanks again, I'll try to find that in the library.
I thought I would share what I made as thanks. It seems bug-free when checking on a fairly large old story that wrote with the old \name macro, and also in my additional testing. I would've preferred being able to preserve the old \cachedata when you call \name, but it doesn't seem possible.
In either case, it automatically outputs the "placeholdar" message if what you're looking for is empty, which already makes it less error-prone than the old macro.
Edit: It didn't seem appropriate to make it default to first name no matter what was in the [ ] box, now that there was so much error-checking otherwise. So i made it default to placeholdar if it doesn't recognize the [ ] word.
I thought I would share what I made as thanks. It seems bug-free when checking on a fairly large old story that wrote with the old \name macro, and also in my additional testing. I would've preferred being able to preserve the old \cachedata when you call \name, but it doesn't seem possible.
In either case, it automatically outputs the "placeholdar" message if what you're looking for is empty, which already makes it less error-prone than the old macro.
Code: Select all
% USAGE IN PREAMBLE:
% Firstly, near the very top, \usepackage{lookupname} .
%
% In the lower preamble of your main file, read out an array called Names. This is a sample Names array:
%
% \readarray{Names}{%
% cargoship&Maurent&&&&&%
% outercolony&Vinda&V&&&&%
% aide&Marius&Robert&Jr&&&%
% pirateship1&\emph{Rakoza}&&&&&%
% headmaster&Albus&Dumbledore&Parzival&Wolfric&Brian&%
% }%
%
% The delimeter & has the effect of separating into columns.
%
% By default, the first column is an identifier of a person, the other 5 are the person's names. The first/last names are columns 2/3, respectively.
%
% You can add more names per person by \setnamesperperson{number}, e.g. \setnamesperperson{20} BUT NOTE that you'd also have to add more & per line. The number of & needs to be equal to namesperperson+1.
%
%
%
% IN ACTUAL DOCUMENT:
% Use \name[number,first,last,full,or shortcut]{identifier}. \name{identifier} or any unknown shortcut defaults to first name. There are no shortcuts for names > 2. One has to use \name[3]{Marius},...,\name[5]{Marius}.
%
% e.g. \name[full]{headmaster} gives ``Albus Dumbledore'' with the above array. A shortcut is \name[f]{headmaster} giving the same thing.
%
% If you wanted to announce his whole name, it'd have to be:
% \name{headmaster} \name[3]{headmaster} \name[4]{headmaster} \name[5]{headmaster} \name[las]{headmaster}
% The idea is that this is pretty rare, and mostly when you want a full name it's usually just the first and last.
%
%
% ERROR-CHECKING:
% \name will automatically output the word ``placeholdar'' (with an a, to avoid legitimate placeholders) if you try to specify an out-of-bounds array element, if the name/person you specify does not exist, or if it does not recognize what you put in the [ ] box. So search your file for the word ``placeholdar''.
- Attachments
-
- lookupname.sty
- (5.6 KiB) Downloaded 210 times
Latex as a programming language
You can download the book for free. Follow the link that appears in the page I linked to in my previous reply.lalop wrote:...I'll try to find that in the library...
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: Latex as a programming language
I missed that. Thanks.