Left alignment not working on array environment
If you want all you equations to be left-aligned, then as Bernard says, you can use:
\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
$t_n(x)$ is a function that truncates $x$ to the $n$-th digit
\begin{equation*}
t_n (x) \equiv \left\lfloor \frac{x}{10^n} \right\rfloor 10^n % This should be on the left
\end{equation*}
\end{document}
If you want just a single equation flushed left then you can use
\documentclass{article}
\usepackage[fleqn]{nccmath}
\begin{document}
$t_n(x)$ is a function that truncates $x$ to the $n$-th digit
\begin{fleqn}
\begin{equation*}
t_n (x) \equiv \left\lfloor \frac{x}{10^n} \right\rfloor 10^n % This should be on the left
\end{equation*}
\end{fleqn}
\end{document}
as explained in the answer to another question.
* EDIT *
In response to Bernard's comment, you can set the indentation distance as an optional argument to \begin{fleqn}
, e.g. \begin{fleqn}[1in]
.
Related videos on Youtube
Nada F.
Maths enthusiast, student of philosophy at the University of Buenos Aires. Languages: ES/EN Pronouns: they/them Some of my main areas of interest, in no specific order: mathematical logic, set theory, category theory, philosophy of language, critical theory, medieval philosophy, linguistics.
Updated on August 01, 2022Comments
-
Nada F. over 1 year
I'm writing some math(s) stuff and wanted the equations to be on the left side of the document using the
array
environment insideequation*
, but for some reason it doesn't seem to work. Here is the code:\usepackage{amsmath} \begin{document} $t_n(x)$ is a function that truncates $x$ to the $n$-th digit \begin{equation*}\begin{array}{l} t_n (x) \equiv \left\lfloor \frac{x}{10^n} \right\rfloor 10^n % This should be on the left \end{array}\end{equation*} \end{document}
My other packages are
relsize
,amsfonts
andutf8 inputenc
(maybe they are interfering or something like that?) and I'm using Overleaf as my online compiler.Thanks, M.T.
-
Bernard about 7 yearsWelcome to TeX SX! You misunderstood the use the option
l
in array: each row of the array will be left-alignedw.r.t. the array
, but rhe array itself will centred. To get what you want, either use thefleq
option of your document class (all equations will be aligned on the left), or, for a punctual usage, use thefleqn*
environment, fromamsmath
. -
Nada F. about 7 years@Bernard I tried with
\documentclass[fleq]{article}
, but the following error appeard:LaTeX Warning: Unused global option(s): [fleq].
and thefleqn*
environment is undefined (yes, I'm usingamsmath
) -
Bernard about 7 yearsThere was a typo in the option: it should have been
[fleqn]
. Sorry for not having checked. For the environmentsfleqn(*)
, I'm surprised: are you sure amsmath was loaded when you used the environment?
-
-
Nada F. about 7 yearsOk, I wanted it to work on single equations maintaining the
array
environment, but you can't always get what you want... -
Bernard about 7 years@JPi: I had forgotten the
fleqn
environment. Thanks for reminding me! You might want to mention it accepts the distance to the text left margin (\displayindent
) as an optional argument. -
JPi about 7 years@MassimilianoTron: you can still stick an array environment inside the
equation*
environment. It just seemed redundant given that you only had a single formula andarray
is used for a matrix of expressions.