[Tex/LaTex] \ifdim command with multiple conditions

conditionalspgfplotstex-coretikz-pgf

It's my first time asking here for help so please don't roast me.
I'm writing some macros to autodetect and mark peaks in a diagram (in tikz/pgfplots) using \ifdim. The problem is, I have two conditions to incorporate with this: peak is >615pt and <650pt but I can't get it to work. Below is the code I'm currently using and it works fine for marking peaks above one threshold (in this case 615pt). (the code is more or less copied from here Original Code)

\pgfplotsset{
/tikz/max node/.style={mark=none},
mark max/.style={
    point meta rel=per plot,
    visualization depends on={x \as \xvalue},
    scatter/@pre marker code/.code={
        \ifdim\pgfplotspointmetatransformed pt>615pt           
           \def\markopts{mark=none}
            \node[coordinate ,pin = {[rotate=-45]left,inner sep=3pt:{\pgfmathprintnumber[fixed,precision=2,zerofill=true]{\xvalue}}}] at (0,1) {};
        \else
            \def\markopts{mark=none}
        \fi
        \expandafter\scope\expandafter[\markopts]
    },
    scatter/@post marker code/.code={%
        \endscope
    },
    scatter
}}

Is it even possible to use \ifdim for multiple conditions? I would love having something like: \ifdim\pgfplotspointmetatransformed pt>615pt AND \ifdim\pgfplotspointmetatransformed pt<650pt

Best Answer

As Steven said, you can use

  \ifdim\mydim>615pt\relax
    \ifdim\mydim<650pt\relax
      in range%
    \else
      above 650%
    \fi
  \else
    below 615%
  \fi

If the code for the two out of range cases is the same and you don't want to duplicate it then you can structure it as

\ifdim\ifdim\mydim>615pt\mydim\else\maxdimen\fi<650pt\relax
  in range%
\else
  out of range%
\fi
Related Question