I am writing a report which is often using the word "Sierpiński". Since I do not want to write \'n everytime, I made a custom macro:
\newcommand{\sierpinski}{Sierpi\'nski}
The problem occurs with white space (or lack there of) after \sierpinski. There is no white space. This is great when ending a sentence, or using punctuation, but a problem when another words is to follow.
I have made one work around:
\newcommand{\sierpinskiOption}[1]{Sierpi\'nski{#1}}
\newcommand{\sierpinski}{\sierpinskiOption{\ }}
Great! Now whenever I type \sierpinski, I get the correct word with a whitespace, and if I want to add punctuation, I can just specify that using \sierpinskiOptions{?}.
To me, this approach is very blunt. Is there a better approach? Perhaps a snippet of code which will check the next character to see if it is whitespace, or punctuation?
\xspaceat the end of it from the xspace package. – yannisl Mar 25 '24 at 01:43xspace. – barbara beeton Mar 25 '24 at 02:16Sierpiński? Maybe using the autocompletion features of the editor? – egreg Mar 25 '24 at 09:05'. ;-) Nowadays LaTeX on 8-bit TeX-engines by default loads input with utf-8 option and XeTeX/LuaTeX have native support for utf-8-encoded input. So it is possible to typeSierpińskiin your .tex-input-file, no control-sequences needed. – Ulrich Diez Mar 25 '24 at 18:34\sierpinskian optional argument which by default is a space? Then, if you want punctuation, you type, e.g.,\sierpinski[.](, which is weird, in my humble opinion). – Ulrich Diez Mar 25 '24 at 18:52