LaTeX: newline after closing $$

  • Context: LaTeX 
  • Thread starter Thread starter kiuhnm
  • Start date Start date
  • Tags Tags
    latex
Click For Summary

Discussion Overview

The discussion revolves around the formatting issues encountered when using LaTeX in a forum context, specifically regarding the vertical spacing that appears after closing double dollar signs ($$) and the impact of inserting newlines in the source code. The scope includes technical explanations and user experiences related to the rendering of mathematical expressions.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses dissatisfaction with the vertical space that appears after closing $$ when a newline is inserted, suggesting that it would be better to remove superfluous newlines.
  • Another participant notes that the issue may stem from the use of MathJax instead of LaTeX, advising against inserting extra empty lines.
  • A participant acknowledges the issue but explains their preference for inserting empty lines for ease of writing and editing, indicating a willingness to adapt despite the formatting challenges.
  • Another participant shares a method for formatting that avoids extra lines while maintaining readability, contrasting it with their previous approach.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to formatting. There are competing views on the impact of newlines and the tools used for rendering, with some expressing frustration and others offering alternative methods.

Contextual Notes

The discussion highlights limitations related to the rendering library used (MathJax) and the influence of formatting choices on the appearance of mathematical expressions. There are unresolved aspects regarding the specific behavior of the rendering system in relation to newlines.

kiuhnm
Messages
66
Reaction score
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
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   Reactions: Greg Bernhardt
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?
 
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   Reactions: SammyS and kiuhnm

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 45 ·
2
Replies
45
Views
7K
  • · Replies 61 ·
3
Replies
61
Views
13K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
9
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K