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?

Post by ghostanime2001 »

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

Code: Select all

\documentclass[fleqn]{article}
\setlength{\parindent}{0in}
\usepackage{fullpage}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\allowdisplaybreaks
\usepackage{xfrac}
\usepackage[makeroom]{cancel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\pagestyle{empty}
\sisetup{%
  output-decimal-marker={.},
  load-configurations=abbreviations,
  group-separator={,},
  per-mode=fraction,
  fraction-function=\sfrac}
\usepackage{fix-cm}
\begin{document}
\begin{enumerate}
\item
\begin{minipage}[t]{2in}
$\begin{aligned}[t]
\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} \\
\omega&=\text{?}
\end{aligned}$
\end{minipage}
\begin{align*}
\omega=\dfrac{\theta}{\Delta t}=\dfrac{\text{1.34 rad}}{\text{32,724 s}}=\text{\num{4.09e-5} rad/s}
\end{align*}
\end{enumerate}
\end{document}
Attachments
LaTeX2.pdf
(65.61 KiB) Downloaded 452 times
Last edited by ghostanime2001 on Sat Jun 18, 2011 5:36 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

How to not indent \align* environment?

Post by Stefan Kottwitz »

Set the length \mathindent to zero:

Code: Select all

\setlength{\mathindent}{0pt}
Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: How to not indent \align* environment?

Post by ghostanime2001 »

In the preamble?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How to not indent \align* environment?

Post by Stefan Kottwitz »

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
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: How to not indent \align* environment?

Post by ghostanime2001 »

It doesn't seem to work
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How to not indent \align* environment?

Post by Stefan Kottwitz »

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
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: How to not indent \align* environment?

Post by ghostanime2001 »

I think u misunderstood me. But anyway, i got it fixed
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How to not indent \align* environment?

Post by Stefan Kottwitz »

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
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: How to not indent \align* environment?

Post by ghostanime2001 »

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: 10335
Joined: Mon Mar 10, 2008 9:44 pm

How to not indent \align* environment?

Post by Stefan Kottwitz »

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.

Code: Select all

\documentclass[fleqn]{article}
\usepackage{amsmath}
\setlength{\mathindent}{0pt}
\begin{document}
\noindent Left aligned
\begin{align*}
x &= y
\end{align*}
\end{document}
align.png
align.png (2.2 KiB) Viewed 24066 times
Stefan
LaTeX.org admin
Post Reply