1

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.

3
  • 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.
    – Bernard
    Commented Sep 5, 2016 at 1:21
  • @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)
    – Nada F.
    Commented Sep 5, 2016 at 1:36
  • 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?
    – Bernard
    Commented Sep 5, 2016 at 8:28

1 Answer 1

1

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

3
  • Ok, I wanted it to work on single equations maintaining the array environment, but you can't always get what you want...
    – Nada F.
    Commented Sep 5, 2016 at 2:03
  • 1
    @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.
    – Bernard
    Commented Sep 5, 2016 at 8:44
  • @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.
    – JPi
    Commented Sep 5, 2016 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .