목차와 관련된 질문

목차와 관련된 질문

제가 말했듯이 Gonzalo Medina가 저를 위해 알아낸 내용 을 \mathsection콘텐츠에 사용하고 싶습니다.chapter해당 장에서 \mathsection 사용.

그러나 그의 솔루션을 사용하면 목차가 다음과 같이 잘못되었습니다.

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

내 템플릿의 코드는 다음과 같습니다.

 \documentclass[11pt,a4paper]{amsbook}
 \usepackage{bbold,amscd,amsmath,amssymb,amsfonts,ifthen,amsthm}
 \usepackage[utf8]{vietnam}
 \usepackage{titlesec}
 \usepackage[all]{xypic} 
 \usepackage{kpfonts}`
 %%%%% FOR SEARCHING LABELS AND REFS %%%%%%%%%%%%%%%
 \usepackage{color}
 \usepackage[color,notref,notcite]{showkeys}
 \definecolor{refkey}{rgb}{0,0,0}
 \definecolor{labelkey}{rgb}{0,0,1}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \usepackage{newcent}   
 %\usepackage[unicode]{hyperref}
 \usepackage{cmap}

 %%%%%MARGIN %%%%%%%%%%%%%%%%%%%
 \oddsidemargin 2cm %0.3cm
 \evensidemargin 2cm % 3cm
 \topmargin2cm
 \textwidth12cm %15
 \textheight18.5cm %22
 \headheight3ex
 \headsep5ex
 \topskip3ex
 %% FOR TYPESETTING VIETNAMESE WITH AMSART %%%%%%
 \def\firstofone#1{#1}
 \let\uppercase\firstofone
 \let\MakeUppercase\firstofone
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  

 %STYLE%%%%%%%%%%%
 \def\thepart{\Roman{part}}
 \def\thechapter{\arabic{chapter}}
 \def\thesection{\arabic{section}}
 \def\labelenumi{\roman{enumi})}
 %\numberwithin{thm}{section}
 \numberwithin{equation}{section}
 \titleformat{\chapter}[display]
 {\normalfont\huge\filcenter\scshape}{\chaptertitlename\ \thechapter}{0.2pt}{}
 \titleformat{\section}
 {\normalfont\Large\bfseries}{\S\thesection.}{0.1em}{}

 %THEOREM%%%%%%%%%%%%%%%%
 \theoremstyle{plain}
 \newtheorem{thm}{Theorem}[section]
 \newtheorem{dl}[thm]{Định lý}
 \newtheorem{bd}[thm]{Bổ đề}
 \newtheorem{hq}[thm]{Hệ quả}
 \newtheorem{md}[thm]{Mệnh đề}
 \theoremstyle{definition}
 \newtheorem{nx}[thm]{Nhận xét} 
 \newtheorem{chuy}[thm]{Chú ý}
 \newtheorem{dn}[thm]{Định nghĩa}
 \newtheorem{vidu}[thm]{Ví dụ} 
 \newtheorem{bt}{}[section]
 % miscellaneous 



 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{myheadings}
\begin{document}
\parskip4pt
\renewcommand{\baselinestretch}{1.1}

\frontmatter

\tableofcontents  
\normalsize
\chapter*{Lời nói đầu}
Thử xem thế nào.\\ 
Let's try it.\\
\chapter*{Các ký hiệu}
\markleft{\sc Các ký hiệu}
\markright{\sc Các ký hiệu}
Ta sẽ dùng các ký hiệu sau \\
We will use these following notations.\\
\mainmatter

\pagenumbering{arabic}


\markleft{\hfill \sc Nguyễn Minh Hà}
\chapter{Hướng của đoạn thẳng}

\markright{\sc Hướng của đoạn thẳng\hfill\ }
\section{Hình thang và hình bình hành}
We define the following figure.\\
\section{Đoạn thẳng}
We define the following arc.\\
\backmatter

\begin{thebibliography}{99}
\end{thebibliography}
\end{document}

\mathsection그렇다면 섹션 수, 섹션 이름 및 페이지 수가 포함된 올바른 콘텐츠를 얻으려면 템플릿을 어떻게 수정해야 합니까 ?

답변1

귀하의 문서 클래스는 amsbook표준 클래스 중 하나가 아니므로 사용하지 않는 것이 좋습니다 titlesec. 다음 코드에는 단면 단위에 필요한 재정의가 포함되어 있으며 ToC의 숫자 앞에 기호도 추가됩니다.

\documentclass[11pt,a4paper]{amsbook}
 \usepackage{bbold,amscd,amsmath,amssymb,amsfonts,ifthen,amsthm}
 \usepackage[utf8]{vietnam}
 \usepackage[all]{xypic} 
 \usepackage{kpfonts}
 %%%%% FOR SEARCHING LABELS AND REFS %%%%%%%%%%%%%%%
 \usepackage{color}
 \usepackage[color,notref,notcite]{showkeys}
 \definecolor{refkey}{rgb}{0,0,0}
 \definecolor{labelkey}{rgb}{0,0,1}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \usepackage{newcent}   
 %\usepackage[unicode]{hyperref}
 \usepackage{cmap}

 %%%%%MARGIN %%%%%%%%%%%%%%%%%%%
 \oddsidemargin 2cm %0.3cm
 \evensidemargin 2cm % 3cm
 \topmargin2cm
 \textwidth12cm %15
 \textheight18.5cm %22
 \headheight3ex
 \headsep5ex
 \topskip3ex
 %% FOR TYPESETTING VIETNAMESE WITH AMSART %%%%%%
 \def\firstofone#1{#1}
 \let\uppercase\firstofone
 \let\MakeUppercase\firstofone
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  

 %STYLE%%%%%%%%%%%
 \def\thepart{\Roman{part}}
 \def\thechapter{\arabic{chapter}}
 \def\thesection{\arabic{section}}
 \def\labelenumi{\roman{enumi})}
 %\numberwithin{thm}{section}
 \numberwithin{equation}{section}

 %THEOREM%%%%%%%%%%%%%%%%
 \theoremstyle{plain}
 \newtheorem{thm}{Theorem}[section]
 \newtheorem{dl}[thm]{Định lý}
 \newtheorem{bd}[thm]{Bổ đề}
 \newtheorem{hq}[thm]{Hệ quả}
 \newtheorem{md}[thm]{Mệnh đề}
 \theoremstyle{definition}
 \newtheorem{nx}[thm]{Nhận xét} 
 \newtheorem{chuy}[thm]{Chú ý}
 \newtheorem{dn}[thm]{Định nghĩa}
 \newtheorem{vidu}[thm]{Ví dụ} 
 \newtheorem{bt}{}[section]
 % miscellaneous 

% Chapter and section headings
\makeatletter
\def\@makechapterhead#1{\global\topskip 5.5pc\relax
  \begingroup
  \fontsize{\@xivpt}{18}\bfseries\centering
    \ifnum\c@secnumdepth>\m@ne
      \leavevmode \hskip-\leftskip
      \rlap{\vbox to\z@{\vss
          \centerline{\normalsize\mdseries
              \@xp{\scshape{\chaptername}}\enspace\thechapter}
          \vskip 2pc}}\hskip\leftskip\fi
     \normalfont\scshape#1\par \endgroup
  \skip@34\p@ \advance\skip@-\normalbaselineskip
  \vskip\skip@ }
\def\@makeschapterhead#1{\global\topskip 7.5pc\relax
  \begingroup
  \fontsize{\@xivpt}{18}\normalfont\scshape\centering
  #1\par \endgroup
  \skip@34\p@ \advance\skip@-\normalbaselineskip
  \vskip\skip@ }
\def\@sect#1#2#3#4#5#6[#7]#8{%
  \edef\@toclevel{\ifnum#2=\@m 0\else\number#2\fi}%
  \ifnum #2>\c@secnumdepth \let\@secnumber\@empty
  \else \@xp\let\@xp\@secnumber\csname the#1\endcsname\fi
 \ifnum#2=1 \def\@secnumber{\S\thesection}\fi
 \ifnum #2>\c@secnumdepth
   \let\@svsec\@empty
 \else
    \refstepcounter{#1}%
    \edef\@svsec{\ifnum#2<\@m
       \@ifundefined{#1name}{}{%
         \ignorespaces\csname #1name\endcsname\space}\fi
       \@nx\textup{%
         \csname the#1\endcsname.}\enspace
    }%
  \fi
  \@tempskipa #5\relax
  \ifdim \@tempskipa>\z@ % then this is not a run-in section heading
    \begingroup\ifnum#2=1\relax\noindent\textbf{\S}\fi #6\relax% NEW
    \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty\@M #8\par}%
    \endgroup
  \csname #1mark\endcsname{#7}%
    \ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
  \else
  \def\@svsechd{#6\hskip #3\@svsec
    \@ifnotempty{#8}{\ignorespaces#8\unskip
       ñññ\@addpunct.}%
    \ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
  }%
  \fi
  \global\@nobreaktrue
  \@xsect{#5}}
\def\section{\@startsection{section}{1}%
  \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%
  {\normalfont\bfseries}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{myheadings}
\begin{document}
\parskip4pt
\renewcommand{\baselinestretch}{1.1}

\frontmatter

\tableofcontents  
\normalsize
\chapter*{Lời nói đầu}
Thử xem thế nào.\\ 
Let's try it.\\
\chapter*{Các ký hiệu}
\markleft{\sc Các ký hiệu}
\markright{\sc Các ký hiệu}
Ta sẽ dùng các ký hiệu sau \\
We will use these following notations.\\
\mainmatter

\pagenumbering{arabic}


\markleft{\hfill \sc Nguyễn Minh Hà}
\chapter{Hướng của đoạn thẳng}

\markright{\sc Hướng của đoạn thẳng\hfill\ }
\section{Hình thang và hình bình hành}
We define the following figure.\\
\section{Đoạn thẳng}
We define the following arc.\\
\backmatter

\begin{thebibliography}{99}
\end{thebibliography}
\end{document}
\documentclass[11pt,a4paper]{amsbook}



\begin{document}

\chapter{Test Chapter}
\section{Test Numbered Section}
\section*{Test Unnumbered Section}

\end{document}

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

또한 연결된 질문의 답변을 사용하지 않도록 변경했습니다 titlesec.

마지막 설명: AMS 문서 클래스는 AMS에 제출하도록 설계되었으므로 앞서 본 것처럼 재정의하기 어려울 수 있는 매우 구체적인 설정을 가지고 있습니다.

AMS 클래스 중 하나를 사용해야 하는 것이 아니라면 다른 문서 클래스로 전환하는 것이 좋습니다. 그렇게 하면 좋은 거래가 될 수 있습니다. 이제 기존 패키지(AMS 클래스와 호환되지 않음)를 사용하여 형식 변경을 쉽게 수행할 수 있기 때문입니다. 예를 들어, 최소한의 노력으로 서식(문서와 ToC 모두)을 생성하고 스타일리스트 설정 중 일부를 통합하는 다음 문서를 사용하십시오 amsbook.

\documentclass{book}
\usepackage[compact]{titlesec}
\usepackage[titles]{tocloft}
\usepackage{chngcntr}

\counterwithout{section}{chapter}

\newlength\mylen
\renewcommand\cftchappresnum{\chaptername~}
\renewcommand\cftchapaftersnum{.}
\renewcommand\cftchapfont{\normalfont}
\renewcommand\cftchappagefont{\normalfont}
\settowidth\mylen{\cftchappresnum\cftchapaftersnum} % extra space
\addtolength\cftchapnumwidth{\mylen}
\renewcommand\cftsecdotsep{\cftnodots}
\renewcommand\cftsecpresnum{\S}
\renewcommand\cftsecaftersnum{.}

\titleformat{\chapter}[display]
  {\normalfont\LARGE\scshape\filcenter}{\chaptertitlename\ \thechapter}{15pt}{}
\titleformat{\section}
{\normalfont\Large\bfseries}{\S\thesection.}{0.5em}{}

\begin{document}

\tableofcontents

\frontmatter
\chapter{Test Chapter}
\chapter{Test Chapter}

\mainmatter
\chapter{Test Chapter}
\section{Test Section}
\section{Test Section}
\chapter{Test Chapter}
\section{Test Section}
\section{Test Section}

\end{document}

관련 정보