1

Is there any way to write the number 37 from the below image on the same line with equal sign?

enter image description here

\textbf{3.} Afla\c ti de\^ imp\u ar\c titul \c stiind c\u a \^ intre \^ imp\u ar\c titor, c\^ at \c si rest avem rela\c tia $i^2+c^2+r^2=37$.

Thanks!

  • could you give us some starting code, preferably an MWE – Runar Aug 11 '16 at 18:59
  • You could reduce the textsize, or put it inside a \makebox[\linewidth][l]{text} – Runar Aug 11 '16 at 19:13
  • Can you show us a little more context? With 3. it seems like you're manually enumerating content. Is this the case? Does the line start at the left margin, or indented? – Werner Aug 11 '16 at 19:14
  • The simplest solution is to use \mbox{$...$} to make the inline math unbreakable. The results my be a bit ugly, with either a large gap or extending into the margin. – John Kormylo Aug 11 '16 at 22:07
  • Short answer: no. If TeX breaks the line at the equals sign, it's almost sure that the number and the period cannot fit. – egreg Aug 12 '16 at 13:35
1

Rather than enclosing the math formula inside \mbox, as John Kormylo suggests, I’d define a command that prohibits line breaks inside a math formula. Indeed, this allows the glue inside the formula to stretch and shrink together with other glue on the same line, whereas John’s solution does not.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\makeatletter

\newcommand*{\prohibitmathbreaks}{%
    \binoppenalty \@M
    \relpenalty \@M
}

\hyphenpenalty = \@M % ONLY for this example: DO NOT INCLUDE IN YOUR DOCUMENTS!

\makeatother



\begin{document}

Some meaningless text, inserted just to get near\ldots\ the end of the line.
\( x+y=a+b\prohibitmathbreaks \).
And some more random text that adds other lines, which~contain~an unbreakable
sequence of words, to show that the spaces inside the formula \emph{are} allowed
to shrink.

On the other hand, if one uses the \verb|\mbox| solution, this does not happen:
\mbox{\( x+y=a+b \).}
And: some more random text that adds other lines, which~contain 
unbreakable~sequences~of~words.

Another paragraph, containing another formula, in order to show that the effect
of our \verb|\prohibitmathbreaks| command is kept local:
\( a+b+c+d+e = x+y+z \).

\end{document}

Output:

Output of the code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.