LaTeX forum ⇒ Math & ScienceHow 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?

Postby ghostanime2001 » Fri Jun 17, 2011 10:32 pm

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={.},
  16. load-configurations=abbreviations,
  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*}
  31. \omega=\dfrac{\theta}{\Delta t}=\dfrac{\text{1.34 rad}}{\text{32,724 s}}=\text{\num{4.09e-5} rad/s}
  32. \end{align*}
  33. \end{enumerate}
  34. \end{document}
Attachments
LaTeX2.pdf
(65.61 KiB) Downloaded 163 times
Last edited by ghostanime2001 on Sat Jun 18, 2011 5:36 am, edited 1 time in total.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9201
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Jun 17, 2011 10:46 pm

Set the length \mathindent to zero:

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


Stefan
Site admin

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Fri Jun 17, 2011 11:02 pm

In the preamble?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9201
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Jun 17, 2011 11:07 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
Site admin

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Fri Jun 17, 2011 11:08 pm

It doesn't seem to work

User avatar
Stefan Kottwitz
Site Admin
Posts: 9201
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Jun 17, 2011 11:14 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
Site admin

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Sat Jun 18, 2011 4:54 am

I think u misunderstood me. But anyway, i got it fixed

User avatar
Stefan Kottwitz
Site Admin
Posts: 9201
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Jun 18, 2011 9:47 am

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
Site admin

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Sat Jun 18, 2011 8:06 pm

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?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9201
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Jun 18, 2011 8:17 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
align.png (2.2 KiB) Viewed 8922 times


Stefan
Site admin


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests