一个用来做绘图代码与效果示例的宏包 - tkzexample

发布于 2022-07-28 08:57:26

tkzexample 是一个用于展示示例及其代码的宏包。如果你是 texlive 2022 通过更新即可获取这个宏包。

宏包地址:https://ctan.org/pkg/tkzexample

样例如下:

\documentclass{article}
\usepackage{tikz}
\usepackage[margin=2cm]{geometry}
\usepackage{tkzexample}
\usepackage{xcolor}
\usepackage{calc}
\usepackage{tkz-euclide,tkzexample,pgfornament}
\usetikzlibrary{backgrounds}
\parindent=0pt

\colorlet{graphicbackground}{red!10!white}%
\colorlet{codebackground}{blue!10!white}%
\colorlet{codeonlybackground}{blue!10!white}
%
\begin{document}
\begin{tkzexample}[width=2cm]
\begin{tikzpicture}
\draw [help lines] (0,0) grid (10,4);
\draw (0,0) -- (2,1) [rounded corners]--(2,2) -- (0,2) [sharp corners] -- (0,1)-- (1,1);

\fill [green!80] (4,3) circle [x radius=1cm, y radius=5mm, rotate=30];
\draw [orange, thick] (1,2.5) -- ++(35:2cm);
\draw [red, thick] (3,3) circle (1);
\draw [thick] (5,1) sin (6,2) cos (7,1) sin (8,0) cos (9,1);
\end{tikzpicture}
\end{tkzexample}

\begin{tkzexample}[latex=7cm]
\begin{tikzpicture}[scale=.5]
\tkzInit[xmin=-6,ymin=-4,xmax=6,ymax=6]
\tkzClip
\tkzSetUpLine[thin,color=teal]
\tkzDefPoint(0,0){O}
\tkzDefPoint(132:5){A}
\tkzDefPoint(4,0){B}
\foreach \ang in {5,10,...,360}{%
\tkzDefPoint(\ang:4){M}
\tkzDefLine[mediator](A,M)
\tkzGetPoints{x}{y}
\tkzDrawLine[add= 3 and 3](x,y)}
\end{tikzpicture}
\end{tkzexample}
\end{document}

image.png

0 条评论

发布
问题