I am using the gather environment to write the equations for my report. By default, the gather environment centers equations. For example, if I write:

Furthermore, in a Markov chain, it is assumed that transitional 
probabilities are *stationary*. Meaning, the probability of a 
future outcome will always have the same probability, given the present.
Pr\{X_1=j | X_0=i\} = Pr\{ X_{n+1}=j | X_n=i \}

Then, the outcome will be:

enter image description here

I am required however to not center my equations, but instead place them after 1 indentation only. Like this (achieved with Word):

enter image description here

How can I do this in LaTeX?

  • 2
    Since you're already loading the amsmath package (in order to use the gather environment), all you have to do now is load that package with the option fleqn. – Mico Apr 19 '20 at 11:50
  • Could you give me more details, please? Where should I be writing fleqn exactly? – Aziz Apr 19 '20 at 12:02
  • 1
    Please see the answer I just posted. To load the amsmath package with the option fleqn, one should write \usepackage[fleqn]{amsmath}. – Mico Apr 19 '20 at 12:06

Some comments and observations:

  • Since you're loading the amsmath package anyway (in order to use the gather environment), all you have to do now in order to achieve your formatting objective is to load that package with the option fleqn ("flush left equations"):

  • The amount of indentation of a flush-left equation from the left-hand margin is controlled by the parameter \mathindent. The default value of this parameter is 25pt minus 25pt, i.e., it's a so-called "rubber" length. (Here with some possibility for shrinkage, but not for expansion.)

    To change the value of this parameter to, say, 1em, all you need to do is execute the instruction

  • It's considered poor LaTeX form to use gather -- or, for that matter, align -- environments for single-line displayed equations. Do use the equation environment for single-line equations.

  • Don't enter the symbol | directly to denote "conditional on". Instead, please use the macro \mid, which is programmed to insert a bit of whitespace on both sides of |.

  • Since "Pr" denotes "probability" (unless I'm very badly mistaken...), consider writing \Pr instead of just Pr. The \Pr macro typesets the letters "Pr" using upright roman characters, which is considered (from a typographic point of view) to be desirable for math operators. (Other examples of LaTeX math operators are \log, \exp, \sin, lim, and \det.)

enter image description here

\usepackage{showframe} % to indicate margins
\begin{gather} % not elegant
Pr\{X_1=j | X_0=i\} = Pr\{ X_{n+1}=j | X_n=i \}

%% 3 differences from above: 
%% (a) use 'equation' env.; (b) use \Pr; (c) use \mid.
\Pr\{X_1=j \mid X_0=i\} = \Pr\{ X_{n+1}=j \mid X_n=i \}
  • 1
    This is such a detailed and brilliant answer, full of great pieces of advice. Everything you said was correct. Thank you very much! I will follow all of them. I only started learning LaTeX last November and did not expect to be writing my thesis using it, but here I am. Thank you again. – Aziz Apr 19 '20 at 12:17
  • 1
    @Aziz - Many thanks for letting me know that you found my additional comments useful. Good luck and best wishes with your thesis. – Mico Apr 19 '20 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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