如何同時運行影像和標籤路徑?

如何同時運行影像和標籤路徑?
// 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}

相關內容