如何在新章节后重置段落编号?

如何在新章节后重置段落编号?

我正在写一份学术作业,新问题之后段落需要重新设置。第一个问题之后,段落继续以 D. 计分,但我需要重新从 A. 开始。我该怎么做?

\documentclass[11pt,widefront]{jura} 
\usepackage[ngerman]{babel} 

\usepackage{mathptmx}
\usepackage[T1]{fontenc}

\usepackage{titlesec}
%%\titleformat*{\section}{\normalfont\bfseries}


\usepackage{geometry}
 \geometry{
 a4paper,
 total={210mm,297mm},
 left=60mm,
 right=15mm,
 top=15mm,
 bottom=15mm
 }

%Spacing
\usepackage{setspace}
\makeatletter
\newcommand{\MSonehalfspacing}{%
      \setstretch {1.433}%
  \fi
}
\makeatother

\setlength{\footnotesep}{1pt}

\makeatletter
\newcommand{\showfontsize}{{\f@size pt}}
\makeatother

\setlength{\skip\footins}{1cm}




%Bibliography
%%%%%%%%%
\usepackage{biblatex}
\addbibresource{jurabib.sty}


% Header and Footer Stuff
%%%%%%%
\tolerance=1000
\emergencystretch=20pt





\makeatletter
\renewcommand\@makefntext[1]{%
   \setlength{\hangindent}{2em}
   \noindent
   \hb@xt@\hangindent{%
      \hss\@textsuperscript{\normalfont\@thefnmark}\hspace{.1em}}#1}
\makeatother



 \makeatletter
\renewcommand*{\J@INumberRoot}[2]{% 
  \ifcase#1\or  
  \@Alph{#2}\or  
  \@Roman{#2}\or
 \@arabic{#2}\or  
  \@alph{#2}\or  
  \@alph{#2}\@alph{#2}\or  
  (\@arabic{#2}\or  
  (\@alph{#2}\or 
  (\@alph{#2}\@alph{#2})\or 
   (\@alph{#2})\or  
   (\@alph{#2}\@alph{#2})\or  
   (\@greek{#2})\or  
   (\@greek{#2}\@greek{#2})\fi}
 
 \makeatother 
 


 \begin{document} 
% 
\begin{titlepage} 
\end{titlepage}


\newpage
\frontmatter
 %tableofcontents
\renewcommand{\contentsname}{Table of contents}
\tableofcontents
\setcounter{secnumdepth}{7}
\setcounter{tocdepth}{7}

%literaturverzeichnis
\newpage
\section*{bibliography}
\addcontentsline{toc}{section}{bibliography}


\mainmatter
\pagenumbering{arabic} 
\newpage
\begin{flushleft}

\section*{Question 1}
\addcontentsline{toc}{section}{Question 1}

\toc{Paragraph starts with A.} 

\sub{new paragraph starts with I}

\sub{new paragraph starts with 1}

\sub{new paragraph starts with a)}

\levelup
\levelup
\levelup

\toc{Paragraph starts with B.} 

\sub{new paragraph starts with I}

\sub{new paragraph starts with 1}

\sub{new paragraph starts with a)}

\levelup
\levelup
\levelup
\toc{Paragraph starts with C.} 

\newpage
\section*{Question 2}
\addcontentsline{toc}{section}{Question 2}

\toc{Paragraph starts with D.} %%% Here I need it to start with A. again


\newpage
\section*{Question 3}
\addcontentsline{toc}{section}{Question 3} %%% and here again
\end{flushleft}
\end{document}

答案1

您的 MWE 不够小。我删除了所有不必要的包。这应该可以实现您的要求。

\documentclass[widefront]{jura} 
\usepackage[T1]{fontenc}
\usepackage{etoolbox}
\usepackage{titlesec}
\newcounter{resetheading}
\makeatletter
\@addtoreset{lvla}{resetheading}
\patchcmd{\section}{\ttl@straightclass}{\stepcounter{resetheading}\ttl@straightclass}{}{}
\makeatother
\begin{document} 
\section*{Question 1}
\addcontentsline{toc}{section}{Question 1}
\toc{Paragraph starts with A.} 
\toc{Paragraph starts with B.} 
\section*{Question 2}
\addcontentsline{toc}{section}{Question 2}
\toc{Paragraph starts with A again} 
\end{document}

在此处输入图片描述

相关内容