18

Is there a nice way to produce a medium-sized dot to use in a formula like this:

$x_{i\cdot} = \sum_{j} x_{ij}$

The \cdot is not very visible.

  • I'm quite happy with \bullet for such occasions but it's a matter of taste ;) – percusse Nov 7 '12 at 3:00
  • Thanks all. But the \LargerCdot looks the same size in normal and subscript contexts $\LargerCdot$ and $x_\LargerCdot$. Any way to ensure that it is scaled properly when in normal and subscript modes? – user33299 Jul 6 '13 at 8:26
13

One way would be to use \scalebox from the graphicx package. Here is a comparrison of before and after:

enter image description here

Code:

\documentclass{article}
\usepackage{graphicx}

\newcommand*{\LargerCdot}{\raisebox{-0.25ex}{\scalebox{1.2}{$\cdot$}}}

\begin{document}
$x_{i\cdot} = \sum_{j} x_{ij}$


$x_{i\LargerCdot} = \sum_{j} x_{ij}$
\end{document}
12

The following example defines \Cdot to generate a larger dot. It takes an optional argument with a scaling factor. The default is 1.25.

The centered dot remains centered after scaling by moving the dot to the baseline before scaling. The depth that is caused by scaling is removed. Exceeded height is truncated to the height of \bullet.

The width is more difficult. The exact values of the side bearings are unknown. For small scaling factors, the original width might be a good choice. That is implemented in the example below. For larger scaling factors the width might be increased by a smaller scaling factor. At any case, the horizontal and vertical scaling factors of the glyph must be the same, otherwise the glyph looses the circle shape.

The example file:

\documentclass{article}
\usepackage{graphicx}
\usepackage{amstext}

\newcommand*{\Cdot}[1][1.25]{%
  \mathpalette{\CdotAux{#1}}\cdot%
}
\newdimen\CdotAxis
\newcommand*{\CdotAux}[3]{%
  {%
    \settoheight\CdotAxis{$#2\vcenter{}$}%
    \sbox0{%
      \raisebox\CdotAxis{%
        \scalebox{#1}{%
          \raisebox{-\CdotAxis}{%
            $\mathsurround=0pt #2#3$%
          }%
        }%
      }%
    }%
    % Remove depth that arises from scaling.
    \dp0=0pt %
    % Decrease scaled height.
    \sbox2{$#2\bullet$}%
    \ifdim\ht2<\ht0 %
      \ht0=\ht2 %
    \fi
    % Use the same width as the original \cdot.
    \sbox2{$\mathsurround=0pt #2#3$}%
    \hbox to \wd2{\hss\usebox{0}\hss}%
  }%
}

\newcommand*{\test}[1]{%
  \text{%
    \setlength{\fboxsep}{0pt}%
    \setlength{\fboxrule}{.1pt}%
    \fbox{$#1$}%
  }%
}

\begin{document}

$x_{i\cdot} = x_{i\test{\cdot}} = \sum_{j} x_{ij}$

$x_{i\Cdot} = x_{i\test{\Cdot}} = \sum_{j} x_{ij}$

$x_{i\Cdot[1.5]} = x_{i\test{\Cdot[1.5]}} = \sum_{j} x_{ij}$

$x_{i\Cdot[1.75]} = x_{i\test{\Cdot[1.75]}} = \sum_{j} x_{ij}$

$x_{i\Cdot[2]} = x_{i\test{\Cdot[2]}} = \sum_{j} x_{ij}$

\end{document}

Result

  • 1
    Thanks. This looks interesting. Is there something (short) I can read (other that the Texbook) to be able to understand what you did? – passerby51 Nov 7 '12 at 3:33
  • 3
    @passerby51 TeX by Topic for \ht, \dp, \wd; LaTeX manuals for \raisebox and \settoheight; grfguide for \scalebox. – Heiko Oberdiek Nov 7 '12 at 3:38

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.