Math & ScienceMixing Math Environments

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

Mixing Math Environments

Post by ghostanime2001 »

I know that aligned and minipage environments work inside align*

such as:

Code: Select all

\begin{align*}
\begin{minipage}[t]{1.7in}
$\begin{aligned}[t]
&\sum F_{y}=0 \\
&N-mg-F\sin\theta=0 \\
&N=mg+F\sin\theta
\end{aligned}$
\end{minipage}
\begin{aligned}[t]
f_{s,max}&=\mu_{S}N \\
f_{s,max}&=\mu_{S}(mg+F\sin\theta) \\
&=(0.4)((70)(9.8)+(300)(\sin\SI{15}{\degree})) \\
&=\text{305.46 N}
\end{aligned}
\end{align*}
But why can't another align* environment inside another outer align* environment work? If it could work, how do you make it work?

Recommended reading 2024:

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

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

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

Re: Mixing Math Environments

Post by Stefan Kottwitz »

What is the reaseon why you don't want to use aligned but require align*? align* centers to the line width and brings spacing before and after, because it's indented to be used as math environment in text, not in math. aligned would be the better choice.

Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Mixing Math Environments

Post by ghostanime2001 »

This is what I mean.

Code: Select all

\documentclass[fleqn]{article}
\usepackage{enumitem}
\usepackage{fullpage}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[fixamsmath]{mathtools}
\usepackage{amssymb}
\usepackage{siunitx}
\pagestyle{empty}
\setlength{\mathindent}{0pt}
\setenumerate[2]{label=\alph*),leftmargin=0.5cm,itemsep=0pt,topsep=-0.5cm}
\setenumerate[1]{label=\arabic*.,leftmargin=0cm,itemsep=0pt,topsep=-0.5cm,start=4}
\allowdisplaybreaks
\begin{document}
\begin{enumerate}
\item
\raisebox{1.85ex}{\parbox[t]{1.4in}{\null\includegraphics[width=\linewidth]{D8}}}
$\begin{aligned}[t]
\theta&=\SI{15}{\degree} \\
F&=\text{300 N} \\
m&=\text{70 kg} \\
\mu_{s}&=0.4 \\
\mu_{k}&=0.28
\end{aligned}$
\begin{align*}
\begin{minipage}[t]{1.7in}
$\begin{aligned}[t]
&\sum F_{y}=0 \\
&N-mg-F\sin\theta=0 \\
&N=mg+F\sin\theta
\end{aligned}$
\begin{align*}
F\cos\theta<f_{s,max} \\
F\cos\theta<\mu_{s}N 
\end{align*}
\end{minipage}
\begin{aligned}[t]
f_{s,max}&=\mu_{S}N \\
f_{s,max}&=\mu_{S}(mg+F\sin\theta) \\
&=(0.4)((70)(9.8)+(300)(\sin\SI{15}{\degree})) \\
&=\text{305.46 N}
\end{aligned}
\end{align*}
\end{enumerate}
\end{document}
except the only reason this works is because there is no ampersand in the align* environment starting with this equation:

Code: Select all

F\cos\theta<f_{s,max} \\ 
Is there a way to define a new alignment character that does not interfere with the & alignment character so that both environments have their own alignments?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Mixing Math Environments

Post by Stefan Kottwitz »

I still see no reason not to use aligned.

align* is for displayed aligned multiline equations, usually centered, with spacing around. If you don't want that, don't use it. This means, for parts of equation structures, use alignment blocks such as with aligned or gathered, and don't nest align*.

Otherwise you try to get around the intended functionality.

Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: Mixing Math Environments

Post by ghostanime2001 »

What do you mean "alignment blocks" ? Also can gather align mutliline equations like align* does?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Mixing Math Environments

Post by Stefan Kottwitz »

It's all explained here: amsmath user's guide, just have a look. If something is difficult or you have questions, just ask again after reading.

Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Mixing Math Environments

Post by ghostanime2001 »

I understand what you mean and nothing in there is useful to me but can't I place this part

Code: Select all

\begin{align*}
F\cos\theta<f_{s,max} \\
F\cos\theta<\mu_{s}N 
\end{align*}
inside another environment where alignment using ampersands is possible?
Post Reply