/usr/share/perl5/LaTeXML/Package/multido.sty.ltxml is in latexml 0.7.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # -*- CPERL -*-
# /=====================================================================\ #
# | multido.sty | #
# | Implementation for LaTeXML | #
# |=====================================================================| #
# | Part of LaTeXML | #
# | | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov> #_# | #
# | http://dlmf.nist.gov/LaTeXML/ (o o) | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use LaTeXML::Package;
###########################################################################
##
###########################################################################
DefMacro('\multido{}{Number}{}',sub {
my($gullet,$variables,$repetitions,$actions)=@_;
my @vars=();
my @expansion=();
$gullet->openMouth($variables,1);
while(my $var = $gullet->readToken){
$var->getCSName =~ /^\\(d|n|i|r)/i;
my $type = $1;
Error(":unexpected:".ToString($var)." Wrong format for multido variable: ".ToString($var)) unless $type;
$gullet->readKeyword("=")
or Error(":expected:= Missing = in multido variables");
my($init,$step);
if ($type eq 'd'){ $init = $gullet->readDimension; }
elsif($type eq 'n'){ $init = $gullet->readNumber; }
elsif($type eq 'i'){ $init = $gullet->readNumber; }
elsif($type eq 'r'){ $init = $gullet->readFloat; }
$gullet->readKeyword("+")
or Error(":expected:+ Missing + in multido variables");
if ($type eq 'd'){ $step = $gullet->readDimension; }
elsif($type eq 'n'){ $step = $gullet->readNumber; }
elsif($type eq 'i'){ $step = $gullet->readNumber; }
elsif($type eq 'r'){ $step = $gullet->readFloat; }
push(@expansion,T_CS('\def'),$var,T_BEGIN,$init->revert,T_END);
push(@vars,[$var,$init,$step]);
last unless $gullet->readKeyword(",");
}
$gullet->closeMouth;
# Now, accumulate $repetitions copies of $actions
# with @vars set appropriately.
my $n = $repetitions->valueOf;
for(my $i=0; $i<$n; $i++){
push(@expansion, $actions->unlist);
foreach my $entry (@vars){
$$entry[1] = $$entry[1]->add($$entry[2]);
push(@expansion,T_CS('\def'),$$entry[0],T_BEGIN,$$entry[1]->revert,T_END); }}
@expansion; });
1;
|