我怎麼才能用 TikZ 在某個部分中製作這個裝飾?

我怎麼才能用 TikZ 在某個部分中製作這個裝飾?

在此輸入影像描述

是否可以在文章的章節或小節中進行裝飾,如圖所示?

答案1

您可以在標題(節、小節等)之前放置 tikz 行,然後使用帶有負值的 \vspace{} 將其移至標題上方。

\documentclass{article}

\usepackage{tikz} 

\begin{document}


\begin{tikzpicture}[line width=3pt]
    \draw[rounded corners=8pt, pink] (0,0) -- (0.5,0.5) -- (0.7,0.0) -- (1.1,0.6) -- (1.5,-0.1) -- (1.8,0.4) -- (2.4,-0.1) -- (3.0,0.3) -- (3.5,0.0);
\end{tikzpicture}

\vspace{-1.3cm} % to move the line over the section header

\section{First section}

Your text goes here.

\begin{tikzpicture}[line width=3pt]
    \draw[rounded corners=8pt, pink] (0,0) -- (0.5,0.5) -- (0.7,0.0) -- (1.1,0.6) -- (1.5,-0.1) -- (1.8,0.4) -- (2.4,-0.1) -- (3.0,0.3) -- (3.5,0.0);
\end{tikzpicture}

\vspace{-1.2cm} % to move the line over the section header

\subsection{A subsection}

More text.

\end{document}

您可能想要編輯該行,並且根據您的字體,您可能必須調整虛擬空間以使該行出現在您想要的位置,但這對我來說非常簡單的文章格式。 標題行

相關內容