# [SOLVED]Indent regular latex instead of centering it?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I don't like how regular latex is centered.
It makes the text jump up and down unpredictably, dependent on the resolution you're using.
As a consequence I (almost) never use regular latex, and use inline latex instead.
It is a bit of a hassle sometimes, since it forces me to add \displaystyle and/or \dfrac everywhere.
And it also forces me to [ INDENT ] equations to get them aligned properly.

Can regular latex get a single indent instead?

#### Jameson

Staff member
Hi ILikeSerena, I'm more of a visual person with this kind of thing. Can you post an example or give a link to a thread where I can see what you are referring to?

Jameson

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Hi ILikeSerena, I'm more of a visual person with this kind of thing. Can you post an example or give a link to a thread where I can see what you are referring to?

Jameson
Sure!
I just made the following post.

[HR][/HR]
With regular latex it looks like:

So let's continue:
$$a_r = -\frac{8b^2h^2}{r^5}\cos^2\theta - \frac{4bh^2}{r^4}\sin\theta$$
$$a_r = -\frac{8b^2h^2}{r^5}(1 - \sin^2\theta) - \frac{4bh^2}{r^4}\sin\theta$$
$$a_r = -\frac{8b^2h^2}{r^5} + \frac{8b^2h^2}{r^5}\sin^2\theta - \frac{4bh^2}{r^4}\sin\theta$$

We can substitute $r = 2b \sin \theta$ (in reverse), getting:
$$a_r = \frac{8b^2h^2}{r^5} + \frac{2h^2}{r^5} \cdot r^2 -\frac{2h^2}{r^4} \cdot r$$
$$a_r = \frac{8b^2h^2}{r^5} \qquad \blacksquare$$

[HR][/HR]
With inline latex it looks like:

So let's continue:

$a_r = -\frac{8b^2h^2}{r^5}\cos^2\theta - \frac{4bh^2}{r^4}\sin\theta$

$a_r = -\frac{8b^2h^2}{r^5}(1 - \sin^2\theta) - \frac{4bh^2}{r^4}\sin\theta$

$a_r = -\frac{8b^2h^2}{r^5} + \frac{8b^2h^2}{r^5}\sin^2\theta - \frac{4bh^2}{r^4}\sin\theta$

We can substitute $r = 2b \sin \theta$ (in reverse), getting:

$a_r = \frac{8b^2h^2}{r^5} + \frac{2h^2}{r^5} \cdot r^2 -\frac{2h^2}{r^4} \cdot r$

$a_r = \frac{8b^2h^2}{r^5}$ $\qquad \blacksquare$

[HR][/HR]
And with [ INDENT ] inline latex with \displaystyle (not here this time) and \dfrac it looks like:

So let's continue:

$a_r = -\dfrac{8b^2h^2}{r^5}\cos^2\theta - \dfrac{4bh^2}{r^4}\sin\theta$

$a_r = -\dfrac{8b^2h^2}{r^5}(1 - \sin^2\theta) - \dfrac{4bh^2}{r^4}\sin\theta$

$a_r = -\dfrac{8b^2h^2}{r^5} + \dfrac{8b^2h^2}{r^5}\sin^2\theta - \dfrac{4bh^2}{r^4}\sin\theta$​

We can substitute $r = 2b \sin \theta$ (in reverse), getting:

$a_r = \dfrac{8b^2h^2}{r^5} + \dfrac{2h^2}{r^5} \cdot r^2 -\dfrac{2h^2}{r^4} \cdot r$

$a_r = \dfrac{8b^2h^2}{r^5}$ $\qquad \blacksquare$​

[HR][/HR]
Suffice to say that I prefer the last form.
I just wish that regular latex would do all that for me.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I know it's possible, because it works that way on PF.
Btw, I don't dare edit my previous post anymore, because the editor keeps removing the empty line before the [ INDENT ]'s.

#### Jameson

Staff member
I know it's possible, because it works that way on PF.
Btw, I don't dare edit my previous post anymore, because the editor keeps removing the empty line before the [ INDENT ]'s.
Hmm, well PF uses Mathjax just like we do so maybe I can ask Greg if he has any insight about this. I'll try to do some quick research first but if not I'll shoot him a message. #### Ackbach

##### Indicium Physicus
Staff member
I like the indentation better than centering as well. It means the eye doesn't have to zig-zag so much between left-justified text and the equations.

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
Yeah , I also realized that , when I use the dollar signs the code becomes just smaller , I don't know why personally I keep writing tex all the time , that is too painful . It would be so great if we have a quick access button to wrap the code with tex automatically or the code between single dollar signs looks much better and a bit larger ... #### Ackbach

##### Indicium Physicus
Staff member
Yeah , I also realized that , when I use the dollar signs the code becomes just smaller , I don't know why personally I keep writing tex all the time , that is too painful . It would be so great if we have a quick access button to wrap the code with tex automatically or the code between single dollar signs looks much better and a bit larger ... You can use double-dollar signs to get centered displayed math.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Yeah , I also realized that , when I use the dollar signs the code becomes just smaller , I don't know why personally I keep writing tex all the time , that is too painful . It would be so great if we have a quick access button to wrap the code with tex automatically or the code between single dollar signs looks much better and a bit larger ... Using \dfrac instead of \frac also helps.

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
Using \dfrac instead of \frac also helps.
This will just help for fractions right! but for integrals and others $\int^1_0$ it looks really small ...

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
You can use double-dollar signs to get centered displayed math.
I only use double-dollar signs to show important formulas because they attract attention , but for a step-by-step solution I prefer it to be left-aligned ...

#### Klaas van Aarsen

##### MHB Seeker
Staff member
This will just help for fractions right! but for integrals and others $\int^1_0$ it looks really small ...
Try it with the \displaystyle prefix.

Then you'll get $\displaystyle\int^1_0$, $\displaystyle\sum_{k=0}^\infty$ and $\displaystyle\lim_{n \to \infty}$ instead of $\int^1_0$ and $\sum_{k=0}^\infty$ and $\lim_{n \to \infty}$.

\displaystyle and \dfrac are intended to overrule the inline style of latex, showing (part of) the formula as regular latex instead.

#### Chris L T521

##### Well-known member
Staff member
[snipet]
And with [ INDENT ] inline latex with \displaystyle (not here this time) and \dfrac it looks like:

So let's continue:
$a_r = -\dfrac{8b^2h^2}{r^5}\cos^2\theta - \dfrac{4bh^2}{r^4}\sin\theta$

$a_r = -\dfrac{8b^2h^2}{r^5}(1 - \sin^2\theta) - \dfrac{4bh^2}{r^4}\sin\theta$

$a_r = -\dfrac{8b^2h^2}{r^5} + \dfrac{8b^2h^2}{r^5}\sin^2\theta - \dfrac{4bh^2}{r^4}\sin\theta$​

We can substitute $r = 2b \sin \theta$ (in reverse), getting:
$a_r = \dfrac{8b^2h^2}{r^5} + \dfrac{2h^2}{r^5} \cdot r^2 -\dfrac{2h^2}{r^4} \cdot r$

$a_r = \dfrac{8b^2h^2}{r^5}$ $\qquad \blacksquare$​

[HR][/HR]
Suffice to say that I prefer the last form.
I just wish that regular latex would do all that for me.
[/snipet]
Well, you can do in a indirect way, I guess. You can use the aligned tags to align equations in inline mode and it (i) displaystyles the equation for you and (ii) won't automatically center. Also, you can specify how much of an indentation you want using the hspace command. For instance, if we want a half-inch indentation, you'd have the following form of the example you provided:

So let's continue:

\hspace{.5in}\begin{aligned}a_r &= -\frac{8b^2h^2}{r^5}\cos^2\theta - \frac{4bh^2}{r^4}\sin\theta\\ a_r &= -\frac{8b^2h^2}{r^5}(1 - \sin^2\theta) - \frac{4bh^2}{r^4}\sin\theta\\ a_r &= -\frac{8b^2h^2}{r^5} + \frac{8b^2h^2}{r^5}\sin^2\theta - \frac{4bh^2}{r^4}\sin\theta\end{aligned}

We can substitute $r = 2b \sin \theta$ (in reverse), getting:
\hspace{.5in}\begin{aligned} a_r &= \frac{8b^2h^2}{r^5} + \frac{2h^2}{r^5} \cdot r^2 -\frac{2h^2}{r^4} \cdot r\\ a_r &= \frac{8b^2h^2}{r^5} \qquad \blacksquare\end{aligned}

With the following source code:

Code:
\hspace{.5in}\begin{aligned}a_r &= -\frac{8b^2h^2}{r^5}\cos^2\theta - \frac{4bh^2}{r^4}\sin\theta\\ a_r &= -\frac{8b^2h^2}{r^5}(1 - \sin^2\theta) - \frac{4bh^2}{r^4}\sin\theta\\ a_r &= -\frac{8b^2h^2}{r^5} + \frac{8b^2h^2}{r^5}\sin^2\theta - \frac{4bh^2}{r^4}\sin\theta\end{aligned}

We can substitute $r = 2b \sin \theta$ (in reverse), getting:
\hspace{.5in}\begin{aligned} a_r &= \frac{8b^2h^2}{r^5} + \frac{2h^2}{r^5} \cdot r^2 -\frac{2h^2}{r^4} \cdot r\\ a_r &= \frac{8b^2h^2}{r^5} \qquad \blacksquare\end{aligned}
Which I think is a pretty interesting solution for it. Last edited:

#### Jameson

Staff member
I'm not entirely sure of where this problem stands, but I think by adding a Latex button (or two maybe) in the editor this issue can be addressed. There are two special BB Code tags on MHB that both do the same thing  and . We have both options available because many members are used to one or the other. Anyway, both of these simply wrap the code in a single dollar sign and add \displaystyle at the beginning.

I can set up a third BB Code tag to do the same as those two but also indent everything. If that happened automatically would the formatting be what you are looking for?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I'm not entirely sure of where this problem stands, but I think by adding a Latex button (or two maybe) in the editor this issue can be addressed. There are two special BB Code tags on MHB that both do the same thing  and . We have both options available because many members are used to one or the other. Anyway, both of these simply wrap the code in a single dollar sign and add \displaystyle at the beginning.

I can set up a third BB Code tag to do the same as those two but also indent everything. If that happened automatically would the formatting be what you are looking for?
I'm looking for something that is displaystyle automatically and that is left indented.
This may be what you are offering, but I can't tell yet for sure from what you write.

#### Jameson

Staff member
I'm looking for something that is displaystyle automatically and that is left indented.
This may be what you are offering, but I can't tell yet for sure from what you write.
I didn't explain it well. I can make a new custom tag, let's call it [ILS]. When this tag is used it can work like this:

Input - [ILS]\int_{1}^{\infty} \frac{1}{x^2}dx[/ILS]

Output - [INDENT] \$\displaystyle \int_{1}^{\infty} \frac{1}{x^2}dx \$ [/INDENT]

Of course we should choose a different title for this custom code but is the replacement correct in modeling what you want to happen?

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
I didn't explain it well. I can make a new custom tag, let's call it [ILS]. When this tag is used it can work like this:

Input - [ILS]\int_{1}^{\infty} \frac{1}{x^2}dx[/ILS]

Output - [INDENT] \$\displaystyle \int_{1}^{\infty} \frac{1}{x^2}dx \$ [/INDENT]

Of course we should choose a different title for this custom code but is the replacement correct in modeling what you want to happen?
That is great, and it will be fantastic if you add a button for it ...

#### Jameson

Staff member
There is one small thing to figure out before I can add these new buttons - what icons to use. The image needs to be 16x16 pixels, which is very small. I want to add two buttons that both involve Latex. The first one will add \displaystyle and the second one will add [INDENT] \displaystyle. Unfortunately they will be located next to each other until I figure out how to rearrange the toolbar so these two icons need to be noticeably different.

Any ideas?

#### dwsmith

##### Well-known member
Try it with the \displaystyle prefix.

Then you'll get $\displaystyle\int^1_0$, $\displaystyle\sum_{k=0}^\infty$ and $\displaystyle\lim_{n \to \infty}$ instead of $\int^1_0$ and $\sum_{k=0}^\infty$ and $\lim_{n \to \infty}$.

\displaystyle and \dfrac are intended to overrule the inline style of latex, showing (part of) the formula as regular latex instead.
If you are compiling a pdf (summation and limit only apply here), you can do \sum\limits_{k=1}^n and \lim\limits_{n\to\infty} which give the smaller inline but have the bounds in the center aligned spots.

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
There is one small thing to figure out before I can add these new buttons - what icons to use. The image needs to be 16x16 pixels, which is very small. I want to add two buttons that both involve Latex. The first one will add \displaystyle and the second one will add [INDENT] \displaystyle. Unfortunately they will be located next to each other until I figure out how to rearrange the toolbar so these two icons need to be noticeably different.

Any ideas?
I think it is better to just put just one button. If some one wants the other format he/she shall write it manually. Creating two buttons may cause confusion .

Staff member

#### Jameson

Staff member
Great concept. Those two images look pixelated in my browser, but it might also be due to the background. Is it pretty clear on your screen? I say use those two designs for sure. It's really hard to make small changes that are noticeable enough to easily distinguish between two choices, but here it works great.

#### MarkFL

Staff member
They look reasonable on my screen (to these older eyes ), however I'm sure they are pixelated. What I did was use the post preview here with the codes:

\int and \to\int

then captured the screen and pasted it into MS Paint, found that I could capture them as 20X20 images, and used the re-size function to shrink them to 16X16.

I really only intended to show the general idea within the size requirement. Perhaps someone with more sophisticated graphics software could produce higher quality images. #### Jameson

That would work great...[LIND] is short, and easily indicates its function. 