如何同时运行图像和标签路径?

如何同时运行图像和标签路径?
// https://asymptote.sourceforge.io/gallery/CDlabel.asy
//settings.tex="pdflatex";
size(10cm);
usepackage("graphicx");
import labelpath;
fill(unitcircle^^(scale(0.15)*unitcircle),evenodd+rgb(0.5,1,0.83));
label(minipage(
"\centering\scriptsize 
\textbf{
  \LARGE {\tt Your Title}\\
  \smallskip
  \small The authors}\\
\smallskip
\today\\
",6cm),(0,0.5));
label("Your Texts",(-0.6,0));
label("Your Texts",(0.6,0));
//https://en.wikipedia.org/wiki/LaTeX#/media/File:LaTeX_project_logo_bird.svg
// label(graphic("logo.svg","height=2cm"),(0,-0.5));
labelpath("\textbf{ \large MACROPODS - Their Care, Breeding and the Rearing of Their Young\, by: David McCauley}",
          reverse(arc((0,0),0.88,-80,260)));

在此处输入图片描述

// https://asymptote.sourceforge.io/gallery/CDlabel.asy
settings.tex="pdflatex";
size(10cm);
usepackage("graphicx");
import labelpath;
fill(unitcircle^^(scale(0.15)*unitcircle),evenodd+rgb(0.5,1,0.83));
label(minipage(
"\centering\scriptsize 
\textbf{
  \LARGE {\tt Your Title}\\
  \smallskip
  \small The authors}\\
\smallskip
\today\\
",6cm),(0,0.5));
label("Your Texts",(-0.6,0));
label("Your Texts",(0.6,0));
//https://en.wikipedia.org/wiki/LaTeX#/media/File:LaTeX_project_logo_bird.svg
label(graphic("logo.svg","height=2cm"),(0,-0.5));

在此处输入图片描述

问题:

我如何连接图像和标签路径?

答案1

由于labelpath需要settings.tex="latex";,一种解决方法是在环境中分别生成两个输出asy,然后覆盖它们。因此,您必须运行 pdfLaTeX,然后Asymptote运行两次,然后pdfLaTeX再运行一次。这样,CD 标签的输出就是filename-2.epsfilename-2.eps-converted-to.pdf,其中一个可以包含label(graphic("filename-2.eps"),(0,0));在第一个asy环境中。

该命令clip将当前内容剪辑到 CD 标签区域,从而使两个图形居中。path c=circle((0,0),1); draw(c,white);是一个幻影白色圆圈,以获得方形图像(几乎 100x100)。

注:filename指文件的名称.tex,如filename.tex

输出 (filename.pdf): 在此处输入图片描述

MWE 已使用TeXstudio3.0.0 和TeX Live2020 进行测试(filename.tex):

\documentclass{standalone}
    \usepackage{asymptote}
        \begin{document}
            \begin{asy}
            //https://en.wikipedia.org/wiki/LaTeX#/media/File:LaTeX_project_logo_bird.svg
            settings.tex="pdflatex";
            size(10cm);
            fill(unitcircle^^(scale(0.15)*unitcircle),evenodd+rgb(0.5,1,0.83));
            label(minipage(
            "\centering\scriptsize 
            \textbf{
            \LARGE {\tt Your Title}\\
            \smallskip
            \small The authors}\\
            \smallskip
            \today\\
            ",6cm),(0,0.5));
            label("Your Texts",(-0.6,0));
            label("Your Texts",(0.6,0));
            label(graphic("logo.pdf","height=2cm"),(0,-0.5));
            label(graphic("filename-2.eps"),(0,0));
            clip(unitcircle^^(scale(0.15)*unitcircle),evenodd);
            \end{asy}
            \begin{asy}
            // https://asymptote.sourceforge.io/gallery/CDlabel.asy
            settings.tex="latex";
            size(10cm);
            import labelpath;
            labelpath("\textbf{ \large MACROPODS - Their Care, Breeding and the Rearing of Their Young\, by: David McCauley}",
            reverse(arc((0,0),0.88,-80,260)));
            label(graphic("logo.pdf","height=2cm"),(0,-0.5));
            path c=circle((0,0),1);
            draw(c,white);
            \end{asy}    
\end{document}

相关内容