5

i have three equations with number (reference) that i want to left align.

\documentclass[journal]{IEEEtran} 
\usepackage{cite} 
\usepackage{graphicx} 
\usepackage[labelfont=bf, figurename=Figure, font=small]{caption} \usepackage[subrefformat=parens, labelformat=parens, font=small]{subfig} \usepackage{url} 
\usepackage{textcomp} 
\usepackage{hyperref} 
\usepackage{microtype} 
\usepackage[dont-mess-around]{fnpct} 
\usepackage[misc]{ifsym} 
\usepackage[depth=subsubsection]{bookmark} 
\usepackage{booktabs} 
\usepackage{makecell} 
\usepackage{etoolbox} 
\usepackage{authblk} 
\usepackage{hhline} 
\usepackage{multirow} 
\usepackage{xparse} 
\usepackage{cleveref} 

\begin{document}
\begin{equation}\label{eq1}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}

\begin{equation}\label{eq2}
\frac{d}{dx}r^n=nx^{n-1}
\end{equation}

\begin{equation}\label{eq3}
Length=\int_{a}^{b}\sqrt{[f't]^2+[g't]^2}dt
\end{equation}
\end{document}

By default, the equations are center aligned. How can i make them left aligned? I already tried \begin{flalign}...\end{flalign}, \begin{aligned}...\end{aligned} with [fleqn] it did not work for me. Any help will be highly appretiated.

Raja Ayaz
  • 133
  • 1
  • 3
  • 10
  • @bmv I already tried that, didn't work for me – Raja Ayaz Dec 27 '17 at 18:44
  • please show small but complete document. we need to see used preamble (ONLY TO Math related packages). also let us know, if all equation should be left aligned or just this three. – Zarko Dec 27 '17 at 18:51
  • @Zarko I am using no Math related packages, there was no need. And I need all equations left aligned. Equations are centered by default in LaTeX so I guess preamble doesn't has to do anything with equations being centered because its LaTeX default behavior. – Raja Ayaz Dec 27 '17 at 18:56
  • if we not know, what you use, then we cant help you. please consider my previous comment. help us to help you! – Zarko Dec 27 '17 at 18:57
  • @Zarko \documentclass[journal]{IEEEtran} \usepackage{cite} \usepackage{graphicx} \usepackage[labelfont=bf, figurename=Figure, font=small]{caption} \usepackage[subrefformat=parens, labelformat=parens, font=small]{subfig} \usepackage{url} \usepackage{textcomp} \usepackage{hyperref} \usepackage{microtype} \usepackage[dont-mess-around]{fnpct} \usepackage[misc]{ifsym} \usepackage[depth=subsubsection]{bookmark} \usepackage{booktabs} \usepackage{makecell} \usepackage{etoolbox} \usepackage{authblk} \usepackage{hhline} \usepackage{multirow} \usepackage{xparse} \usepackage{cleveref} – Raja Ayaz Dec 27 '17 at 19:01
  • @RajaAyaz, this you should add to your question ... this time i will do this for you. – Zarko Dec 27 '17 at 19:03
  • @Zarko, this is my entire preamble. After this is immediately \begin{document}, is this of any help please? – Raja Ayaz Dec 27 '17 at 19:04
  • Thank you for moving preamble to question @Zarko. I will remember to do so next time. – Raja Ayaz Dec 27 '17 at 19:06
  • @RajaAyaz, not really. you ask me that i need to recreate your document from your code fragments ... and your question is not very clear. are all equation should be left aligned? are shoved equation follows one after another? – Zarko Dec 27 '17 at 19:08
  • @Zarko, i cannot post a picture of the scenario otherwise i would have. The three equations are in three lines, each with an equation number. The equation numbers are all right aligned as they should, but the equations are not left aligned. they start somewhere in the middle of the line. i wanted them left-aligned. – Raja Ayaz Dec 27 '17 at 19:14
  • 1

2 Answers2

3

Sorry, but your question is not very clear, so the following solutions are based on pure guessing:

\documentclass[journal]{IEEEtran}
\usepackage{nccmath}

\usepackage{lipsum} % for generating dummy text, not use in real document

\begin{document}
\lipsum[11]
\begin{align}
            x   & = \frac{-b\pm\sqrt{b^2-4ac}}{2a}          \label{eq1} \\
\frac{d}{dx}r^n & = nx^{n-1}                                \label{eq2} \\
\mathrm{Length} & = \int_{a}^{b}\sqrt{[f't]^2+[g't]^2}dt    \label{eq3}
\end{align}
or
\begin{fleqn}
\begin{equation}\label{eq1}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}

\begin{equation}\label{eq2}
\frac{d}{dx}r^n=nx^{n-1}
\end{equation}

\begin{equation}\label{eq3}
Length=\int_{a}^{b}\sqrt{[f't]^2+[g't]^2}dt
\end{equation}
\end{fleqn}
\lipsum[11]

\end{document}

which gives :

enter image description here

or in case that all equations in your document should be left aligned:

\documentclass[journal]{IEEEtran}
\usepackage[fleqn]{amsmath}

\usepackage{lipsum} % for generating dummy text, not use in real document

\begin{document}
\lipsum[11]
 \begin{equation}\label{eq1}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}

\begin{equation}\label{eq2}
\frac{d}{dx}r^n=nx^{n-1}
\end{equation}

\begin{equation}\label{eq3}
Length=\int_{a}^{b}\sqrt{[f't]^2+[g't]^2}dt
\end{equation}
or     
\begin{gather}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}            \label{eq1} \\
\frac{d}{dx}r^n=nx^{n-1}                    \label{eq2} \\
Length=\int_{a}^{b}\sqrt{[f't]^2+[g't]^2}dt \label{eq3}
\end{gather}
\lipsum[11]

\end{document}

which gives:

enter image description here

edit (1): If you will use a solution with fleqn environment, then you can set the indentation of equations by environment option (see [Bernard's][3] comment below). For example, for indentation of 2em:

\begin{fleqn}[2em]    
\begin{gather}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}            \label{eq1} \\
\frac{d}{dx}r^n=nx^{n-1}                    \label{eq2} \\
Length=\int_{a}^{b}\sqrt{[f't]^2+[g't]^2}dt \label{eq3}
\end{gather}
\end{fleqn}

will move left border of equations for 2em to right,

edit (2): As Barbara Beeton pointed in her comment below, the use of gather environments has advantages over use of separated equations. You can compare results in the second example (observe spacing between equations). If a page or column break is needed, amsmath provides \allowdisplaybreak command.

For more information about use of amsmath packages see (new) short math guide.

Zarko
  • 296,517
  • Thank you very much @Zarko, that's exactly what I wanted. You solved the problem, highly appreciated, thanks dearie :) – Raja Ayaz Dec 27 '17 at 19:29
  • Note the fleqnaccepts an optional argument – the indentation of the group of equations from the left margin (0pt by default). – Bernard Dec 27 '17 at 19:34
  • @Bernard, thank you for remind me on this. however, i don't know which of provided solutions op will use. so i decided to not confuse him with this ... – Zarko Dec 27 '17 at 19:44
  • @Zarko I used \begin{fleqn}...\end{fleqn} and it worked like a charm. Thanks again :) – Raja Ayaz Dec 27 '17 at 19:48
  • @RajaAyaz, ok, than i will add Bernard comment to my answer. – Zarko Dec 27 '17 at 19:49
  • might be worth mentioning that a multi-line environment (like gather) results in better/more consistent vertical spacing than separate equations. if a page break is needed, amsmath provides \allowdisplaybreak. (search for this command in answers to other questions, or to the amsmath users guide for details.) – barbara beeton Dec 27 '17 at 22:52
  • @barbarabeeton, thank you for editing my answer. in answer are both examples, but i didn't emphasize by words the advantages of use gather environment. i will edit my answer. – Zarko Dec 27 '17 at 23:20
1

The flalign environment works, but you have to create at least a second column with an &:

\documentclass[journal]{IEEEtran}
\usepackage{cite}
\usepackage{graphicx}
\usepackage[labelfont=bf, figurename=Figure, font=small]{caption}
\usepackage[subrefformat=parens, labelformat=parens, font=small]{subfig}
\usepackage{url}
\usepackage{textcomp}
\usepackage{hyperref}
\usepackage{microtype}
\usepackage[dont-mess-around]{fnpct}
\usepackage[misc]{ifsym}
\usepackage[depth=subsubsection]{bookmark}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{etoolbox}
\usepackage{authblk}
\usepackage{hhline}
\usepackage{multirow}
\usepackage{xparse}
\usepackage{cleveref}
\usepackage{lipsum}
\usepackage{nccmath}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}

\begin{document}

\lipsum[11]

  \begin{flalign}\label{eq1}
    & x =\frac{-b±\sqrt{b²-4ac}}{2a} & \\
    \label{eq2}
     & \frac{d}{dx}r^n =nx^{n-1} \\
     \label{eq6}
    & \text{Length} =∫_{a}^{b}√{[f't]²+[g't]²}\,dt
  \end{flalign}

Or even with the $ = $ signs aligned:

  \begin{flalign}\label{eqa1}
    x & =\frac{-b±\sqrt{b²-4ac}}{2a} & \\
    \label{eqa2}
    \frac{d}{dx}r^n & =nx^{n-1} \\
    \label{eqa6}
    \text{Length} & =∫_{a}^{b}√{[f't]²+[g't]²}\,dt
  \end{flalign}

\end{document} 

enter image description here

Bernard
  • 271,350