I recently saw an MO post https://mathoverflow.net/a/209494/2383 which claimed that LaTeX does not support French-style numbering, where references to (3.7.6) appear as (6) inside Subsection 3.7, as (7.6) inside Section 3, and as (3.7.6) all other places. Of course, the default reaction to such a claim is "yes it does; you just have to use package …", but I don't know what package to fill in. To be clear, what I am looking for is, as near as possible, how to make the following a working document:
\documentclass{article}
\usepackage{???} % What to use?
\begin{document}
\begin{section}
\eqref{eq:eq} % => (2.1.1)
\begin{section}
\eqref{eq:eq} % => (1.1)
\begin{subsection}
\begin{equation}\label{eq:eq}
2 = 1 + 1.
\end{equation}
All that wait for \eqref{eq:eq}? % => (1)
\end{document}
I'm illustrating this with equations, but I'd like it to work for all numbered environments. Bonus points if the answer can really fit the French style, where, for example, the propositions in Subsection 9.6 are numbered only if there is more than one, and otherwise references to the lone proposition in that subsection will be numbered "Proposition 9.6". (Despite my calling this 'French' style, the first example that comes to mind is Borel's "Linear algebraic groups" https://books.google.com/books?id=MoLTBwAAQBAJ&printsec=frontcover .)
Apologies in advance if this is a duplicate; I can't believe that it's not, but I couldn't find it. I searched here for "French numbering" and "local numbering", but the former just seemed to turn up accidental coincidences of 'French' and 'numbering' in the same post, and the latter to turn up posts about changing the label format for one particular result, but still having all references to it format the same way.