0

How can one space things horizontally, not by a fixed amount but rather than by a percentage of the column width? I want something akin to

$$
A\hspace{20%}B\hspace{20%}C
$$

instead of

$$
A\hspace{1.5in}B\hspace{1.5in}C
$$

(Searched on this and didn't find anything.)

My intended use is MathJax in Google Colab, i.e. web pages that may have variable widths. I suppose in regular LaTeX I could calculate some auxiliary variables, like spacewidth = 0.4*\textwidth and then use \hspace{spacewidth}, but I haven't been able to get MathJax to calculate auxiliary variables.

...I suppose what I'm doing is akin to a one-row table, so perhaps I could use a table instead of \hspace. Same question applies: how to control the width on a percentage basis?

EDIT: For the purposes of reproduction, I created a simple Google Colab notebook to test this out.

closed as off-topic by Phelype Oleinik, Kurt, Circumscribe, Stefan Pinnow, egreg Feb 8 at 18:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Phelype Oleinik, Kurt, Circumscribe, Stefan Pinnow, egreg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \hspace{0.2\columnwidth} – Phelype Oleinik Feb 8 at 15:40
  • @PhelypeOleinik Thanks, but that does not render. MathJax just prints the code as is. $$A\hspace{0.2\columnwidth}B\hspace{0.2\columnwidth}C$$ Also adding "*"'s for the multiplication won't render either. – sh37211 Feb 8 at 15:42
  • Created a Colab notebook for demo: colab.research.google.com/drive/… – sh37211 Feb 8 at 15:44
  • 1
    I fear MathJax is off-topic here. While its syntax looks like TeX, it does not have anything to do with it. – campa Feb 8 at 15:47
  • 2
    Apparently MathJax doesn't know what a \columnwidth is, so it is not possible. From the very little I know of MathJaX, it does not contain a proper “page” which can be used as a reference, so this type of relative measure is not possible. If I put \meaning\columnwidth in that notebook you shared I get it rendered in red, so I guess that it does not exist (neither does \meaning). Either way, it's off-topic for the reason campa said. I suggest you use StackOverflow ;) – Phelype Oleinik Feb 8 at 15:51