1

I have unnumbered sections (\section*) in my document (documentclass article) but I need to have numbered figures, tables and footnotes within sections. Normal solution like \counterwithin{figure}{section} or \@addtoreset{footnote}{section} doesn't work because of unnumbered sections. Can you help me?

    \documentclass[11pt,a5paper,oneside]{article}
    \usepackage[english]{babel}
    \usepackage[utf8]{inputenc}
    \begin{document}

    \section*{section A}
    \addcontentsline{toc}{section}{Section A}
    Lorem ipsum dolor sit amet.\footnote{Ut enim ad minim veniam.}

    \section*{section B}
    \addcontentsline{toc}{section}{Section B}
    Duis aute irure dolor in reprehenderit in voluptate velit.\footnote{Excepteur sint occaecat cupidatat non proident.} Sed ut perspiciatis unde omnis iste natus error. \footnote{Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.}

    \end{document}

I need to number footnotes in section B as footnote 1 and footnote 2, not footnote 2 and footnote 3 as it is now.

3
  • 1
    What do you want the figures to be numbered as in an unnumbered section? Note that figures float, so they may not stay where they're coded. Also, for the sake of the community, could you provide a minimal working example (MWE) that replicates your current setup? That would provide you with solutions faster.
    – Werner
    Sep 2, 2015 at 16:29
  • Basically this means to continously count figures etc, without a preceding section number?
    – user31729
    Sep 2, 2015 at 16:37
  • The document isn't complete. Which \footnote do you refer to? There are none at the moment
    – user31729
    Sep 2, 2015 at 16:54

2 Answers 2

1

You can try \stepcounter{section}\addtocounter{section}{-1}

\documentclass[11pt,a5paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\makeatletter
\@addtoreset{footnote}{section}
\makeatother

\begin{document}

\section*{section A}
\addcontentsline{toc}{section}{Section A}
Lorem ipsum dolor sit amet.\footnote{Ut enim ad minim veniam.}

\section*{section B}
\stepcounter{section}\addtocounter{section}{-1}
\addcontentsline{toc}{section}{Section B}
Duis aute irure dolor in reprehenderit in voluptate velit. \footnote{Excep}
\end{document}
0
0

Reset the footnote counter at every use of \section, whether it's \section or \section*:

enter image description here

\documentclass{article}

\usepackage{xparse}

\let\oldsection\section
\RenewDocumentCommand{\section}{s o m}{%
  \setcounter{footnote}{0}% Reset footnote counter
  \IfBooleanTF{#1}
    {\oldsection*{#3}% \section*[..]{...}
     \addcontentsline{toc}{section}{#3}}
    {\IfNoValueTF{#2}
       {\oldsection{#3}}% \section{...}
       {\oldsection[#2]{#3}}}% \section[..]{...}
}

\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{{%
  \let\section\oldsection
  \oldtableofcontents
}}

\begin{document}

\tableofcontents

\section*{section A}
Lorem ipsum dolor sit amet.\footnote{Ut enim ad minim veniam.}

\section*{section B}
Duis aute irure dolor in reprehenderit in voluptate velit.\footnote{Excepteur sint occaecat cupidatat non proident.} 
Sed ut perspiciatis unde omnis iste natus error.\footnote{Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .