making a book cover by Asymptote

A way I make a book cover with TikZ is getting 4 coordinates of the cover page (book), then freely drawing inside ABCD with TikZ commands.

Can we do similar for Asymptote, that is, getting 4 coordinates of the cover page and use them in Asymptote code?

For example below, the picture and last TikZ code of the cover page I redraw. I have tried something with Asymptote, but it did not work as expected.

\documentclass{book}
%\usepackage[top=2cm,bottom=2cm,left=2cm,right=1.5cm]{geometry}
\usepackage[inline]{asymptote}
\begin{document}
\begin{asy}
unitsize(1cm);
pair A=(current page.north west);
pair B=(current page.north east);
pair C=(current page.south east);
pair D=(current page.south west);
pair E=(current page.center);

draw(A--C,blue);
draw(B--D,red);
\end{asy}
\end{document}


PS: Well, the reasson I look for Asymptote way is: Even in 2D, Asymptote is somehow better than TikZ, for example, in drawing graph of Implicit function. I want to utilise excellent capability of Asymptote.

\documentclass{book}
%\usepackage[top=2cm,bottom=2cm,left=2cm,right=1.5cm]{geometry}
\usepackage{tikz}
\definecolor{denim}{rgb}{0.08, 0.38, 0.74}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\path
(current page.north west) coordinate (A)
(current page.north east) coordinate (B)
(current page.south east) coordinate (C)
(current page.south west) coordinate (D)
(current page.center) coordinate (E);
% Now you have book cover as the rectangle ABCD
% You are free to draw inside ABCD

\fill[denim] (A) rectangle (C);
\draw[white,line width=1.5mm]
([shift={(6,0)}]A)--([shift={(6,0)}]D)
([shift={(6.25,0)}]A)--([shift={(6.25,0)}]D);

\node[white,scale=1.5,align=left,
font=\bfseries\sffamily] at ([shift={(2.5,-3)}]A)
{Stability\\
and Control:\\
Theory,\\
Method and\\
Applications\\
Volume 15};

\node[white,xscale=5,yscale=5,align=left,
font=\sffamily\bfseries] at ([shift={(2.5,4.5)}]E)
{Almost Periodic\\
Solutions of \\
Differential\\
Equations in\\
Banach Spaces};

\node[white,scale=2,align=left,
font=\sffamily\bfseries] at ([shift={(1,-5)}]E)
{Y. Hino, T. Naito,\\
Nguyen Van Minh\\
and Jong Son Shin};

\end{tikzpicture}
\end{document}

• Just out of curiousity: when you already make a title page with TikZ, why do you want to switch to Asymptote? – user156344 Apr 15 '19 at 9:42
• @ JouleV: Even in 2D, Asymptote is better than TikZ, for example, in drawing graph of Implicit function,... – Black Mild Apr 15 '19 at 9:44
• I did not say that Asymptote is bad. But you can always use TikZ in the title page and Asymptote in the document :)) I think it is not really necessary to use only one graphics tool throughout the document. – user156344 Apr 15 '19 at 9:46
• I agree with @JouleV that you can use asymptote and TikZ in the same document. After all the fonts are all generated with LaTeX and in the cover I do not see any element such as an arrow head which could tell them apart. And I really think that for such simple things as the cover TikZ is simpler to use, but of course I agree that there are things that you can do easily with asymptote but require major efforts with TikZ. – user121799 Apr 15 '19 at 14:50
• If you can save the page coordinates to macros (say, \myAsyCoordA, \myAsyCoordB, etc), then these macros will be visible if you use asypictureB in your asymptote code as @myAsyCoordA, @myAsyCoordB, etc. But in general I think TikZ is a better choice for drawing directly on the page; asymptote uses graphicx internally to import images, so it's mostly suited to drawing independent graphics rather than interacting with TeX elements. – Charles Staats Apr 18 '19 at 14:56

Was convoluted to start and took much trial and error to get a simplified result but here you are.

P.S. needs 2 x pdfLaTeX , 1 x Asy , another 2 x pdfLaTeX.

\documentclass{book}
\usepackage[top=0cm,bottom=0cm,left=0cm,right=0cm]{geometry}
\usepackage[inline]{asymptote}
\usepackage{tikz}
\definecolor{denim}{rgb}{0.08, 0.38, 0.74}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\path
(current page.north west) coordinate (A)
(current page.north east) coordinate (B)
(current page.south east) coordinate (C)
(current page.south west) coordinate (D)
(current page.center) coordinate (E);
% Now you have book cover as the rectangle ABCD
% You are free to draw inside ABCD
\fill[denim] (A) rectangle (C);
\draw[white,line width=1.5mm]
([shift={(6,0)}]A)--([shift={(6,0)}]D)
([shift={(6.25,0)}]A)--([shift={(6.25,0)}]D);

\node[white,scale=1.5,align=left,
font=\bfseries\sffamily] at ([shift={(2.5,-3)}]A)
{Stability\\
and Control:\\
Theory,\\
Method and\\
Applications\\
Volume 15};

\node[white,xscale=5,yscale=5,align=left,
font=\sffamily\bfseries] at ([shift={(2.5,4.5)}]E)
{Almost Periodic\\
Solutions of \\
Differential\\
Equations in\\
Banach Spaces};
\node[white,scale=2,align=left,
font=\sffamily\bfseries] at ([shift={(1,-5)}]E)
{Y. Hino, T. Naito,\\
Nguyen Van Minh\\
and Jong Son Shin};
\end{tikzpicture}
\begin{center}
\begin{asy}[width=\the\linewidth,inline=true]
pair A=(0,1.2);
pair B=(1,1.2);
pair C=(1,0);
pair D=(0,0);
draw(A--C,N,blue,Arrows);
dot(D,red+0.15cm);
label("$BL$",D,1.5N,red);
label("$TR$",B,1.5N,red);
draw(B--D,N,red,Arrows);
\end{asy}
\end{center}
\end{document}

• That's great, KJO! I wonder i am the only one voted so far – Black Mild Apr 18 '19 at 17:46
• Possibly I'm the only one other than you with a download :-) P.S forgot to mention the units are relative and arbitrary as I tested so 10 wide x 12 high should work same as 50 x 60 etc. may be able to squeeze 50 x say 62 but there is a point at which it tips into next page – user170109 Apr 18 '19 at 18:55