# Is there a way to left align a simple equation without juggling spaces with hspace?

Here’s an example of an equation I’m trying to align (I have lots throughout my 50-page NT paper):

$$\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\ldots \hspace{9.5cm}$$


I want to be able to get rid of the hspace.

It’d be really frustrating if all LaTeX has is this hspace thingy plus manual trial-and-error adjustments. And no, I don’t want to default left-alignment for all equations across the document, no.

Here’s my settings:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{indentfirst}
\usepackage[superscript]{cite}


Here’s the codes that are creating the centered formatting:

$\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\ldots$

\begin{flalign*}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\ldots
\end{flalign*}


I'm editing this question, so @egreg sees my code, which is not working to create equation numbering:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{nccmath}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{indentfirst}
\usepackage[superscript]{cite}
\usepackage{geometry}
\geometry{top=15mm,left=15mm}

\newenvironment{eqleft*}
{\begin{equation*}}
{\hspace{10000pt minus 1fil}\end{equation*}
\ignorespacesafterend}

\begin{document}
\begin{eqleft*}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\dotsb
\end{eqleft*}

\begin{ceqn}
\begin{align} \label{eq:eq:k_div_n_closed}
A=\sum_{j=1}^{k}\tan{\frac{2\pi nj}{k}}
\end{align}
\end{ceqn}\\
\indent The above summation can be rewritten as a closed-form as follows:

\end{document}


First issue

Second issue

For a single left aligned equation (that is, not using fleqn), you can exploit flalign*, with more than one column.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum} % for context

\begin{document}

\lipsum*[4]
\begin{flalign*}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\dotsb &&&
\end{flalign*}
\lipsum[5]

\end{document}


Note \dotsb rather than \ldots.

Actually, you can do it with \hspace and no guessing:

$\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\dotsb \hspace{10000pt minus 1fil}$


would do. See https://tex.stackexchange.com/a/348745/4427

It's better, however, to define a proper environment:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum} % for context

\newenvironment{eqleft}
{\begin{equation*}}
{\hspace{10000pt minus 1fil}\end{equation*}}

\begin{document}

\lipsum*[4]
\begin{eqleft}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\dotsb
\end{eqleft}
\lipsum[5]

\end{document}


The output is the same.

If you also want to be able to add equation numbers, define eqleft and eqleft*:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum} % for context

\newenvironment{eqleft}
{$$\hspace{0pt}} {\hspace{10000pt minus 1fil}$$\ignorespacesafterend}
\newenvironment{eqleft*}
{\begin{equation*}}
{\hspace{10000pt minus 1fil}\end{equation*}\ignorespacesafterend}

\begin{document}

\lipsum*[4]
\begin{eqleft*}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\dotsb
\end{eqleft*}
\lipsum*[5]
\begin{eqleft}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\dotsb
\end{eqleft}
\lipsum[6]

\end{document}


• Using that creates a problem, which is the equation numbers disapper. I want to replace begin{equation} with flalign but keep the equation numbers. – user168592 Aug 17 '18 at 17:13
• @JRS. Didn't I answer the question in the edit? Not with equation, of course, but this should not be a problem. Please, avoid comments in all caps or boldface. – egreg Aug 17 '18 at 17:53
• Your new code to add equation number doesn't work – user168592 Aug 17 '18 at 18:42
• And the visual pollution of the latin texts doesn't help either. – user168592 Aug 17 '18 at 18:42
• @JRS. I see the expected equation number. – egreg Aug 17 '18 at 19:10

Check the following code, it should produce the desired result

\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{indentfirst}
\usepackage[superscript]{cite}

\begin{document}

$\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\ldots$

\begin{flalign*}
\frac{5x^2}{4}+\frac{17x^4}{16}+\frac{65x^6}{64}+\frac{257x^8}{256}+\ldots
\end{flalign*}

\end{document}

• Welcome to TeX.SX! Could you please explain your changes to the document by the OP (seemingly you only added fleqn)? – TeXnician Aug 17 '18 at 5:52
• @Shashikr08 Hey – user168592 Aug 17 '18 at 17:34