TransWikia.com

Referencing a range of equations with a particular format (A.3-7) instead of (A.3)-(A.7)

TeX - LaTeX Asked by Well... on June 16, 2021

How can I reference a range of equations in the form I want? For example, I want to reference a range of equations starting with Eq. (A.3) and ending with Eq. (A.7), what is a simple way to get the reference to display as Eq. (A.3-7)? I know how to get (A.3-A.7) but I don’t love the way it looks.

ETA working example:

begin{align}
a &= b  label{eq:beg} 
b &= c  
c &= d  
d &= e  
e &= f  label{eq:end}
end{align}

You can see from Eq.~(ref{eq:beg}-(ref{eq:end}) that $a = f$

This displays

You can see from Eq. (A.3-A.7) that a=f

but I want it to display

You can see from Eq. (A.3-7) that a=f

One Answer

Your formatting objective may be achieved in a straightforward manner by employing some of the machinery of the cleveref package.

enter image description here

documentclass{article}
usepackage[noabbrev]{cleveref}
crefrangelabelformat{equation}% see p. 20 of package's user guide
    {(#3#1#4--#5crefstripprefix{#1}{#2}#6)}


begin{document}
noindent
crefrange{eq:c}{eq:g}, 
labelcref{eq:c,eq:g,eq:e,eq:d,eq:f} % input arguments needn't be sorted

appendix
counterwithin{equation}{section}
section{Supplemental material}
begin{equation} a label{eq:a} end{equation}
begin{equation} b label{eq:b} end{equation}
begin{equation} c label{eq:c} end{equation}
begin{equation} d label{eq:d} end{equation}
begin{equation} e label{eq:e} end{equation}
begin{equation} f label{eq:f} end{equation}
begin{equation} g label{eq:g} end{equation}
end{document} 

Correct answer by Mico on June 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP