3

Is there a way of specifying the exact space, in some given unit, between two words when the text is fully justified? I normally use \hspace{x cm} when I want to increase/decrease the space relative to the original spacing post-justification by x cm. But how can I specify an exact space such that the spacing between the words does not change, regardless of what justification does to the base spacing?

1
  • 2
    Did you try to put the words into an hbox? Connect them with your hspace command without spaces. Just an idea - no latex available at the moment...
    – AndiW
    Jul 17, 2020 at 22:42

2 Answers 2

7

The \hbox or \mbox solution is good. Another possibility is to eliminate existing space

\newcommand\sep[1]{%
  \leavevmode\unskip\unskip 
  \nobreak % optional
  \hspace{#1}\ignorespaces
}

specifying the exact \sep{4mm} space, in some given unit

This eliminates white space from \hspace commands or space characters before the measured gap, but ignores only space characters (or line-ends) afterwards. The \nobreak is on the assumption that you don't want a line break there. The \leavevmode makes sure you aren't berween paragraphs, preventing the \unskip commands from eliminating \vspace glue. Two \unskips allow for \hspace plus a space character preceding the gap.

2
  • Nice to see a compliment like "The solution is good"... thx ;-)
    – AndiW
    Jul 17, 2020 at 23:39
  • This is exactly what I was looking for! Thank you!
    – niran90
    Jul 18, 2020 at 11:14
5

You could try something like

I love \mbox{big\hspace{2em}green} apples more than the small red ones.

Note: Usually it is not a good idea to fiddle with interword spacing... :-(

2
  • @egreg answer updated - you're right... :-)
    – AndiW
    Jul 18, 2020 at 7:37
  • Yes, I'd upvote it again if I could. Jul 18, 2020 at 8:17

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.