如何在手冊 97.12 中改為虛線?

如何在手冊 97.12 中改為虛線?

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

相關內容