Quero contar section
a cada nova palestra. Eu aprendo que \counterwithin
posso fazer esse trabalho. Ele compila com sucesso, mas não funciona no momento.
\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\renewcommand{\thesection}{\thelecnum.\arabic{section}}
\renewcommand{\theequation}{\thelecnum.\arabic{equation}}
\renewcommand{\thefigure}{\thelecnum.\arabic{figure}}
\renewcommand{\thetable}{\thelecnum.\arabic{table}}
\newcommand{\lecture}[4]{
\pagestyle{myheadings}
\thispagestyle{plain}
\newpage
\setcounter{lecnum}{#1}
\setcounter{page}{1}
\noindent
\begin{center}
\framebox{
\vbox{\vspace{2mm}
\hbox to 6.28in { {\bf ECCV2020
\hfill August 2020} }
\vspace{4mm}
\hbox to 6.28in { {\Large \hfill Lecture #1: #2 \hfill} }
\vspace{2mm}
\hbox to 6.28in { {\it Lecturer: #3 \hfill Scribes: #4} }
\vspace{2mm}}
}
\end{center}
\markboth{Lecture #1: #2}{Lecture #1: #2}
}
\counterwithin*{section}{lecnum}
Obrigado
Responder1
Você precisa \stepcounter
redefinir os contadores associados.
\documentclass{article}
\usepackage[a4paper,textwidth=7in]{geometry}
\geometry{textheight=6cm}% just to make a smaller picture
\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\counterwithin{section}{lecnum}
\counterwithin{equation}{lecnum}
\counterwithin{figure}{lecnum}
\counterwithin{table}{lecnum}
\pagestyle{myheadings}
\newcommand{\lecture}[4]{%
\clearpage
\thispagestyle{plain}
\stepcounter{lecnum}% resets every associated counter
\setcounter{lecnum}{#1}%
\setcounter{page}{1}
\begin{center}
\framebox{%
\parbox[t]{6.28in}{%
\vspace{2mm}
{\bfseries ECCV2020\hfill August 2020\par}
\vspace{2mm}
{\Large\hspace*{\fill}Lecture #1: #2\hspace*{\fill}\par}
\vspace{4mm}
{\itshape Lecturer: #3\hfill Scribes: #4\par}
\vspace{2mm}
}%
}
\end{center}
\markboth{Lecture #1: #2}{Lecture #1: #2}
}
\begin{document}
\lecture{1}{Boxes}{egreg}{Rabbittac}
This is the first lecture.
\section{First}
First section with an equation
\begin{equation}
a=b
\end{equation}
\lecture{3}{Counters}{egreg}{Rabbittac}
This is the third lecture.
\section{First}
First section with an equation
\begin{equation}
a=b
\end{equation}
\end{document}
Refatorei o código da caixa para usar comandos LaTeX, em vez de comandos simples. Os comandos \bf
e \it
similares estão obsoletos há cerca de 25 anos.