Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 12 down vote accepted

Three suggestions:

  1. See Why is \[ … \] preferable to $$?

  2. 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.

  3. 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:

enter image description here

\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}
share|improve this answer
    
I'm not sure...But in college I was told that (1) align is better than eqnarray and (2) [ ] is better than $$ $$. –  Rebecca May 20 '12 at 1:12
2  
@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 May 20 '12 at 1:29
1  
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? –  Rebecca May 20 '12 at 5:00
1  
@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 May 20 '12 at 5:13
2  
@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. –  Hendrik Vogt Jun 4 '12 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}

enter image description here

share|improve this answer
    
Perhaps also suggest not to use $$...$$ in a LaTeX document and to use \[...\] instead? –  Gonzalo Medina May 20 '12 at 0:13
    
Awesome and comprehensive answer. Thank you! –  Rebecca May 20 '12 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! –  Rebecca May 20 '12 at 0:14
1  
@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! –  Hendrik Vogt Jun 4 '12 at 11:43
1  
@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! –  Hendrik Vogt Jun 4 '12 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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