
Gostaria de personalizar a forma como várias referências são tratadas no cleveref
pacote. Gostaria de ter o formulário (eq0, eq1, eq3, eq4)
, ou seja, separado por vírgula,a menos queo conjunto de referências forma um intervalo completo; nesse caso, eu gostaria de um travessão, por exemplo, (eq0--eq3)
em vez de (eq0, eq1, eq2, eq3)
.
Porém, não utilizo o \begin{equation} ... \end{equation}
meio ambiente. Eu uso a seguinte macro: \newcommand{\nt}{\addtocounter{equation}{1}\tag{\theequation}}
e \begin{equation*} ... \nt \end{equation*}
. Se fossem apenas equações, eu poderia simplesmente mudar para a *
versão não-d. No entanto, existem outras razões pelas quais desejo persistir com essa \nt
macro.
Abaixo está um exemplo mínimo de trabalho. (Desculpe por ser muito longo, mas é o mais curto que consegui!)
\documentclass[]{article}
\usepackage{amsmath,cleveref}
\newcommand{\nt}{\refstepcounter{equation}\tag{\theequation}}
\crefformat{equation}{(#2#1#3)}
\crefmultiformat{equation}{(#2#1#3}{, #2#1#3)}{, #2#1#3}{, #2#1#3)}
\crefrangeformat{equation}{(#3#1#4--#5#2#6)}
\begin{document}
\setcounter{equation}{-1}
\begin{equation}\label{0} 0\end{equation}
\begin{equation}\label{1} 1\end{equation}
\begin{equation}\label{2} 2\end{equation}
\begin{equation}\label{3} 3\end{equation}
\begin{equation}\label{4} 4\end{equation}
\begin{equation*}\nt\label{5} 5\end{equation*}
\begin{equation*}\nt\label{6} 6\end{equation*}
\begin{equation*}\nt\label{7} 7\end{equation*}
\begin{equation*}\nt\label{8} 8\end{equation*}
\begin{equation*}\nt\label{9} 9\end{equation*}
\texttt{\textbackslash cref\{0,1,3,4\}}: \cref{0,1,3,4}
%this prints the desired `(0, 1, 3, 4)`
\texttt{\textbackslash cref\{5,6,8,9\}}: \cref{5,6,8,9}
%this prints the undesired `(5--9)`
\end{document}
Parece que cleveref
de alguma forma não sei que este não é um intervalo completo quando utilizo a \nt
macro. Talvez tenha algo a ver com cleveref
olhar para oambiente, em vez decontador?
Editar.
Mico pareceu sugerir usar \refstepcounter
e colocar \nt
antes \label
. Eles não deram mais detalhes, mas mesmo assim fiz as alterações acima.