1

I really like to have a small space between a number (X) and a % sign, and never the percent sign on a new line. So usually I type X~\%. However, the distance generated this way is to large for me? Is there any way to consistently reduce it? Thank you!

This is my MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}

x~%. %too much horizontal space

x%. % too few horizontal space

\end{document}

Willoughby
  • 3,649
  • 1
    Does one of the commands in the answer here help? – Willoughby Jan 24 '23 at 17:30
  • If I'm understanding the question, one of the commands is probably the right amount of horizontal space, but would still allow the percent sign to jump to the next line. Is there a way to specify that the horizontal space is not allowed to have a linebreak? – Teepeemm Jan 24 '23 at 17:39
  • 1
    You might use \,\%. On the other hand, usually no space is added. – egreg Jan 24 '23 at 17:53
  • 2
    I believe the space inserted by, for example, \, is nonbreaking, see here – Willoughby Jan 24 '23 at 17:54

1 Answers1

2

\,, aka a non-breaking "thinspace", is your friend here.

enter image description here

\documentclass{article}
\begin{document}
\begin{tabular}{ll}
 x\%   & too little? \\
 x\,\% & about right? \\
 x~\%  & too much?
\end{tabular}
\end{document}
Mico
  • 506,678
  • Still a bit big but someone posted a list so I will look it through. However, it is very interesting it has to have a space unlike (i.e., ~% it is , %). – canIchangethis Jan 26 '23 at 07:16