答案1
三个不受保护的行尾asymptote.sty
(标有%<---
)。
\documentclass{standalone}
\usepackage{asymptote}
\makeatletter
\def\asy@init{%<---
\def\ASYlatexdir{}%<---
\ifx\asylatexdir\empty\else
\def\ASYlatexdir{\asylatexdir/}%
\fi
\ifx\asydir\empty\else
\def\ASYasydir{\asydir/}%
\fi
\def\ASYprefix{\ASYlatexdir\ASYasydir}%
}
\renewcommand\asy[1][]{%
\stepcounter{asy}%
\setkeys{ASYkeys}{#1}%
\ifASYattach
\ASYinlinefalse
\fi
\asy@init
\immediate\write\AsyPreStream{%
\noexpand\InputIfFileExists{%
\ASYprefix\noexpand\jobname-\the\[email protected]}{}{}%
}%<---
\asy@write@graphic@header
\let\ThisAsymptote\WriteAsyLine
\ProcessAsymptote{asy}%
}
\makeatother
\begin{document}
\begin{asy}
size(10cm,10cm);
draw((0,0)--(100,100));
draw((0,100)--(100,0));
dot((50,50));
\end{asy}
\end{document}
请注意,这\noindent
不是必需的。
如何找到它们?我删除了\noindent
不执行任何操作的standalone
,将其替换为
\tracingcommands=1 \tracingmacros=1
我使用 进行编译pdflatex
,运行asy
并再次编译。.log
文件是搜索的{blank space}
:
\asy@init -> \def \ASYlatexdir {} \ifx \asylatexdir \empty \else \def \ASYlatex
dir {\asylatexdir /}\fi \ifx \asydir \empty \else \def \ASYasydir {\asydir /}\f
i \def \ASYprefix {\ASYlatexdir \ASYasydir }
{blank space }
{\def}
{blank space }
{\def}
{\immediate}
\ASYprefix ->\ASYlatexdir \ASYasydir
\ASYlatexdir ->
\ASYasydir ->
{blank space }
\asy@write@graphic@header ->\immediate \openout \AsyStream =\ASYasydir \jobname
显然,这\asy@init
是负责任的,事实上它的定义是
\def\asy@init{
\def\ASYlatexdir{}
\ifx\asylatexdir\empty\else
\def\ASYlatexdir{\asylatexdir/}%
\fi
\ifx\asydir\empty\else
\def\ASYasydir{\asydir/}%
\fi
\def\ASYprefix{\ASYlatexdir\ASYasydir}%
}
显示缺少两项%
保护。
重新定义命令并重试。该死!仍然有一个空白处!
\ASYasydir ->
{blank space }
\asy@write@graphic@header ->\immediate \openout \AsyStream =\ASYasydir \jobname
\asy@write@graphic@header
在以下位置查找asymptote.sty
:我们在以下定义中找到它\asy
:
\newcommand\asy[1][]{%
\stepcounter{asy}%
\setkeys{ASYkeys}{#1}%
\ifASYattach
\ASYinlinefalse
\fi
\asy@init
\immediate\write\AsyPreStream{%
\noexpand\InputIfFileExists{%
\ASYprefix\noexpand\jobname-\the\[email protected]}{}{}%
}
\asy@write@graphic@header
\let\ThisAsymptote\WriteAsyLine
\ProcessAsymptote{asy}%
}
修复它并再次检查。好极了!没有空格!