\section*{}을 사용하지 않고 tocloft에서 섹션 번호 매기기를 제거합니다.

\section*{}을 사용하지 않고 tocloft에서 섹션 번호 매기기를 제거합니다.

tocloft에서 섹션 번호 매기기를 제거하려고 하는데 일부 항목에서만 해당됩니다. 내가 원하는 방식의 예: 내가 원하는 방식의 예 .

지금 제거하는 방법은 다음과 같습니다.

\section*{Discussion} \label{discussion}
\addcontentsline{toc}{section}{\nameref{discussion}}

하지만 이 방법을 사용하면 PDF 탐색 메뉴에 링크가 포함되지 않으며 제 생각에는 지저분한 솔루션입니다.

다음을 시도했지만 도서 섹션에만 적용됩니다(저는 기사를 사용합니다).

\makeatletter
\renewcommand{\cftsecpresnum}{\begin{lrbox}{\@tempboxa}}
\renewcommand{\cftsecaftersnum}{\end{lrbox}}
\makeatother

다음을 사용하여 논문 자체에서 섹션 번호 매기기를 억제할 수 있습니다: ''' \renewcommand{\prefix@section}{ } '''

요약하자면 아래 예에서 8, 9, 10을 제거하고 싶습니다.

이것을 제거하십시오

일반 사용 중:

\section{Discussion} \label{discussion}

내가 알아낼 수 없기 때문에 누구든지 도움을 줄 수 있기를 바랍니다. 정말 간단한 일인 것 같습니다. 더 많은 정보를 제공해야 한다면 기꺼이 그렇게 하겠습니다. 미리 감사드립니다!

작업 코드:

\documentclass[10pt]{article}

\usepackage{nameref}

%% # TOC CONFIG #
\usepackage[titles]{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand*\contentsname{Table of contents}
\setcounter{tocdepth}{3}


\begin{document}
    \setcounter{secnumdepth}{5}  
    \setcounter{tocdepth}{5}    
    \tableofcontents
    \newpage

    \let\oldthesection=\thesection
    \renewcommand{\thesection}{}

    % Without before
    \renewcommand{\thesection}{}
    \section{section one no nr before} \label{1nonr}


    % Normal sections
    \let\thesection=\oldthesection
    \setcounter{section}{0}
    \section{section one}

    \section{section two}
    \subsection{subsection one}

    \section{section three}
    \subsection{subsection one}
    \subsection{subsection two}

    % Without after
    \renewcommand{\thesection}{}
    \renewcommand{\thesubsection}{}
    \section{section one no nr} \label{1nonr}

    \section{section two no nr} \label{2nonr}
    \subsection{subsection one} \label{2snonr}
\end{document}

그림: 현재 작동 방식을 보여주는 그림

관련 정보