I'm writing my first "real" paper in Latex, and one of my major pieces of notation involves item-wise multiplying the Nx1 vector \widehat{w} to the Nx1 vector \widehat{S}, and I've been using cdot to denote the non-matrix multiplication, so basically I am writing

(\widehat{w}\cdot\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\cdot\widehat{S})

a million times in my paper.

I am using cdot to avoid a lot of confusion that would result from just using \widehat{S}_w, or \widehat{w}\widehat{S} due to similar notation already in use in the paper. Basically I am complaining that the cdot adds a ton of space between the w and the S whereas really they are a single unit--a weighted S.

QUESTION: Is there any trick to shrink cdot or is there another bivariate function I could use to get the w and S to stick closer together? Can you help me make my paper prettier?

Thanks for any help.

Code:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$(\widehat{w}\cdot\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\cdot\widehat{S})$
\end{document}


Three suggestions:

1. Define a macro/command if you're using something multiple times. It promotes consistency and would make your life much easier if you decide to change things later on, even just a little bit. For example, \itemmul{<mat1>}{<mat2>}. As reference, see Consistent typography.

2. You can modify the spacing around a relation/operator to your liking by changing it into an ordinal symbol first, and then specifying the kerning using \mkern. Ordinals are obtained by wrapping the relation/operator in braces, like {\cdot} or using \mathord{\cdot}. Math kerning is specified in mus (or math units).

Using the above suggestions, here's a take on your spacing:

\documentclass{article}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\newcommand{\itemmul}[2]{% \itemmul{<mat1>}{<mat2>}
\widehat{#1}\mkern1mu{\cdot}\mkern1mu\widehat{#2}% itemwise-multiplication
}
\begin{document}
$(\itemmul{w}{S})^{\intercal}\widetilde{H}(\itemmul{w}{S})$
\end{document}

• I'm not sure...But in college I was told that (1) align is better than eqnarray and (2) [ ] is better than . Commented May 20, 2012 at 1:12
• @Rebecca: If you're using \newcommand to create a new command that you're using "a million times", I'm sure any journal will accept it. If you don't use a new command, then you run a greater risk of not being consistent, which may be worse when writing a paper.
– Werner
Commented May 20, 2012 at 1:29
• I just checked the author information sections, and of the rather few rules they had, each of the major journals in my field included something along the lines of "Restrict the use of user-defined definitions and newcommands to the minimum." I was under the impression that this was a normal request. Is it not? Commented May 20, 2012 at 5:00
• @Rebecca: Restricting it to a minimum doesn't mean you can't have any. Moreover, if the use of commands promotes consistency, I would imagine the journal would be for it, not against. Is this request normal? Sure, since they (the journal editors) eventually have to take the author document and make it conform to the regular standards, meaning they have to work with the raw code. And, if things are too cluttered with macros and personalized styles, it'll be more difficult to make it conform.
– Werner
Commented May 20, 2012 at 5:13
• @Rebecca: The "restrict to the minimum request" is addressed at authors who start each of their papers with the same preamble containing 3000 \newcommands, of which only 50 are relevant to the present paper. Commented Jun 4, 2012 at 11:33

You can reduce the space in between by using \kern-.2em.

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$(\widehat{w}\!\cdot\!\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\!\cdot\!\widehat{S})$

$(\widehat{w}\kern-.2em\cdot\kern-.2em\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\kern-.2em\cdot\kern-.2em\widehat{S})$
\end{document}


You can define a macro to make things easier.

\newcommand*{\mycdot}{\kern-.2em\cdot\kern-.2em}


The mwe is

\documentclass{article}
\usepackage{amssymb}
\newcommand*{\mycdot}{\kern-.2em\cdot\kern-.2em}
\begin{document}
$(\widehat{w}\!\cdot\!\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\!\cdot\!\widehat{S})$

$(\widehat{w}\kern-.2em\cdot\kern-.2em\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\kern-.2em\cdot\kern-.2em\widehat{S})$

$(\widehat{w}\mycdot\widehat{S})^{\intercal}\widetilde{H}(\widehat{w}\mycdot\widehat{S})$

\end{document}


• Perhaps also suggest not to use $$...$$ in a LaTeX document and to use $...$ instead? Commented May 20, 2012 at 0:13
• Awesome and comprehensive answer. Thank you! Commented May 20, 2012 at 0:13
• I don't actually use  in my doc, that was just for this question...not sure why I did that. Thanks anyway! Commented May 20, 2012 at 0:14
• @Harish: As I have explained in this answer, it's really not a good idea to use \! around \cdot and other binary operators. It would be a lot better to use something like \newcommand*{\mycdot}{\kern.5em{\cdot}\kern.05em}. Can you please edit your answer accordingly? Thanks a lot! Commented Jun 4, 2012 at 11:43
• @Harish: Ah, I should have said that, too: \kern-.2em has all the downside that \! has, so nothing's really won so far. I'm sorry for bothering you! Commented Jun 4, 2012 at 12:17