
這個例子取自第 97.12 節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}