1

When writing a long math sentence, the writing goes beyond the end of the page: pdf output

When all I write in the file is: enter image description here

Is there an easy way to force a new line without actually go to a new line? Or a way to know when I need to go to a new line without viewing the pdf file all the time?

  • Welcome to tex.se, Ofir! I think egreg has a nice answer to your first question. For your second question, unfortunately LyX does not know when it's too long. I have sometimes thought about a LyX feature that could compile the LaTeX, then check the log for "overfull hbox" warnings, then show that graphically in the LyX display, but it would be a complicated feature. – scottkosty Mar 11 '22 at 15:25
  • As a book author, I feel that such long sentences should be avoided by all means. For readability, if you break up the calculations into many sentences, it helps comprehension and good continuity in writing. For the volume integral, I will start with the triple integral, note that the integration can be separated and do the calculations in the next line. Thanks. – Dr. Sundar Mar 11 '22 at 12:31
  • It is a good answer, but I am looking for a way to avoid checking when dealing with long sentences. Thank you. – Phiisnotdead Mar 11 '22 at 13:58
  • Thank you Scott :) – Phiisnotdead Mar 13 '22 at 19:29

1 Answers1

1

I don't know how to do it with LyX (and don't want to), but the right way to typeset that long derivation is with split:

\documentclass{article}
\usepackage[intlimits]{amsmath}

\begin{document}

\begin{equation} \begin{split} \iiint_V dV &= \int_{0}^{R} \int_{0}^{2\pi} \int_{0}^{\pi} r^2\sin(\theta) , d\theta , d\phi , dr \ &= 2\pi \int_{0}^{\pi} \sin(\theta) , d\theta \int_{0}^{R} r^2 , dr \ &= 2\pi \cdot (-\cos(\theta))\Big|{0}^{\pi} \cdot \frac{r^3}{3}\Big|{0}^{R} \ &= -2\pi \cdot (-1-1) \cdot \frac{R^3}{3} \ &= \frac{4\pi R^3}{3} \end{split} \end{equation}

\end{document}

Use equation* if you don't want an equation number. Note that I added a few improvements: \, in front of differentials and larger “evaluation at” bars.

enter image description here

egreg
  • 1,121,712
  • Regarding LyX, @Ofir if you copy egreg's LaTeX and go to Edit > Paste special > Paste From LaTeX, it converts it to LyX. That does not work for all LaTeX, but in this case the used environments are supported in the conversion routine. – scottkosty Mar 11 '22 at 15:27
  • Hearty congrats to 'egreg' for nice LaTeX commands. However, as a book author, I don't like this presentation as I feel you skipped a vital step (in the evaluation of the triple integral). Ideal presentation is to separate it into three integrals and evaluate them separately (noting that integrals can be separated). Thanks for LaTeX commands! – Dr. Sundar Mar 11 '22 at 16:42
  • @scottkosty What do you mean by "That doesn't work for all LaTeX"? – Phiisnotdead Mar 13 '22 at 19:31
  • @OfirShukrun LyX only natively supports some LaTeX commands and packages. When you do "paste from LaTeX", LyX attempts to convert the LaTeX into LyX's format, but since LyX does not support all LaTeX commands and packages, the conversion does not always work. This is part of the reason why LyX is not really a LaTeX editor but more so a LaTeX exporter. – scottkosty Mar 13 '22 at 20:41
  • @scottkosty So what is it for? You can't really use LaTeX with it. It's quite like MathJax, where you're bound to what it provides. If it doesn't support such a basic environment as split, I am reinforced in my idea that LyX is best avoided. – egreg Mar 13 '22 at 20:45
  • @egreg Everyone has a different answer to that. I have my personal opinion here: https://tex.stackexchange.com/a/197773/12212. I know you're not a fan of LyX, and that makes me all the more appreciative of your patience when helping users who do choose to use LyX. It's really difficult to help people when they choose to do something that you think is not good for them. So thank you for that! – scottkosty Mar 13 '22 at 20:59
  • @egreg In response to your comment, I forgot to say that LyX does support split. But I don't think that will make you like LyX so I leave my previous comment :). – scottkosty Mar 13 '22 at 21:07