내 목차의 섹션이 중복되는 이유는 무엇입니까?

내 목차의 섹션이 중복되는 이유는 무엇입니까?
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}

\begin{document}

\tableofcontents
\section{Chapter 5}
\subsection{Section 1}

\end{document}

목차를 만들려고 하는데 이렇게 나오네요

여기에 이미지 설명을 입력하세요

윗부분만 표시하고 싶은데 왜 중복되는지 모르겠습니다. 그리고 제목 왼쪽에 있는 숫자는 어떻게 삭제하나요? 그리고 각 섹션과 제목의 페이지 번호는 어떻게 설정하나요?

답변1

무엇보다도 문서 설정에서 지시문을 잘못 사용 \section하고 \subsection각각 "장" 및 "섹션"이라는 레이블이 붙은 헤더를 생성하는 문제가 발생합니다. 필연적으로 뒤따르는 혼란을 줄이기 위해 문서 클래스로 전환하고 서문에서 report명령을 실행 하고 지시문을 사용 하여 해당 헤더를 생성할 수 있습니다.\setcounter{secnumdepth}{-1}\chapter\section

\documentclass{report} % not 'article'
\setcounter{secnumdepth}{-1}

\begin{document}
\tableofcontents

\chapter{Chapter 5}
\section{Section 1}
\end{document}

목차와 첫 번째 헤더 사이에 페이지 나누기를 원하지 않으면 대신 다음 코드를 사용하십시오.

\documentclass{report} % not 'article'
\setcounter{secnumdepth}{-1}

\begin{document}
\tableofcontents

\begingroup
\let\clearpage\relax % locally disable '\clearpage'
\chapter{Chapter 5}
\endgroup
\section{Section 1}
\end{document}

관련 정보