TikZ 是否最适合为 Latex 文档绘制卡通?如果不是,有什么建议说哪种软件可能更好?

TikZ 是否最适合为 Latex 文档绘制卡通?如果不是,有什么建议说哪种软件可能更好?

例如,我希望绘制简单的图形,例如 在此处输入图片描述

或者

在此处输入图片描述

并将它们作为矢量图形包含在 Latex 文档中

TikZ 是最合适的工具吗?也就是说,与其他方法相比,它有多难/耗时。还有哪些方法与 Tikz 相比具有竞争力甚至更可取?

答案1

在 TikZ 中绘制这种类型的图形相当复杂。

例如,考虑一下奇妙的韓國由 Sam Carter 开发的软件包。该软件包包含各种动物的 TikZ 绘图,例如这只猫头鹰:

在此处输入图片描述

该绘图的基本代码是(或多或少经过编辑以删除自定义选项):

% Arms %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@body] (0.575,0.8) ellipse[x radius=0.38, y radius=0.1, rotate=-80];
\owl@part@draw[\owl@body] (-0.575,0.8) ellipse[x radius=0.38, y radius=0.1, rotate=80]; 
%
% Body %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@body] (0.595, 0.92) .. controls (0.595, 0.26) and (0.355, 0.18) .. (0, 0.18) .. controls (-0.355, 0.18) and (-0.595, 0.26) .. (-0.595, 0.92) .. controls (-0.605, 1.58) and (-0.335, 2.11) .. (0, 2.11) .. controls (0.335, 2.11) and (0.605, 1.58) .. (0.595, 0.92) -- cycle;
%
% Ears %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@body] (-0.6361, 1.777) .. controls   (-0.6361, 1.777) and   (-0.7586, 1.9603) ..   (-0.6759, 2.2145) .. controls   (-0.3248, 1.912) and   (0.3248, 1.912) ..   (0.6759, 2.2145) .. controls   (0.7586, 1.9603) and   (0.6361, 1.777) ..   (0.6361, 1.777);
%
% Belly %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@body!50!white] (0.425,0.5) .. controls (0.425,0.31) and (0.245,0.27) .. (0,0.27) .. controls (-0.245,0.27) and (-0.425,0.31) .. (-0.425,0.5) .. controls (-0.425,0.81) and (-0.225,0.98) .. (0,0.98) .. controls (0.225,0.98) and (0.425,0.81) .. (0.425,0.5) -- cycle;
%
% head %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@body] (0,1.55) ellipse[x radius=0.7, y radius=0.55];
%
% Eyes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fill[\owl@eye] (-0.28, 1.6) circle[radius=0.22];
\fill[\owl@eye] (0.28, 1.6) circle[radius=0.22];

\owl@part@draw[\owl@pupil]   (-0.28, 1.6) circle[radius=0.15];
\owl@part@draw[\owl@pupil]   (0.28, 1.6) circle[radius=0.15];
\owl@part@draw[white] (0.25, 1.64) circle[radius=0.03];
\owl@part@draw[white] (-0.31, 1.64) circle[radius=0.03];
%
% Bill %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@bill] (0, 1.4) -- (-0.1, 1.3) -- (0, 1.15) -- (0.1, 1.3) -- cycle;
%
% Feet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\owl@part@draw[\owl@feet] (0.175,0.2) ellipse[x radius=0.03, y radius=0.1];
\owl@part@draw[\owl@feet] (0.225,0.21) ellipse[x radius=0.03, y radius=0.1, rotate=20];
\owl@part@draw[\owl@feet] (0.275,0.23) ellipse[x radius=0.03, y radius=0.1, rotate=40];
\owl@part@draw[\owl@feet] (-0.175,0.2) ellipse[x radius=0.03, y radius=0.1];
\owl@part@draw[\owl@feet] (-0.225,0.21) ellipse[x radius=0.03, y radius=0.1, rotate=-20];
\owl@part@draw[\owl@feet] (-0.275,0.23) ellipse[x radius=0.03, y radius=0.1, rotate=-40];

正如您所看到的,这并不容易做到,请特别注意所有需要设置为适当值的坐标。

对于这种类型的绘图来说,使用具有图形用户界面的矢量图形编辑器进行绘图可能更容易/更有竞争力/更可取(除非你是 Sam Carter 或土拨鼠)。维基百科上有一份列表https://en.wikipedia.org/wiki/Comparison_of_vector_graphics_editors包含许多合适的程序。

相关内容