複製並修改部分層次結構

複製並修改部分層次結構

在正在準備的大型論文風格文件中,某些部分(乳膠層次結構 \part{})被視為先前準備工作的插入。這可能包括更適合使用部分(跳過章節)在部分內進行層次劃分的文章或摘要。這主要是為了避免「第十章」有完全不同的章節格式。

我想複製(可能是 newcommand)並隨後重新定義節命令以僅包含節號,以便我可以調用名為 \papersection{} 的乳膠命令,該命令不包含章節前綴 ex。 ( 1. 簡介 )

為了完整起見,如果可能的話,我希望能夠分享 \papersection*{} 等效項的格式和層次結構。

\documentclass{report}
%\usepackage{chngcntr}
%\counterwithin{figure}{section}
\begin{document}
\part{(First Part)}
\section{Intro}
     Since this part is for a research paper - the article class would be more appropriate but the report class has been used for the rest of the document as numbering hierarchy such as 1.1 is desired.

     Would rather be using \papersection{Intro} so that all my sections do not include the repetitive and unnecessary 1.x

\end{document}

或者(這將是我的首選方法),是否可以發出 \begin{x} ... \end{x} 環境命令來暫時重新定義正在使用的 \documentclass 模板?在這種情況下,它必須與嵌套環境相容,例如 bibunits、表格、圖形、方程式等。

\documentclass{report}
\begin{document}
\part{(First Part)}
\begin{PaperEnvironment}% open up an environment that refers to the article class

\section{Intro}
    Can I change documentclass templates mid stream?  If so, I don't have to redefine section anymore...

\end{PaperEnvironment}
\end{document}

該文件正在使用基於報告範本的自訂 cls 檔案來準備。我現在無法切換到回憶錄、書籍、腳本報告等。

答案1

不可能在單一文檔中使用多個文檔類,除非單獨編譯子文檔並將編譯後的文件包含在諸如pdfpages.如果這不是一個選項,您可以定義一個新環境 -paper比如說 - 在環境開始時排版部分時刪除章節號,並在最後恢復它。這比複製整個\section命令更簡單,因為我們只需更改\thesection.

我不確定您對加星號的切片命令的含義,因為它們無論如何都沒有數字。

\documentclass{report}
\usepackage{kantlipsum}
\makeatletter
\newenvironment{paper}{%
  \global\let\oldthesection\thesection
  \renewcommand{\thesection}{\@arabic\c@section}%
}{%
  \global\let\thesection\oldthesection}
\makeatother
\begin{document}
\chapter{Chapter First}
\kant[1]
\section{Kant}
\kant[2]
\section{Kant Again}
\kant[3]
\chapter{Chapter Second}
\kant[4]
\part{(First Part)}
\begin{paper}
\section{Intro}
     Since this part is for a research paper - the article class would be more appropriate but the report class has been used for the rest of the document as numbering hierarchy such as 1.1 is desired.

     Would rather be using \section{Intro} so that all my sections do not include the repetitive and unnecessary 1.x
\end{paper}
\part{Second Part}
\chapter{More Kant}
\kant[5]
\section{Kant Keeps Going}
\kant[6]
\end{document}

變體部分格式

相關內容