Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a non-breaking space in reStructuredText?

How can I make a non-breaking space in reStructuredText?

An obvious but problematic solution is:

`word A` 

But it might be treated differently by different implementations, such as rst2latex or rst2pdf. Plus it is rendered in italics.

like image 369
Davoud Taghawi-Nejad Avatar asked Aug 06 '12 14:08

Davoud Taghawi-Nejad


People also ask

How do you type a no break space?

How to work with non-breaking spaces. Non-breaking spaces are easy to add. The quickest way is to press Ctrl+Shift+Spacebar (or on a Mac, type Option+Spacebar). Alternatively, you can select 'Non-breaking Space' from the Insert>Special Characters menu.

How do I add a non-breaking space in CSS?

You have seen that with the   ,   , and the   character entities, you can display blank spaces in the browser. This isn't possible just using the spacebar key. You can also use the   character entity in specific places to prevent words that should stay together from breaking into the next line.

How do I add a non-breaking space in WordPress?

&nbsp in WordPress WordPress's Gutenberg editor offers an easy way of inserting non-breaking spaces into articles. Instead of a space, press Option+Space on Mac or Ctrl+Shift+Space on Windows.

How do nonbreaking spaces work?

Your word processor assumes that a word space marks a safe place to flow text onto a new line or page. A nonbreaking space is the same width as a word space, but it prevents the text from flowing to a new line or page. It's like invisible glue between the words on either side.


1 Answers

You need the unicode directive, but it can only be used in substitutions. So you need to define a substitution like this:

.. |nbsp| unicode:: 0xA0     :trim: 

and then use it like this:

xx |nbsp| xx 

:trim: is there to get rid of those spaces around the substitution.

like image 60
ynka Avatar answered Sep 20 '22 07:09

ynka