0

This question already has an answer here:

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.

marked as duplicate by LSpice, egreg cross-referencing Jun 17 '15 at 19:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I answered something similar to the bonus question, not numbering subsections if only one for a question here a while back, have a feeling it was a Brazilian legal rather than French, example;-) I wonder if I can find it... – David Carlisle Jun 17 '15 at 14:07
  • It can surely be done, but I find such a style very pedantic and inefficient. Also ambiguous in the “lonely proposition” case. – egreg Jun 17 '15 at 14:35
  • @DavidCarlisle, thanks, and I'll be interested to see it, but I'm more interested in the variable referencing. – LSpice Jun 17 '15 at 14:36
  • @egreg, nonetheless some people like to do it, so I was sure there'd be a package out there. I'm not sure how the lonely proposition is ambiguous (in this style, all numbered results occur at the deepest level of nesting, so there is no confusing the lone proposition of Subsection 9.6 with the 6th proposition of Section 9), but anyway it's the variable referencing that really interests me; and surely one can imagine other uses for that if this one is irksome? – LSpice Jun 17 '15 at 14:38
  • 1
    @LSpice ohh well found:-) – David Carlisle Jun 17 '15 at 20:59