I created a simple macro to type a kind of a range notation (a:b
) with a larger colon do distinguish if from normal text.
This is the macro with a MWE:
\documentclass{minimal}
\usepackage{graphicx}
\newcommand{\range}[3][]{%
\def\rangedbldot{\scalebox{1.4}{:}}%
\if\relax\detokenize{#1}\relax%
\ensuremath{#2\rangedbldot#3}%
\else%
\ensuremath{#2\rangedbldot#1\rangedbldot#3}%
\fi%
}
\begin{document}
\(1{:}2\)
\(\range{1}{2}\)
\(a_{\range{1}{2}}\)
\end{document}
This is the result:
What I would expect is that since I'm using a \scalebox
, not a \resizebox
, the scaled colon would be proportional to the current font size, that in subscripts is a little bit smaller than in normal text. But apparently that's not the case.
What have I got wrong here? And how do I fix the macro to make the colon proportional on both cases?
\scalebox
and\resizebox
are essentially the same thing, just a different syntax for the scale factor what you are scaling in either case is\mbox{$:$}
which does not get smaller in subscriptsminimal
class for tests as it does not set up the fonts fully so you can often get artifacts there that will not be a problem in real classes. It'd avoid scaling and use something like\bm{:}
to get a bold : or if you want to scale useamsmath
then\text{\scalebox{...}}
the\text
macro will take care of setting the size in subscripts