1

I want to refer to a set of consecutive equations. Following this and this I tried the following -

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref,
cleveref%,hyperref
}
\crefrangelabelformat{equation}{(#3#1#4--#5#2#6)}
\crefname{equation}{Eq.}{Eqs.}
\Crefname{equation}{Equation}{Equations}
\begin{document}
\section{A}
\subsection{B}
\subsubsection{C}
\begin{align}
    x &= y    \label{eq:a}\\
    y &= \sqrt{x-q}\\
    z &= y-20l  \label{eq:b}
\end{align}
\subsubsection{D}
\begin{align}
    B &= D    \label{eq:1}
\end{align}
From \crefrange{eq:a}{eq:b}, we can clearly see\ldots

\Crefrange{eq:a}{eq:b} shows \ldots \end{document}

I got output as "From Eqs. (1–3), we can clearly see. . . Equations (1–3) shows . . . "

Is there any way to get the output as "Equations (1.1.1.1–1.1.2.4) shows"? I just want to add the section number automatically to the referencing.

And why do I get an error if I load hyperref after cleverer?

PoreyS
  • 276
  • 2
  • 10
  • 2
    Regarding the loading order part of your question: https://tex.stackexchange.com/questions/1863/ – Dr. Manuel Kuehner Feb 04 '22 at 02:57
  • I think it is confusing for the readers if the actual equation has a different number than the reference to it [(1) vs. (3.2.1)]. At least this is how I understand your requst. – Dr. Manuel Kuehner Feb 04 '22 at 02:58
  • 1
    And https://tex.stackexchange.com/questions/53191/ – Dr. Manuel Kuehner Feb 04 '22 at 03:04
  • From your write-up, it would appear that you want to (a) show the numbers that are typeset next to the equations as (1) through (4) yet also (b) show these numbers as (1.1.1.1) through (1.1.2.4) when they are generated in a cross-reference to the equations, i.e., you want to use the equations' respective subsection numbers as "prefixes" in a cross-reference. Is this interpretation correct? Please advise. – Mico Feb 04 '22 at 06:54

1 Answers1

3

I use \numberwithin{equation}{subsection} and get:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref,cleveref}

\numberwithin{equation}{subsection} \crefrangelabelformat{equation}{(#3#1#4--#5#2#6)}

\begin{document} \section{A} \subsection{B} \subsubsection{C} \begin{align} x &= y \label{eq:a}\ y &= \sqrt{x-q}\ z &= y-20l \label{eq:b} \end{align} \subsubsection{D} \begin{align} B &= D \label{eq:1} \end{align} From \crefrange{eq:a}{eq:b}, we can clearly see\ldots

\Crefrange{eq:a}{eq:b} shows \ldots

\end{document}

Regarding the package loading order part of your question: Which packages should be loaded after hyperref instead of before? and Impact of hyperref, when varioref and cleveref are used.

  • 1
    @dr-manuel-kuehner Thanks a lot for the code. Thanks for the link also. – PoreyS Feb 04 '22 at 03:51
  • You may want to mention explicitly that while your approach to numbering equations is quite sensible, it does not actually do what the OP requested. (Of course, that leaves open the possibility that the OP's request is not all that sensible.) The OP appears to reqiest that the equation numbers be numbered consecutively throughout the document, but also that the subsubsection numbers should be prefixed to the equation numbers in cross-references. For the sake of truth in advertising, you may want to make this switch more explicit. – Mico Feb 04 '22 at 07:28
  • 1
    @mico You are right. I assume that the OP asked the "wrong" question and I answered the question that I assumed he actually wanted to ask. But it was already late and I wanted to leave the office in order to get some food so I hurried and did not make it as explicit as possible. Since the OP accepted, I assume my interpretation was correct. See also my comment of the question. I appreciate your input! Going to bed now, typing this on my phone. – Dr. Manuel Kuehner Feb 04 '22 at 07:34