3

The code below generates correct output. However, I would like to know how I can temporarily replace every instance of 'and' with 'or' just for specific instances of \cref usage. I included xcolor and hyperref on purpose because I want the solution to be compatible with hyper links.

 \documentclass[reqno]{amsart}


\usepackage[x11names]{xcolor}

\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}

\usepackage[nameinlink]{cleveref}



\crefformat{equation}{Eq. #2(#1)#3}
\crefrangeformat{equation}{Eqs. #3(#1)#4 to #5(#2)#6}
\crefmultiformat{equation}{Eqs. #2(#1)#3}{ and #2(#1)#3}{, #2(#1)#3}{ and #2(#1)#3}
\crefrangemultiformat{equation}{Eqs. #3(#1)#4 to #5(#2)#6}{ and #3(#1)#4 to #5(#2)#6}{, #3(#1)#4 to #5(#2)#6}{ and #3(#1)#4 to #5(#2)#6}

\begin{document}


    \begin{align}
        e &= m c^{2}
        \label{eq1}
        \\
        r &= \sqrt{a^{2} + b^{2}}
        \label{eq2}
        \\
        R_{eq} &= \left( \frac{1}{R_{1}} + \frac{1}{R_{2}} \right)^{-1}
        \label{eq3}
        \\
        V &= R I
        \label{eq4}
        \\
        S &= V I^{*}
        \label{eq5}
        \\
        P &= V I \cos(\theta)
        \label{eq6}
        \\
        Q &= V I \cos(\theta)
        \label{eq7}
    \end{align}

    \cref{eq1,eq3}

    \cref{eq1,eq2,eq3,eq6,eq7}

\end{document}
3

Make the conjunction depending on a macro:

\documentclass[reqno]{amsart}

\usepackage[x11names]{xcolor}

\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}

\usepackage[nameinlink]{cleveref}

\crefformat{equation}{Eq. #2(#1)#3}
\crefrangeformat{equation}{Eqs. #3(#1)#4 to #5(#2)#6}
\crefmultiformat{equation}
  {Eqs. #2(#1)#3}
  { \andor\  #2(#1)#3}
  {, #2(#1)#3}
  { \andor\ #2(#1)#3}
\crefrangemultiformat{equation}
  {Eqs. #3(#1)#4 to #5(#2)#6}
  { and #3(#1)#4 to #5(#2)#6}
  {, #3(#1)#4 to #5(#2)#6}
  { and #3(#1)#4 to #5(#2)#6}
\newcommand{\andor}{and}
\newcommand{\crefor}[1]{\begingroup\renewcommand{\andor}{or}\cref{#1}\endgroup}

\begin{document}


\begin{align}
e &= m c^{2}
\label{eq1}
\\
r &= \sqrt{a^{2} + b^{2}}
\label{eq2}
\\
R_{eq} &= \left( \frac{1}{R_{1}} + \frac{1}{R_{2}} \right)^{-1}
\label{eq3}
\\
V &= R I
\label{eq4}
\\
S &= V I^{*}
\label{eq5}
\\
P &= V I \cos(\theta)
\label{eq6}
\\
Q &= V I \cos(\theta)
\label{eq7}
\end{align}

\cref{eq1,eq3}

\cref{eq1,eq2,eq3,eq6,eq7}

\crefor{eq1,eq2,eq3,eq6,eq7}

\end{document}

enter image description here

0

I'm not an expert, but what about using the \Cref functionality to define something different? For example:

\documentclass[reqno]{amsart}


\usepackage[x11names]{xcolor}

\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}

\usepackage[nameinlink]{cleveref}



\crefformat{equation}{Eq. #2(#1)#3}
\crefrangeformat{equation}{Eqs. #3(#1)#4 to #5(#2)#6}
\crefmultiformat{equation}{Eqs. #2(#1)#3}{ and #2(#1)#3}{, #2(#1)#3}{ and #2(#1)#3}
\crefmultiformat{equation}{Eqs. #2(#1)#3}{ and #2(#1)#3}{, #2(#1)#3}{ and #2(#1)#3}
\Crefmultiformat{equation}{Eqs. #2(#1)#3}{ and #2(#1)#3}{, #2(#1)#3}{ or #2(#1)#3}
\crefrangemultiformat{equation}{Eqs. #3(#1)#4 to #5(#2)#6}{ and #3(#1)#4 to #5(#2)#6}{, #3(#1)#4 to #5(#2)#6}{ and #3(#1)#4 to #5(#2)#6}

\begin{document}


    \begin{align}
    e &= m c^{2}
    \label{eq1}
    \\
    r &= \sqrt{a^{2} + b^{2}}
    \label{eq2}
    \\
    R_{eq} &= \left( \frac{1}{R_{1}} + \frac{1}{R_{2}} \right)^{-1}
    \label{eq3}
    \\
    V &= R I
    \label{eq4}
    \\
    S &= V I^{*}
    \label{eq5}
    \\
    P &= V I \cos(\theta)
    \label{eq6}
    \\
    Q &= V I \cos(\theta)
    \label{eq7}
    \end{align}

    \cref{eq1,eq3}

    \cref{eq1,eq2,eq3,eq6,eq7}

    \Cref{eq1,eq2,eq3,eq6,eq7}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.