LaTeX forum ⇒ Math & Science ⇒ How to not indent \align* environment?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

How to not indent \align* environment?

When I use the \align* environment I am okay with the vertical space it sets by default but the formula in between this environment gets indented. How can I stop it doing that? i want it to be aligned with the page number to the left as per the following example. Here is the code

1. \documentclass[fleqn]{article}
2. \setlength{\parindent}{0in}
3. \usepackage{fullpage}
4. \usepackage[margin=1in]{geometry}
5. \usepackage{graphicx}
6. \usepackage{amsmath}
7. \allowdisplaybreaks
8. \usepackage{xfrac}
9. \usepackage[makeroom]{cancel}
10. \usepackage[T1]{fontenc}
11. \usepackage[utf8]{inputenc}
12. \usepackage{siunitx}
13. \pagestyle{empty}
14. \sisetup{%
15. output-decimal-marker={.},
17. group-separator={,},
18. per-mode=fraction,
19. fraction-function=\sfrac}
20. \usepackage{fix-cm}
21. \begin{document}
22. \begin{enumerate}
23. \item
24. \begin{minipage}[t]{2in}
25. \begin{aligned}[t] 26. \Delta t&=\text{9.09 \cancel{hr}}\left(\dfrac{\text{60 \cancel{min}}}{\text{1 \cancel{hr}}}\right)\left(\dfrac{\text{60 s}}{\text{1 \cancel{min}}}\right)=\text{32,724 s} \\ 27. \omega&=\text{?} 28. \end{aligned}
29. \end{minipage}
30. \begin{align*}
32. \end{align*}
33. \end{enumerate}
34. \end{document}
Attachments
LaTeX2.pdf
Last edited by ghostanime2001 on Sat Jun 18, 2011 5:36 am, edited 1 time in total.

Stefan Kottwitz
Posts: 9285
Joined: Mon Mar 10, 2008 9:44 pm
Set the length \mathindent to zero:

1. \setlength{\mathindent}{0pt}

Stefan

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
In the preamble?

Stefan Kottwitz
Posts: 9285
Joined: Mon Mar 10, 2008 9:44 pm
Yes, then it's for all such math environments. Or later, if you want it later. You can even use within environments, if you wish to keep the effect local.

Stefan

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
It doesn't seem to work

Stefan Kottwitz
Posts: 9285
Joined: Mon Mar 10, 2008 9:44 pm
It does. If you use align* within enumerate, it aligns to the left regarding the items. Not to the left of the number. If you desire that, first end the enumerate environment, then start align*.

Stefan

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
I think u misunderstood me. But anyway, i got it fixed

Stefan Kottwitz
Posts: 9285
Joined: Mon Mar 10, 2008 9:44 pm
You could explain what has been meant. And how you fixed it (code? pdf?), this would also explain what the problem has been, originally.

Stefan

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
I wrote "\setlength{\mathindent}{0pt}" exactly one line before \begin{document} and for equations i wanted to have a nice vertical space without manually setting \vspace i set \begin{align*} into math equations i wanted to have this good vertical space and it worked. If you still don't know what I mean i can show you a PDF?

Stefan Kottwitz
Posts: 9285
Joined: Mon Mar 10, 2008 9:44 pm
This explanation doesn't make it clearer. Well, the question was how to remove the indentation of align*, and this way it's left aligned.

1. \documentclass[fleqn]{article}
2. \usepackage{amsmath}
3. \setlength{\mathindent}{0pt}
4. \begin{document}
5. \noindent Left aligned
6. \begin{align*}
7. x &= y
8. \end{align*}
9. \end{document}

align.png (2.2 KiB) Viewed 9177 times

Stefan