此示例取自手册pgf
。它完美地解释了我想要做的事情,但我需要由虚线组成的矩形的边框。
\begin{tikzpicture}
\pgfsetcornersarced{\pgfpoint{5mm}{5mm}}
\pgfpathrectanglecorners{\pgfpointorigin}{\pgfpoint{3cm}{2cm}}
\pgfusepath{stroke}
\end{tikzpicture}
谢谢!
答案1
请阅读下一节\pgfsetdash
:
\documentclass{article}
\usepackage{pgf}
\begin{document}
\begin{pgfpicture}
\pgfsetcornersarced{\pgfpoint{5mm}{5mm}}
\pgfpathrectanglecorners{\pgfpointorigin}{\pgfpoint{3cm}{2cm}}
\pgfsetdash{{3pt}{2pt}}{0pt}
\pgfusepath{stroke}
\end{pgfpicture}
\end{document}
TikZ 中也是一样:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[
rounded corners=5mm,
dash pattern=on 3pt off 2pt,
] (0, 0) rectangle (3, 2);
\end{tikzpicture}
\end{document}