自訂部分的負責人

自訂部分的負責人

\tsubsection我正在創建一個名為“幾乎 1:1 接管代碼”的新部分,subsection旨在引入一些修改。

在這個例子中

\documentclass{report}
\makeatletter
\newcounter{tsubsection}
%\renewcommand{\thetsubsection}{\@Roman\c@tsubsection}                                                                                                                                                      
\newcommand\tsubsection{\@startsection{tsubsection}{2}{\z@}%                                                                                                                                                
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%                                                                                                                                    
                                     {1.5ex \@plus .2ex}%                                                                                                                                                   
                                     {\normalfont\large\bfseries}}
%\newcommand*\l@tsubsection{\@dottedtocline{2}{3.8em}{3.2em}}                                                                                                                                               
\makeatother
\begin{document}
\tsubsection{Methods}
Some text
\end{document}

輸出是

在此輸入影像描述

頭部多餘的「方法」從何tsubsection而來?

答案1

額外的內容Methods出現是因為您沒有定義\tsubsectionmark,然後命令:

\csname tsubsectionmark\endcsname{Methods}

(它出現在 的定義深處的某個地方\@startsection)變成:

\relax{Methods}

寫入MethodsPDF。

您必須定義\tsubsectionmark新增一些頁面標記(使用\markright\markboth)或簡單地使用參數:

\newcommand\tsubsectionmark[1]{}

在此輸入影像描述

工作代碼:

\documentclass{report}
\usepackage{trace}
\makeatletter
\newcounter{tsubsection}
%\renewcommand{\thetsubsection}{\@Roman\c@tsubsection}
\newcommand\tsubsection{\@startsection{tsubsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\newcommand\tsubsectionmark[1]{}
%\newcommand*\l@tsubsection{\@dottedtocline{2}{3.8em}{3.2em}}
\makeatother
\begin{document}
\tsubsection{Methods}
Some text
\end{document}

相關內容