
答案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}
您可能想要編輯該行,並且根據您的字體,您可能必須調整虛擬空間以使該行出現在您想要的位置,但這對我來說非常簡單的文章格式。