4
// 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)));

enter image description here

// 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));

enter image description here

Question:

How can I connect image and labelpath ?

  • I suggest to ask about gradient for labelpath in a separate question. – g.kov Sep 02 '20 at 07:02
  • @g.kov You can help !? :-) –  Sep 02 '20 at 16:56
  • Well, there are plenty of people here who could possibly help. But first I'd like to clarify the question. "connect image and labelpath" sounds not clear enough. Do you mean that you want to put an image somewhere along the path, mixing it with the text? Do you expect that the image will appear in its natural rectangle form, or distorted according to the curvature of the path? – g.kov Sep 02 '20 at 17:16
  • @g.kov I wish both commands (label(graphic("logo.svg","height=2cm"),(0,-0.5)); and labelpath("\textbf{ \large MACROPODS - Their Care, Breeding and the Rearing of Their Young\, by: David McCauley}", reverse(arc((0,0),0.88,-80,260)));) can run together. Actually, I have a problem with settings.tex="pdflatex"; and settings.tex="latex";. –  Sep 02 '20 at 17:35
  • Labelpath uses pstricks, so you will need extra effort to use it with pdflatex. See https://tex.stackexchange.com/a/8415/484. – Charles Staats Sep 02 '20 at 19:49
  • @CharlesStaats Sorry, but I am not familiar with PSTricks and I still need an complete answer which I can imitate. –  Sep 03 '20 at 07:26
  • Try using settings.tex = "xelatex";. I don't know if this will work, but it might. Otherwise, convert your logo from svg to eps and use settings.tex = "latex";. – Charles Staats Sep 03 '20 at 13:30
  • @CharlesStaats Maybe, I will have to convert my logo as your suggestion. :-( –  Sep 03 '20 at 13:48
  • @CharlesStaats And settings.tex = "xelatex"; does not work. –  Sep 03 '20 at 13:55

1 Answers1

1

Since labelpath needs settings.tex="latex";, a workaround is to generate both outputs separately in asy environments and then overlay them. Therefore, you have to run pdfLaTeX, then Asymptote twice and then pdfLaTeX again. In this manner, the CD label´s output is filename-2.eps and filename-2.eps-converted-to.pdf, one of which can be include as label(graphic("filename-2.eps"),(0,0)); in the first asy environment.

The command clip clips the current content to the CD label region and thus center the two graphic. path c=circle((0,0),1); draw(c,white); is a phantom white circle to obtain a square image (of almost 100x100).

Note: filename refers to the name of the .tex file, such as filename.tex

Output (filename.pdf): enter image description here

MWE tested with TeXstudio 3.0.0 and TeX Live 2020 (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}
Ñako
  • 3,626