Left alignment not working on array environment

1,461

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].

Share:
1,461

Related videos on Youtube

Nada F.
Author by

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, 2022

Comments

  • Nada F.
    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 inside equation*, 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 and utf8 inputenc (maybe they are interfering or something like that?) and I'm using Overleaf as my online compiler.

    Thanks, M.T.

    • Bernard
      Bernard about 7 years
      Welcome to TeX SX! You misunderstood the use the option l in array: each row of the array will be left-aligned w.r.t. the array, but rhe array itself will centred. To get what you want, either use the fleq option of your document class (all equations will be aligned on the left), or, for a punctual usage, use the fleqn* environment, from amsmath.
    • Nada F.
      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 the fleqn* environment is undefined (yes, I'm using amsmath)
    • Bernard
      Bernard about 7 years
      There was a typo in the option: it should have been [fleqn]. Sorry for not having checked. For the environments fleqn(*), I'm surprised: are you sure amsmath was loaded when you used the environment?
  • Nada F.
    Nada F. about 7 years
    Ok, I wanted it to work on single equations maintaining the array environment, but you can't always get what you want...
  • Bernard
    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
    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 and array is used for a matrix of expressions.