LaTeX: newline after closing $$

  • LaTeX
  • Thread starter kiuhnm
  • Start date
  • Tags
    latex
In summary, the conversation discusses the support for ##\LaTeX## and the issue of extra vertical space when using newlines after the closing \$$ in formulas. The solution proposed is to remove superfluous newlines before the opening and after the closing \$$ in order to avoid this issue. The conversation also mentions the possibility of using MathJax instead of LaTeX, and the use of empty lines in the source code for easier editing. The name of the library used is not mentioned.
  • #1
kiuhnm
66
1
The support for ##\LaTeX## is great, but there's just one thing I don't like: if I put a newline after the closing \$$ I get too much vertical space after the rendered part. For instance:
$$(x_1+\ldots+x_p)^n = \sum_{c_1+\ldots+c_p=n} \frac{n!}{c_1!\cdots c_p!}x_1^{c_1}\cdots x_p^{c_p}$$
As you can see, there's a space right above this line.
I think the correct thing to do would be to remove all the superfluous newlines before the opening and after the closing \$$.
Things are even worse if I want to separate ##\LaTeX## formulas from the rest of the text in the source code:

$$(x_1+\ldots+x_p)^n = \sum_{c_1+\ldots+c_p=n} \frac{n!}{c_1!\cdots c_p!}x_1^{c_1}\cdots x_p^{c_p}$$

Now I also have a space before the rendered formula.
 
Physics news on Phys.org
  • #2
This is possibly because we do not use LaTeX but MathJax. Just don't insert extra empty lines! In any case the library we use is ready made, so that we have no influence on the source code.
 
  • Like
Likes Greg Bernhardt
  • #3
fresh_42 said:
This is possibly because we do not use LaTeX but MathJax. Just don't insert extra empty lines! In any case the library we use is ready made, so that we have no influence on the source code.

I insert empty lines because it makes it easier for me to write and especially edit parts of my posts before posting them. Well, I'll live with that. I just wanted to make sure you were aware of this issue. Could you tell me the name of the library?
 
  • #4
kiuhnm said:
I insert empty lines because it makes it easier for me to write and especially edit parts of my posts before posting them. Well, I'll live with that. I just wanted to make sure you were aware of this issue. Could you tell me the name of the library?
I do it this way:

<text>
$$
<formula>
$$ <text>

which doesn't produce extra lines and is equally easy to edit and read.

One line test for comparison:
<text>$$<formula>$$<text>
 
  • Like
Likes SammyS and kiuhnm

What is LaTeX and why is it used?

LaTeX is a document preparation system used for creating high-quality scientific and mathematical documents. It is preferred by researchers and academics due to its ability to handle complex equations, tables, and figures in a professional manner.

What does "newline after closing $$" mean in LaTeX?

In LaTeX, the $$ symbol is used to denote the beginning and end of a mathematical equation. Adding a newline after closing $$ means that the equation will be displayed on a separate line from the rest of the text, making it easier to read and understand.

Do I need to add a newline after every closing $$ in LaTeX?

No, it is not necessary to add a newline after every closing $$ in LaTeX. It is only recommended when the equation is too long and would disrupt the flow of the text if it were to be displayed on the same line.

Can I add a newline after closing $$ in the middle of a paragraph?

Yes, you can add a newline after closing $$ in the middle of a paragraph in LaTeX. This will not affect the formatting of the rest of the paragraph. However, it is recommended to add the newline before or after the paragraph for better readability.

Are there any other ways to display equations in LaTeX without using $$?

Yes, there are other ways to display equations in LaTeX, such as using the \[ \] or \begin{equation} \end{equation} commands. These methods provide more control over the layout and numbering of equations.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
591
  • Quantum Physics
Replies
1
Views
539
  • Math Proof Training and Practice
2
Replies
61
Views
9K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
265
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
  • Quantum Physics
Replies
9
Views
783
  • Linear and Abstract Algebra
Replies
3
Views
1K
  • Linear and Abstract Algebra
Replies
3
Views
1K
  • Math Proof Training and Practice
3
Replies
100
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
Back
Top