0

I have the following in LaTeX:

v_{i}=\frac{ 1}{ n}\sum_{j=1}^{n}\left(\mu_{ij} \right)^{m}x_{j}\hspace where\hspace n_{i}=\sum_{j=1}^{n}\left(\mu_{ij}\right)^{m}

How can I make a space before and after where?

I tried \hspace, but seems didn't work.

2
  • Try \quad or \qquad
    – azetina
    Commented Dec 3, 2013 at 20:30
  • The \hspace macro takes an argument: \hspace{<length>}. For example: \hspace{.5em} or \hspace{2cm}. Also, you shouldn't use text in math-mode. After loading the amsmath/amstext package, you can use \text{ where }. Commented Dec 3, 2013 at 20:35

2 Answers 2

5

Some standard spacing in math mode include \quad or \qquad but using \hspace{<length>} is possible:

enter image description here

\documentclass[letterpaper]{article}
\usepackage{mleftright}
\usepackage{amsmath}
\begin{document}
\[
v_{i}=\frac{1}{n}\sum_{j=1}^{n}\mleft(\mu_{ij} \mright)^{m}x_{j}\quad \text{where}\hspace{2em} n_{i}=\sum_{j=1}^{n}\mleft(\mu_{ij}\mright)^{m}
\]
\[
v_{i}=\frac{1}{n}\sum_{j=1}^{n}\left(\mu_{ij} \right)^{m}x_{j}\quad \text{where}\hspace{2em} n_{i}=\sum_{j=1}^{n}\left(\mu_{ij}\right)^{m}
\]
\end{document}

The MWE above illustrates the effects of the use of \left and \right. For that, you can consider using the mleftright package by Heiko Oberdiek:

The pack­age de­fines vari­ants \mleft and \mright of \left and \right, that make the de­lim­iters act as \math­open and \math­close. Th­ese com­mands ad­dress spac­ing dif­fi­cul­ties in sub­for­mu­las.

Read Spacing around \left and \right for an interesting discussion about this.

6

Rules of thumb:

  • Never type text in math mode.
  • Never type math in text mode.

Your code can be written in two ways:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ v_{i}=\frac{ 1}{ n}\sum_{j=1}^{n}\left(\mu_{ij} \right)^{m}x_{j} \text{ where } n_{i}=\sum_{j=1}^{n}\left(\mu_{ij}\right)^{m} \]
\end{document}

or

\documentclass{article}
\begin{document}
Inline math looks like $v_{i}=\frac{ 1}{ n}\sum_{j=1}^{n}\left(\mu_{ij} \right)^{m}x_{j}$ where $n_{i}=\sum_{j=1}^{n}\left(\mu_{ij}\right)^{m}$.
\end{document}
6
  • 2
    Of course, \left and \right in that formula are wrong.
    – egreg
    Commented Dec 3, 2013 at 20:33
  • @egreg and the parentheses might be unneeded too. In this case, \left and \right only change the position of the superscript, is that that bad?
    – marczellm
    Commented Dec 3, 2013 at 20:38
  • Yes, the result is poor.
    – egreg
    Commented Dec 3, 2013 at 20:40
  • @marczellm. Thanks for your reply. I'm interested in the first form. I tried it, but still not having the spaces
    – Simplicity
    Commented Dec 3, 2013 at 20:48
  • @Simplicity Note that the spaces are inside the \text{ where }, just next to the {}. If you need more space, do use \quad or even \qquad.
    – marczellm
    Commented Dec 3, 2013 at 20:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .