|
最近、新しいPC(Win10,64bit)を購入し、これまで使っていたPC(Win7,64bit)からt
ex用のマクロファイルを一式コピーしました。
新しいPCの秀丸のverは8.87(32bit)、古いPCのverは8.32です。texのコンパイル自体
はできるのですが、入力支援用のマクロが機能しなくなりました。
ここで聞くのは不適切かもしれませんが、どこに問題がありそうか教えていただけま
すでしょうか。いかがそのマクロです。
よろしくお願いいたします。
---------------------------------------------------------------------------
openreg "CURRENTUSER", "Software\\Hidemaruo\\Hidemaru\\Env";
$MacroDir = getregstr( "MacroPath" ) + "\\";
closereg;
if( $MacroDir == "\\" ) $MacroDir = hidemarudir + "\\";
$DicFile = $MacroDir + "rtex.dic";
$SEC = "C3-Sup";
#smode = false;
#selmode = false;
InsertRoutine:
call GetMenu;
call PopMenu;
if( ##return == 0 ) endmacro;
call GetCommand $a[##return-1];
disabledraw;
$$comstr = $$return;
if( #smode == true )
{
if( rightstr( $$comstr, 1 ) == "*" )
{
##l = strlen( $$comstr );
$$comout = leftstr( $$comstr, ##l - 1 );
}
else
{
$$comout = $$comstr + "*";
}
}
else
{
$$comout = $$comstr;
}
if( #Type == 1 )
{
insert "\\" + $$comout + " ";
if( code == 0x20 )
{
delete;
}
}
else if( #Type == 0 )
{
insert "\\" + $$comout;
}
else if( #Type == 2 )
{
if( selecting )
{
cut;
call InsertCS $$comout, 1;
paste;
}
else
{
call InsertCS $$comout, 1;
}
}
else if( #Type == 3 )
{
call InsertCS $$comout, 2;
}
else if( #Type == 4 ){ insert "\\" + $$comout + "[]{}{}"; left 5; }
else if( #Type == 5 ){ insert $$comout; }
else if( #Type == 6 )
{
if( selecting )
{
cut;
insert "{\\" + $$comout + " }"; left;
paste;
}
else{ insert "{\\" + $$comout + " }"; left; }
}
else if( #Type == 7 )
{
if( selecting )
{
cut;
insert "{\\" + $$comout + " \\/}"; left 3;
paste;
}
else{ insert "{\\" + $$comout + " \\/}"; left 3; }
}
else if( #Type == 8 )
{
if( selecting )
{
#selmode = true;
cut;
call InsertEnv $$comout, 0;
paste;
down;
}
else
{
#selmode = false;
call InsertEnv $$comout, 0;
}
}
else if( #Type == 22 )
{
if( selecting )
{
#selmode = true;
cut;
##ysv = lineno;
call InsertEnv $$comout, #argc;
paste;
if( #argc == 0 ) down;
else
{
movetolineno 0, ##ysv;
call GoFirstArg #argc;
}
}
else
{
call InsertEnv $$comout, #argc;
}
}
else if( #Type == 23 )
{
if( selecting )
{
cut;
call InsertCS $$comout, #argc;
paste;
}
else
{
call InsertCS $$comout, #argc;
}
}
else if( $$comstr == "$" ){ insert "$$";left; }
else if( $$comstr == "[" ){ insert "\\[ \\]\n"; up; right 3;}
else if( $$comstr == "i" || $$comstr == "M" )
{
$$c = input( "環境名を入力してください。" );
if( selecting )
{
#selmode = true;
cut;
call InsertEnv $$c, 0;
paste;
}
else
{
call InsertEnv $$c, 0;
}
}
else if( $$comstr == "matrix" )
{
insert "\\left";
##xsv = x + 1;
##ysv = lineno;
insertreturn;
insertreturn;
insert "\\right";
insertreturn;
up 2;
tab;
call InsertCS $$comout, 1;
insertreturn;
insertreturn;
movetolineno ##xsv, ##ysv;
}
else if( $$comstr == "ecs" )
{
if( selecting )
{
#selmode = true;
cut;
insert "\\begin{eqnarray}\\begin{cases}\\begin{split}";
insertreturn;
insert "\\end{split}\\end{cases}\\end{eqnarray}";
insertreturn;
up;
paste;
}
else
{
insert "\\begin{eqnarray}\\begin{cases}\\begin{split}";
insertreturn;
insertreturn;
insert "\\end{split}\\end{cases}\\end{eqnarray}";
insertreturn;
up 2;
}
}
else if( $$comstr == "COMMENTOUT" )
{
if( selecting )
{
##sels = seltopy;
##self = selendy;
escape;
if( !#smode )
{
while( ##sels < ##self )
{
moveto 0, ##sels;
insert "%";
if( code != 0x20 && code != 0x25 ) insert " ";
golineend2;
right;
##sels = y;
}
}
else
{
while( ##sels < ##self )
{
moveto 0, ##sels;
while( code == 0x25 ) delete;
while( code == 0x20 ) delete;
golineend2;
right;
##sels = y;
}
}
}
}
enabledraw;
endmacro;
InsertEnv:
insert "\\begin{" + $$1 + "}";
if( ##2 > 0 )
{
##i = ##2;
while( ##i > 0 )
{
insert "{}";
##i = ##i - 1;
}
}
insertreturn;
if( !#selmode ) insertreturn;
insert "\\end{" + $$1 + "}";
insertreturn;
if( code == 0x0D ) deleteline;
if( #selmode )
{
up;
}
else
{
if( ##2 == 0 )
{
up 2;
}
else
{
up 3;
golineend;
##i = ##2 - 1;
left;
while( ##i > 0 )
{
left 2;
##i = ##i - 1;
}
}
}
#selmode = false;
return;
InsertCS:
insert "\\" + $$1;
##i = ##2;
while( ##i > 0 )
{
insert "{}";
##i = ##i - 1;
}
##i = ##2 - 1;
left;
while( ##i > 0 )
{
left 2;
##i = ##i - 1;
}
return;
GoFirstArg:
golineend;
##i = ##1 - 1;
left;
while( ##i > 0 )
{
left 2;
##i = ##i - 1;
}
return;
GetCommand:
##a = strlen( $$1 );
##b = strstr( $$1, ":" );
if( ##b == -1 ) goto Error;
$$c = rightstr( $$1, ##a - ##b - 2 );
##d = strlen( $$c );
##e = strstr( $$c, ":" );
if( ##e == -1 ) goto Error;
else
{
$$t = rightstr( $$c, 1 );
if( $$t == "*" )
{
$$c = leftstr( $$c, ##d - 1 );
$$t = rightstr( $$c, ##d - ##e - 3 );
}
else
{
$$t = rightstr( $$c, ##d - ##e - 2 );
if( #smode == true ) #smode = false;
}
#Type = val( $$t );
}
if( #Type == 0 && $$t != "0" )
{
#Type = ascii($$t) - ascii("A") + 10;
if( #Type == 22 || #Type == 23 )
{
#argc = val( rightstr($$t,1) );
}
}
$$f = leftstr( $$c, ##e );
if( ascii( $$f ) == 38 ) $$f = rightstr( $$f, strlen($$f) - 1 );
return $$f;
GetMenu:
#MenuNum = getininum( $DicFile, $SEC, "num" );
##i = 0;
while( ##i <= #MenuNum )
{
$a[##i] = getinistr( $DicFile, $SEC, str(##i) );
##i = ##i + 1;
}
return;
PopMenu:
menuarray $a, (#MenuNum + 1);
if( iskeydown(0x10) )
{
#smode = true;
}
else
{
#smode = false;
}
return result;
Error:
message "マクロのバグと思われます。m(__)m\n作者に連絡してください。";
endmacro;
|
|