nb_spaces_tex

Function nb_spaces_tex 

Source
pub fn nb_spaces_tex<'a, S: Into<Cow<'a, str>>>(input: S) -> Cow<'a, str>
Expand description

Escape non breaking spaces for LaTeX, replacing them with the appropriate TeX code. This ensures it works correctly with some LaTeX versions (and it makes the non-breaking spaces shenanigans more visible with most editors)

§Achtung

Since this function adds some LaTeX codes that use backslashes, it will cause issues if you then try to escape those characters. So if you must escape the text for LaTeX, this function should always be called after escape::tex.

§Example

use crowbook_text_processing::escape;
let s = escape::nb_spaces_tex("Des espaces insécables ? Ça alors !");
assert_eq!(&s, "Des espaces insécables\\,? Ça alors\\,!");