[Tex/LaTex] How to one produce spaces of arbitrary (fixed or relative) width that (do or don’t) linebreak

lengthsline-breakingspacing

Adobe InDesign lets me insert a wide variety of spaces:

  • over half a dozen spaces that allow for a line break (let's assume for the purpose of this question that they disappear in case of a line break, though the case that they don't is interesting in its own right); their lengths: 1em, 1/2 em, 1/3 em, 1/4 em, 1/6 em, 1/8em, 1/24 em, width of a number, width of ! and . and :
  • a non-breaking space (same flexible width as a space character) [I think this corresponds to ~ in TeX]
  • a non-breaking, fixed-width space [see Fixed-width interword space]

How can I produce such spaces with LaTeX? I am looking for the following spaces:

  • a potentially line-breaking space of a fixed, specified width (e.g. 0.5em)
    • useful for something like "post–World␣War II" ["–" should be an en-dash; note that the hyphen/en-dash distinction doesn't quite render as desired on this forum]
    • Another usage scenario is this: Sometimes I write legends (somewhat similar to footnotes that can align on the same line), with symbols followed by text (SYMBOL text text text text text). Usually each new legend item should be spaced apart from the surrounding ones by a wide and fixed space, but there can alternatively be a line break. The entire text will normally be in a raggedright context. In a scenario with justified text, a flexible space (which would belong into the next large bullet point) would be appropriate.
  • a potentially line-breaking space of variable width, specified in relative terms (e.g. 1.5 times the width of an ordinary space)
    • useful for occasional double sentence spacing in text that is otherwise set with \frenchspacing [I'm not sure about the line-breaking behavior of hacks such as ␣{}␣ in all cases; in any case this would give me only integer multiples of ]
  • a non-breaking space of a fixed, specified width (e.g. 0.5em)
    • necessary for spaces that are used as group separators within numbers
    • useful for something like "post–World War␣II" ["–" should be an en-dash; note that the hyphen/en-dash distinction doesn't quite render as desired on this forum]
    • In the "legend" scenario described under the first large bullet point above, the symbol and the following text should be separated by a fixed, non-breaking space. In a scenario with justified text, a flexible (but still non-breaking) space (which would belong into the next/last large bullet point) might be justified.
    • \kern<width> is used in the definition of \LaTeXe in dtklogos
    • similar to InDesign's "Nonbreaking Space (Fixed Width)"
  • a non-breaking space of variable width, specified in relative terms (e.g. 1.5 times the width of an ordinary space)
    • for use in something like "E.␣T.␣A. Hoffmann", though I haven't given thought to the optimal width here; note that certain German abbreviations like "u.␣Ä." ("und Ähnliches") require a shorter space according to some authorities
    • similar to InDesign's "Nonbreaking Space"
    • a real-number generalization of the sequence ~, ~~, ~~~, … (is that right?)

This question is a wide generalization and a follow-up to "Fixed-width interword space". Also relevant and potentially useful: "Lengths and when to use them".

Some of this is proof of concept, to see what is possible. Knowing whether and how (La)TeX can do the above things that InDesign can do, and more (if this is the case here), is good. Some of the above usage scenarios are quite useful, others are more hypothetical. This question will also serve to document and catalogue the options the user has. Knowing how to code spaces without overuse of \mboxes and modification of general spacing parameters (see my question about fixed-width interword spaces) might come in handy.

Best Answer

Maybe this info helps: Lengths and when to use them. You can use different units of measure in the <skip>, for example: pt, ex, em, in, mm or cm among others. It is also valid to use only the <natural width>, for example \hspace{1in}.