Add how to make blockquotes in posts to the FAQ

  • Context: Suggestion 
  • Thread starter Thread starter blaisem
  • Start date Start date
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
blaisem
Messages
28
Reaction score
2
In the LaTex help page:

https://www.physicsforums.com/help/latexhelp/

the 2nd section, "Delimiting your LaTex code," formats the LaTex equations into a blue box. An advantage of this box is that line spacing before, between, and after $$ delimiters is single-spaced. Otherwise, you end up with massive spacing like this:

$$ F=ma $$
$$ P=mv $$
$$ \hat H \Psi = - \frac{\hbar ^2}{2 \mu } \nabla^2 \Psi (r) + V(r) \Psi (r) = E \Psi (r) $$

For this reason, I would like to use this blue box, but I could not find anywhere how.

I initially attempted the {linespacing} LaTex formatting from its help site, but that doesn't seem to work on PF. I did however eventually find the spacing inbetween delimiters can be forced into single spacing via \begin{align}, although it requires the inconvenience of trial and error to arrange the proper alignment with "&"—not to mention the admittedly very mild annoyance of typing out the extra text. Nevertheless, the spacing before and after the equations remains dramatically pronounced. Example:

$$ \begin{align} F=ma \nonumber \\ p=mv \nonumber \\ \hat H \Psi = - \frac{\hbar ^2}{2 \mu } \nabla^2 \Psi (r) + V(r) \Psi (r) = E \Psi (r) \nonumber \end{align}$$

Also notice the necessity to trial and error the alignment with longer equations, making this work-around suboptimally tedious.

Personally, I prefer the aesthetic provided by the blue box in the help tutorial, where the spacing is more compact, and potentially more convenient to implement. Would it be possible to add how to do this somewhere in the FAQ? Or did I manage to miss it explained somewhere?
 
on Phys.org
The code itself is the same. The forum adds one line break before and after these equations. To avoid that:
  • You can use the inline equations with double #: ##a_1^2+b_2^2##. To make them look more like the other style, add \displaystyle and center them. That leaves about the regular line spacing.
    ##\hat H \Psi = - \frac{\hbar ^2}{2 \mu } \nabla^2 \Psi (r) + V(r) \Psi (r) = E \Psi (r)##​
  • Between equations, you can use the LaTeX line break \\, no special alignment necessary: $$a^2=b^2\\c^2=e^2+f^2$$
 
  • Like
Likes   Reactions: blaisem
blaisem said:
I would like to use this blue box
The "Help/How-To" articles use HTML tags for formatting. These do not work elsewhere in the forum. The blue box is a <p> tag with some inline CSS code:

<p style='margin-left: 10%; margin-right: 10%; background-color: Azure'>

If you're interested only in the single-spacing, I use the LaTeX line-break code // that mfb mentioned, in my ordinary posts. To avoid extra space before and after the entire block of equations, I put the code (with $$ delimiters) in-line inside a paragraph, with no extra newlines before and after the delimiters. You can see an example of this in one of my "blue boxes".
 
Last edited:
  • Like
Likes   Reactions: blaisem
I see. I did not realize \\ was standard LaTex for a newline, nor that it was the actual reason the alignment formatting was singly spaced. That's also interesting double $ in a paragraph eliminates spacing before and after; I understood from the tutorial to only use double $ in a separate line since it's intended for stand-alone equations. It does seem easier than \displaystyle, although I may play around with both when the occasion arises.

I will use these methods going forward. Thank you both for the help!
 
Last edited:
  • Like
Likes   Reactions: dlgoff