Math & Sciencealigning text with first equation in flushleft environment

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

aligning text with first equation in flushleft environment

Post by ghostanime2001 »

How can I make "x direction:" perfectly aligned with the top line of T_{1x}+T_{2x}=0 equation and still keeping the two equations flushleft?

Here is my code I am trying to fix:

Code: Select all

\documentclass[fleqn]{article}
\usepackage{fullpage}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\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}
\setlength{\mathindent}{0pt}
\begin{document}
x direction:
\begin{flushleft}
T_{1x}+T_{2x}=0 \\
-T_{1}\cos\theta_{1}+T_{2}\cos\theta_{2}=0 
\end{flushleft}
\end{document}
Attachments
CAPA 1 Solutions.pdf
(45.67 KiB) Downloaded 187 times

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

aligning text with first equation in flushleft environment

Post by Stefan Kottwitz »

For example:

Code: Select all

\noindent x direction:
\begin{align}
  &T_{1x}+T_{2x}=0 \\
  &-T_{1}\cos\theta_{1}+T_{2}\cos\theta_{2}=0
\end{align}
Don't use a flushleft environment, this is for text, not for math.
You could also use two equation environments.

While setting \mathindent to 0pt removes indentation of math environments, \noindent removes indentation of text.

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

Re: aligning text with first equation in flushleft environme

Post by ghostanime2001 »

How can I set those two equations to be right-aligned? like with the flushleft effect? And what happened to aligning the top equation as a block with the text?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

aligning text with first equation in flushleft environment

Post by Stefan Kottwitz »

Right aligning can also be done with a flalign environment:

Code: Select all

\begin{flalign*}
  &&T_{1x}+T_{2x}=0 \\
  &&-T_{1}\cos\theta_{1}+T_{2}\cos\theta_{2}=0
\end{flalign*}
Stefan
LaTeX.org admin
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: aligning text with first equation in flushleft environme

Post by ghostanime2001 »

I'm still not getting a way to put x direction with the two equations. What is the code for right aligning?
Post Reply