我使用 TikZ 制作书籍封面的方法是获取封面(书籍)的 4 个坐标,然后使用 TikZ 命令在 ABCD 内部自由绘图。
我们可以对 Asymptote 做类似的事情吗,即获取封面的 4 个坐标并在 Asymptote 代码中使用它们?
例如下面是我重绘的封面图片和最后的 TikZ 代码。我尝试使用 Asymptote 进行一些操作,但没有达到预期的效果。
\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:我寻找 Asymptote 方法的原因是:即使在 2D 中,Asymptote 也比 TikZ 更好,例如,在绘制隐函数图形方面。我想利用 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}
答案1
开始时很复杂,经过多次反复尝试才得到一个简化的结果,但现在你终于可以得到它了。
PS 需要 2 x pdfLaTeX、1 x Asy、另外 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}