0

I need \crefrangelabelformat to be without parentheses, so I can type 1‒3 when in an "already between parentheses" context, as in (for this issue, see 1–3 and following examples).

But then, I do not know how to refer to (1–3) using the more common style (1)–(3).

I include just in case all the coding for reference to ranges of subexamples, because I don't want anything to mess with that. See the MWE.

    \documentclass{report}
\usepackage[hidelinks]{hyperref}
\usepackage{etoolbox}
\usepackage{xstring}
\usepackage{philex}
\usepackage{cleveref}

    \AtEndPreamble{     
        \phildashes{}{.}        % Adds a dot between levels 2 and 3 in references. Nothing between levels 1 and 2.
        \subformat{a}{}{.}      % Level 2 is of the form “a.”
        \subsubformat{i}{(}{)}} % Level 3 is of the form “(i)”

% Refer to Subexample Ranges

            \crefname{ExNo}{}{}
            \crefname{SubExNo}{}{}
            \crefname{SubSubExNo}{}{}

            \renewcommand{\theExNo}{\arabic{ExNo}}                      % Level 1 is referred to using arabic numbering.
            \renewcommand{\theSubExNo}{\theExNo\alph{SubExNo}}      % Level 2 is referred to using a small letter.
            \renewcommand{\theSubSubExNo}{\theSubExNo\roman{SubSubExNo}}    % Level 3 is referred to using roman numbering.


            \creflabelformat{ExNo}{#2#1#3}

% The output of the \cref command for the main level doesn't include parentheses. I could write (#2#1#3) but then I wouldn't know how to get an output without parentheses.

            \creflabelformat{SubExNo}{#2#1#3}
            \creflabelformat{SubSubExNo}{#2#1#3}        


            \crefrangelabelformat{ExNo}{#3#1#4–#5#2#6}

% Here too I could write \crefrangelabelformat{ExNo}{(#3#1#4)–(#5#2#6)} but then I wouldn't know how to type 1–3 without parentheses.

            \crefrangelabelformat{SubExNo}{#3#1#4--#5\crefstripprefix{#1}{#2}#6}        

            \newcommand{\mystriptocolon}[2]{\StrCut{#1}{.}{\myonea}{\myoneb}%
            \StrCut{#2}{.}{\mytwoa}{\mytwob}%
            \IfStrEq{\myonea}{\mytwoa}{\mytwob}{#2}}
            \crefrangelabelformat{SubSubExNo}{#3#1#4–#5\mystriptocolon{#1}{#2}#6}

            \newcommand\pref[1]{(\cref{#1})}                    % \pref = (\cref) : it adds parentheses to \cref.
            \newcommand\prefrange[2]{(\crefrange{#1}{#2})}      % \prefrange = (\crefrange) : it adds parentheses to \crefrange.
                                                                % PROBLEM : I want (2)–(6) style, not (2–6).


            \newcommand{\crefrangeconjunction}{–} % Use en dash instead of "to" in ranges.

\begin{document}

\lb{ex1}{\textbf{Structural variation in relation with the source V} \vspace{0.3cm}
    \lba{coalition}{Transitive AS setup \vspace{0.2cm}
        \lba{coalition-n}{la formation d'une coalition par les transfuges\\
            `the formation of a coalition by the defectors'} \vspace{0.2cm}
        \lbz{coalition-v}{Les transfuges formèrent une coalition.\\
            `The defectors formed a coalition.'}}\vspace{0.4cm}
    \lbb{cliff}{Unaccusative AS setup \vspace{0.2cm}
        \lba{cliff-n}{la formation spontanée d'une falaise\\
            `the spontaneous formation of a cliff'} \vspace{0.2cm}
        \lbz{cliff-v}{Une falaise se forma.\\
            `A cliff formed.'}}\vspace{0.4cm}
    \lbz{result}{Non-AS- readings \vspace{0.4cm}
        \lba{simple-event}{\textsl{\textit{Simple event} reading} \vspace{0.2cm}\\
            Nous avons suivi une formation intensive.\\
            `We attended an intensive training course.'} \vspace{0.4cm}
        \lbb{manner}{\textsl{\textit{Manner} reading} \vspace{0.2cm}\\
            On peut comprendre ce mot en observant sa formation.\\
            `One may understand this word by looking at its formation.'}
        \lbz{object}{\textsl{\textit{Object} reading} \vspace{0.2cm}\\
            Le soldat se retrouva face à une formation de chars ennemis.\\
            `The soldier found himself in front of an enemy tank formation.'}}}

\vspace{6pt}    

\lb{ex2}{\textbf{Example 2.}}

\vspace{6pt}    

\lb{ex3}{\textbf{Example 3.}}

\vspace{6pt}    

\noindent As seen in \prefrange{manner}{object} (cf. \crefrange{manner}{object}), ranges work well \textit{with and without parentheses}.

\vspace{6pt}    

\bfseries
However :

I want to get (1)–(3), but I can only get \crefrange{ex1}{ex3} or \prefrange{ex1}{ex3}.


\end{document}

enter image description here

1 Answers1

0

For the moment all I can come up with is :

\newcommand{\prange}[2]{(\cref{#1})--(\cref{#2})}

But it doesn't support page numbers.

In the same spirit, I updated my post here :

https://tex.stackexchange.com/a/637115/262813