5

I need special hard spaces for example i need 0.33em, 0.5em, 1em, hair etc. spaces.

Also i need a normal spaces (word spacing) in 0.25em to 0.75em.

How to do it?

Sorry for bad English.

Jablon
  • 553

3 Answers3

8

For getting "hard coded" space between two words, independently on inputs such as

word\hard{2em}word
word \hard{2em}word
word \hard{2em} word

just define

\newcommand{\hard}[1]{\unskip\hspace{#1}\ignorespaces}

Thus spaces input before \hard will be nullified by \unskip, the following ones by \ignorespaces.

In order to change the default interword space in a paragraph, use the primitive \spaceskip:

\newenvironment{myiwspace}[1][0.75em]
  {\spaceskip=#1\relax\ignorespaces}
  {\unskip}

so you can write

This is a part of the paragraph with normal space
\begin{myiwspace}
and this is a part with $0.75$\,em space between words;
\end{myiwspace}
this has normal space,
\begin{myiwspace}[2.5em]
while this part will have $2.5$\,em space between words,
\end{myiwspace}

enter image description here

egreg
  • 1,121,712
6

For really hard (i.e. non-shrinkable, non-stretchable) spaces —something that could upset a bit the justification algorithm if you want to use it as word separator— \hspace{length} is the way to go.

Otherwise, you can use glues to allow some variation : \hskip 1em plus .1em minus .1em.

As far as inter-word spacing is concerned, this is decided by the font ; the low-level \fontdimen parameter 2 specifies the inter-word spacing, the 3 the stretching and the 4 the shrinking.

RD6137
  • 301
2

With \hspace{length} you can specify the length of a horizontal space.

Dohn Joe
  • 1,912
  • I tried that, but something like that: "word \hspace{1em} word" works diffrent like something like that: "word\hspace{1em} word". Im not sure but i think that second example work not properly to and i have 1em+some space from space :) – Jablon Jan 03 '13 at 12:51
  • 3
    omit the spaces between the words and the command. Try this: "word\hspace{2em}word". Otherwise LaTeX typesets after 'word' an ordinary space plus a fixed space plus an ordinary space and then the next word. – Dohn Joe Jan 03 '13 at 13:11
  • Ok its good and cleaver solution. – Jablon Jan 03 '13 at 13:47