0

I have a text inside mathmode in latex and I would like the text to be separated from the equation with some spaces. How can I do this? Example code below

\begin{gather*}
A^2 = B^2 + C^2  \text{[Pythagaros theorem]}
\end{gather*}
  • Insert \hspace{<len>} between the two elements, where <len> is something like 2cm. – Werner Apr 22 '21 at 16:51
  • You also have \quad or \qquad. Whatever suits you. – SebGlav Apr 22 '21 at 16:53
  • @Werner I would probably suggest learning users to use \quad and \qquad to keep these spaces unified. Learning them to use \hspace is just opening up a can of worms – daleif Apr 22 '21 at 16:54
  • @Werner I have done this but this changes the alignment of my equation. – GitGoodCodes Apr 22 '21 at 16:59
  • @GitGoodCodes: So you want the equation to be centered within the text block, but the text to be on the right, correct? For that you can use \[ <eqn> \qquad \makebox[0pt][l]{<text>} \]. If you want it flush with the right margin, you can use \tag*{<text>}. – Werner Apr 22 '21 at 17:08
  • That worked perfectly. Many thanks! – GitGoodCodes Apr 22 '21 at 17:10

0 Answers0