Can I make vertical separation of $$ expressions smaller?

In summary: BTW, this sub forum is a mix of genuine LateX and MathJax (I don't know how to filter that). Someone knowledgeable should add a thread on the diffferences and possible workarounds :rolleyes:
  • #1
George Keeling
Gold Member
180
41
I wrote my first LaTeX like this:
... it was easy to calculate that
$$ ê^1=\hat x - \frac { \hat y } {\tan \alpha} $$
and
$$ ê^2=\frac { \hat y } {\sin \alpha} $$
where ...
Is it possible to make the vertical separation smaller? The first example in the latex primer does not seem to suffer from this problem. I tried ## instead of $$ and other problems arose.
 
Physics news on Phys.org
  • #2
George Keeling said:
I wrote my first LaTeX like this:
... it was easy to calculate that$$ ê^1=\hat x - \frac { \hat y } {\tan \alpha} $$and$$ ê^2=\frac { \hat y } {\sin \alpha} $$where ...
Is it possible to make the vertical separation smaller? The first example in the latex primer does not seem to suffer from this problem. I tried ## instead of $$ and other problems arose.
Yes, a little (1 line). You don't put a line feed after the $$:
calculate that
$$ ê^1=\hat x - \frac { \hat y } {\tan \alpha} $$and$$ ê^2=\frac { \hat y } {\sin \alpha} $$where ...
It seems leaving out the line in front of the $$ doesn't matter, though...
 
  • Like
Likes George Keeling and Orodruin
  • #3
BvU said:
Yes, a little (1 line). You don't put a line feed after the $$:
calculate that
$$ ê^1=\hat x - \frac { \hat y } {\tan \alpha} $$and$$ ê^2=\frac { \hat y } {\sin \alpha} $$where ...
It seems leaving out the line in front of the $$ doesn't matter, though...
As kind of a LaTeX nerd, this is a very common mistake students make when writing LaTeX. The worst part is when they do it mid sentence and a new indented paragraph is started with ”where x is ...”. That really hurts my eyes.
 
  • #4
I sometimes go for multiline expressions when I want tighter packing. Everything is inside one set of \$\$...\$\$ but with two backslashes and a new line marking a line break (I'm not sure if the new line is necessary, I just do it for readability). That is, if I write

\$\$ your first line \\
\rm{and} \\
your second line \$\$

I get this:

$$\hat e^1 = \hat x - \frac {\hat y}{\tan \alpha} \\
\rm{and} \\
\hat e^2 = \frac {\hat y}{\sin \alpha} $$

Normally I do that when I have several lines of equations but no text lines in between. You can see that it centered the word "and" along with the equations. I'm still a relative novice with this LaTeX interface myself and not sure if I can left-justify that one text line within the multiline.

By the way, multilines are covered in the primer.
 
  • Like
Likes George Keeling
  • #5
RPinPA said:
$$ your first line \\
\rm{and} \\
your second line $$
If the and was left justified it would be great!
I can't find anything that might do that except \hfill or \hspace{\fill}, but they don't seem to do much.
 
  • #6
$$ your first line \\
\rm{and} \phantom {10000000000000000000000000000000000000000000000000000000000} \\
your second line $$
:smile:

$$ your first line \\
\rm{and} \phantom {10000000000000000000000000000000000000000000000000000000000} \\
your second line $$
 
  • Like
Likes George Keeling
  • #7
BvU said:
\phantom {10000000000000000000000000000000000000000000000000000000000}
Brilliant! I guess I will have to experiment to find out how many 0's are necessary in this great bodge. The phantom is not mentioned in the PF guide. I have found http://www.icl.utk.edu/~mgates3/docs/latex.pdf which mentions it. \qquad is similar but not as effective. Here it is with half the number of 0's, then x's, which give more bang for your buck:
$$ your first line \\
\rm{and} \phantom {100000000000000000000000000} \\
\rm{and} \phantom {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} \\
your second line $$
 
  • #8
BvU said:
$$ your first line \\
\rm{and} \phantom {10000000000000000000000000000000000000000000000000000000000} \\
your second line $$
:smile:

$$ your first line \\
\rm{and} \phantom {10000000000000000000000000000000000000000000000000000000000} \\
your second line $$
I would not use this. What looks good is going to be browser and platform dependent. Also, the use of \rm should be {\rm and}, not \rm{and}. \rm is a modifier that does not take arguments, which is why your second line is not regular math font but also included in what \rm is affecting.
 
  • Like
Likes George Keeling and jim mcnamara
  • #9
George Keeling said:
Brilliant! I guess I will have to experiment to find out how many 0's are necessary in this great bodge. The phantom is not mentioned in the PF guide.
I appreciate the irony, and would not qualify it as brilliant, more as: desperate. Point is that MathJax is different from ##\TeX/\LaTeX## in many respects and this horizontal spacing is one of them. I tried \hbox, \hfill and such, but didn't get anything useful - probably for a good reason.

BTW, this sub forum is a mix of genuine LateX and MathJax (I don't know how to filter that). Someone knowledgeable should add a thread on the diffferences and possible workarounds :rolleyes:

Signed: ##\TeX##ie
 
  • #10
Orodruin said:
I would not use this. What looks good is going to be browser and platform dependent. Also, the use of \rm should be {\rm and}, not \rm{and}. \rm is a modifier that does not take arguments, which is why your second line is not regular math font but also included in what \rm is affecting.
I agree, it's ugly and dependent. I'm open for alternatives :rolleyes:

The \rm was just a copy/paste.

##\text { I had hoped} \textsf {\textsf might look a little better} \ \ \text{than roman} ## but it doesn't match the PF font (name ?) either.
 
  • #11
Re: \rm. I've actually been using \text but found \rm referenced in various sources and thought it was more or less equivalent (but more likely to reproduce the default text font) so I experimented with it for this answer.

Looks like, no surprise, I still have a lot to learn.

So do we have a consensus on the best way to left-justify embedded text in a multiline?
 
  • #12
RPinPA said:
So do we have a consensus on the best way to left-justify embedded text in a multiline?
Yes. Don’t. :rolleyes:
 
  • #13
Also, if you have to include text in a math environment, I suggest using an \mbox.
 

Related to Can I make vertical separation of $$ expressions smaller?

1. Can I make vertical separation of $$ expressions smaller?

Yes, it is possible to make the vertical separation of $$ expressions smaller. This can be done by adjusting the spacing between the lines of the expressions or by using a smaller font size for the expressions.

2. Why would I want to make vertical separation of $$ expressions smaller?

There are a few reasons why you might want to make the vertical separation of $$ expressions smaller. One reason could be to save space and make the overall layout of the expressions more compact. Another reason could be to make the expressions easier to read and follow.

3. Is there a specific method for making the vertical separation smaller?

There is no one specific method for making the vertical separation of $$ expressions smaller. It will depend on the tools or software you are using to display the expressions. Some options may include adjusting settings for line spacing or font size, or manually editing the expressions to reduce the space between lines.

4. Will reducing the vertical separation affect the accuracy of the expressions?

No, reducing the vertical separation of $$ expressions should not affect the accuracy of the expressions. It is simply a visual adjustment and should not change the actual mathematical calculations.

5. Are there any limitations to how small I can make the vertical separation of $$ expressions?

There may be some limitations depending on the software or tool you are using to display the expressions. Some may have minimum spacing requirements for readability. It is also important to ensure that the expressions are still legible and not too crowded together.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
Replies
1
Views
115
Replies
16
Views
1K
  • Calculus and Beyond Homework Help
Replies
16
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
323
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
985
Replies
14
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
3
Replies
97
Views
3K
Back
Top