Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to have some math not centered but left aligned. So I found on this site various answers that pointed me to this:

\documentclass{article}
\usepackage{showframe}
\usepackage{amsmath}
\begin{document}
\begin{flalign*}
1+1=2  &&
\end{flalign*}
\end{document}

However I also would like the left aligned math to be indented by \parindent, how could I do that without loading fleqn as a general option?

share|improve this question
2  
Welcome to TeX.SX! –  Claudio Fiandrino Dec 7 '13 at 13:25
    
Is there any reason for not using the option fleqn? –  Ch'en Meng Dec 7 '13 at 13:31
    
@Ch'enMeng because only some math should be left aligned, not all. –  BeeGirl Dec 7 '13 at 13:37
3  
@HenriMenke that is not the same issue since the OP is using fleqn, while I said I don't want to –  BeeGirl Dec 7 '13 at 13:54
2  
@Closers this question is different from the one linked as a duplicate since here the OP wants both centered and left-aligned equations. –  karlkoeller Dec 7 '13 at 15:41
show 7 more comments

2 Answers 2

up vote 6 down vote accepted

Remarks

You can indent your flalign by using the definition of flalignfrom amsmath.sty and modifiying it to your liking, e.g. inserting \hskip\parindent.

Implementation

\documentclass{article}
\pagestyle{empty} % for cropping
\newcommand\shortlipsum{
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
    vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
    mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.\par
} % Filltext
\usepackage{amsmath}
\makeatletter
\newenvironment{shiftedflalign}{%
    \start@align\tw@\st@rredfalse\m@ne%
    \hskip\parindent
}{%
    \endalign
}
\newenvironment{shiftedflalign*}{%
    \start@align\tw@\st@rredtrue\m@ne
    \hskip\parindent
}{%
    \endalign
}
\makeatother
\begin{document}

\shortlipsum
\begin{flalign}
    1+1=2  &&
\end{flalign}
\shortlipsum
\moveright\parindent\vbox{%
\begin{flalign}
    1+1=2  &&
\end{flalign}
}
\shortlipsum
\begin{shiftedflalign}
    1+1=2  &&
\end{shiftedflalign}
\shortlipsum

\begin{flalign*}
    1+1=2  &&
\end{flalign*}
\shortlipsum
\begin{shiftedflalign*}
    1+1=2  &&
\end{shiftedflalign*}
\shortlipsum

\end{document}

Output

enter image description here

share|improve this answer
    
ok, this is it. Could you point out to a question that describes the differences between the various math environments? Also a resource online, not necessarily on this site. Thanks –  BeeGirl Dec 7 '13 at 15:14
1  
@BeeGirl The mathmode manual by Herbert Voß describes all the important things. –  Henri Menke Dec 7 '13 at 16:08
    
@HenriMenke Can you remove the superfluous % in \newenvironment{shiftedflalign}? It caused me to question why that was not in \newenvironment{shiftedflalign*}. –  Sean Leather Jun 25 at 9:23
    
As an aside, you can use \mathindent (see LaTeX/Advanced Mathematics) instead of \parindent to get the normal indentation used by fleqn. –  Sean Leather Jun 25 at 9:26
add comment

A very simple method.

We define a new command

\newcommand{\mathleft}{\@fleqntrue\@mathmargin\parindent}

to simulate the option fleqn with \parindent indenting, and a new command to restore the normal behavior

\newcommand{\mathcenter}{\@fleqnfalse}

So, add the following lines in the preamble

\makeatletter
\newcommand{\mathleft}{\@fleqntrue\@mathmargin\parindent}
\newcommand{\mathcenter}{\@fleqnfalse}
\makeatother

and issue \mathleft before and \mathcenter after the math stuff you want left aligned with \parindent.

You can use this solution with all math environments without redefining any of them.

MWE

\documentclass{article}
\usepackage{showframe}
\usepackage{amsmath}

\makeatletter
\newcommand{\mathleft}{\@fleqntrue\@mathmargin\parindent}
\newcommand{\mathcenter}{\@fleqnfalse}
\makeatother

\begin{document}

\mathleft
\begin{equation}
1+1=2
\end{equation}
\mathcenter

Indented paragraph

\begin{equation}
1+1=2
\end{equation}

Indented paragraph

\end{document} 

Output

enter image description here

share|improve this answer
    
this works also, thanks –  BeeGirl Dec 7 '13 at 16:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.