Latex 我可以使用titlesec在每一节标题下以线宽划线吗?

Latex 我可以使用titlesec在每一节标题下以线宽划线吗?,latex,Latex,我想在文档中的每个章节标题下划一行,行宽为一行 从我的undrestanding开始,这应该可以使用titlesec,但当我将: \titleformat*{\section}{\titleline*[c]{\titlerule[.8pc]{.}}} \titleformat*{\section}{\titlerule[1pc]{.}} 然而,什么也没有发生。我对语法进行了一些研究,但什么也没发生。而且,我没有收到任何错误消息。我是否忘记了一些(空洞的)论点 代码: 使用可选的after co

我想在文档中的每个章节标题下划一行,行宽为一行

从我的undrestanding开始,这应该可以使用titlesec,但当我将:

\titleformat*{\section}{\titleline*[c]{\titlerule[.8pc]{.}}}
\titleformat*{\section}{\titlerule[1pc]{.}}
然而,什么也没有发生。我对语法进行了一些研究,但什么也没发生。而且,我没有收到任何错误消息。我是否忘记了一些(空洞的)论点

代码:


使用可选的
after code
参数可能是在每个章节标题后添加一行的最简单方法:

\titleformat{⟨command⟩}[⟨shape⟩]{⟨format⟩}{⟨label⟩}{⟨sep⟩}{⟨before-code⟩}[⟨after-code⟩]


你能帮我打个电话吗?是的,对不起,我还没打电话;我有代码,但如何添加代码块?(本编辑器新增)编辑;没有关系,;在手术室
\titleformat{⟨command⟩}[⟨shape⟩]{⟨format⟩}{⟨label⟩}{⟨sep⟩}{⟨before-code⟩}[⟨after-code⟩]
\documentclass{article}
\usepackage[defaultfam,tabular,lining]{montserrat} 
\usepackage[a4paper, left=2cm, right=2cm, bindingoffset=0cm]{geometry}
\usepackage{multicol}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{etoolbox}
\titlespacing*{\section}
{0pt}{2.5mm}{0mm}

\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{}[\titlerule\vspace*{4pt}]


\begin{document}

\begin{multicols}{2}
\section*{First section}
\lipsum[1-2]
\section*{second section}
\lipsum[3-4]
\section*{third}
\lipsum[5-6]

\end{multicols}
\end{document}