考虑以下非 MWE:
\documentclass[
a4paper,
12pt
]{article}
\usepackage[
hmargin = 2cm,
vmargin = 3cm
]{geometry}
\usepackage{pst-eucl}
\usepackage{animate}
\usepackage{siunitx}
\usepackage{xfp}
\def\length{16}
\def\startAngle{15}
\newcommand*\northB{\fpeval{90-\north}}
\newcommand*\lengthB{\fpeval{\length*sind(\northB)}}
\newcommand*\lengthC{\fpeval{\length*sind(\north)}}
\newcommand*\coorx{\fpeval{\lengthB*sind(\northB)}}
\newcommand*\coory{\fpeval{\lengthC*cosd(\north)}}
\newcommand*\numberOfFrames{\fpeval{91-2*\startAngle}}
\def\maxx{0}
\def\maxy{0}
\multido
{\i = \startAngle+1}
{\numberOfFrames}
{\def\north{\i}
\def\maxxA{\fpeval{\length+0.25}}
\def\maxxB{\fpeval{1/4*\length*(sind(2*\north)+cosd(2*\north)+3)-0.35}}
\xdef\maxx{\fpeval{max(\maxx,\maxxA,\maxxB)}}
\def\maxyA{\fpeval{1/2*\lengthC*(sind(\north)+cosd(\north))}}
\def\maxyB{\fpeval{\coory+0.6}}
\xdef\maxy{\fpeval{max(\maxy,\maxyA,\maxyB)}}
}
\newcommand*\sundial[1]{
\def\north{#1}
\psset{
unit = 0.9
}
\sisetup{
round-mode = places,
round-precision = 1
}
\begin{pspicture}(-0.5,-0.15)(\maxx,\maxy)
\pnodes
(0,0){P0}
(\coorx,\coory){P1}
(\length,0){P2}
\pspolygon(P0)(P1)(P2)
\pstMarkAngle{P2}{P0}{P1}{\ang{\north}}
\pstRightAngle[
RightAngleSize = 0.3
]{P0}{P1}{P2}
\pstMarkAngle{P1}{P2}{P0}{\ang{\northB}}
\uput[180](P0){$A$}
\uput[90](P1){$C$}
\uput[0](P2){$B$}
\pstMediatorAB[
PointSymbol = none,
PointNameA = none,
PointNameB = none,
CodeFig = true,
CodeFigColor = black,
RightAngleSize = 0.3
]{P1}{P2}{M}{MN}
\psset{
linestyle = none,
offset = -9pt,
nrot = :U
}
\pcline(P0)(P1)
\ncput*{\qty{\lengthB}{\cm}}
\pcline(P1)(P2)
\ncput*{\qty{\lengthC}{\cm}}
\pcline[
offset = 9pt
](P0)(P2)
\ncput*{\qty{\length}{\cm}}
\end{pspicture}
}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{animateinline}[
poster = first,
controls,
palindrome
]{2}
\multiframe
{\numberOfFrames}
{i = \startAngle+1}
{\sundial{\i}}
\end{animateinline}
\end{figure}
\end{document}
如果我使用latex <file>.tex
--> dvips <file>.dvi
-->进行编译ps2pdf -dALLOWPSTRANSPARENCY <file>.ps
,则一切都会按预期进行。但是,如果我使用 进行编译lualatex <file>.tex
,则会收到错误:
lua:4048: ...2022/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:794: Unkn
own name "tx@Dict"
stack traceback:
[C]: in function 'error'
...2022/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:4178: in function
<...2022/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:4153>
[C]: in function 'vf.node'
...2022/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:4146: in function
<...2022/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:4137>.
<recently read> \@anim@box
l.98 {\sundial{\i}}
我该如何解决?
答案1
在修复之前,这里有一个解决方法:
\begin{animateinline}[
poster = first,
controls,
palindrome
]{2}
\multiframe
{\numberOfFrames}
{i = \startAngle+1}
{\pstheader{pstricks.pro}%
\pstheader{pst-node.pro}%
\pstheader{pst-eucl.pro}%
\sundial{\i}}
\end{animateinline}