7

I use {align*} a lot, it seems that the block of {align*} are automatically centered. How could I shift the block towards the left margin to some spaces? (I.e. not all the way to left, but just some spaces towards left.)

It is different from here.

  • It's not really clear why you want this in the first place. Can you explain? – egreg Dec 5 '14 at 22:32
  • I need it because after the second text (heading) the use of align* doesn't properly centers the equation or it seems that equation is way too right. That's why I want to shift it a little left of my choice. – kaka Dec 5 '14 at 22:50
  • An example would be useful. – egreg Dec 5 '14 at 22:55
  • \textbf{Detection Problem} \begin{align*} \mathcal{H}_0: \textbf{y}[n]&=\textbf{w}[n], && n=1, \cdots N,\\ \end{align*} where; \textbf{x}[n] represents primary user signal, \textbf{w}[n] is additive zero-mean. \\~\\ \textbf{For simplicity of notation} \begin{align*} \mathcal{H}_0: \textbf{y}&=\textbf{w}, \hspace*{2.0cm}\\ \mathcal{H}_1: \textbf{y}&=\textbf{x}+\textbf{w}. \end{align*} \\~\\ where; $\textbf{w} \sim \mathcal{N}(\textbf{0}, \sigma^2\textbf{I} )$ \end{frame} – kaka Dec 5 '14 at 23:41
8

You can add additional space to the right hand side of the equation via \hspace:

enter image description here

Code:

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

\begin{document}
\noindent
This is centered:
\begin{align*}
a &=b
\end{align*}
Adding a \verb|\hspace{2.0cm}| to right hand side:
\begin{align*}
a &=b \hspace{2.0cm}
\end{align*}
\end{document} 
  • note that you can also add negative space before the equation instead of adding after, also if there are several lines you need to do it for each line. – YannickSSE Jul 18 '18 at 6:25
5

mathtools provides \MoveEqLeft[<number>] for this. Put the macro at the end of first line.

\documentclass[12pt]{article}
\usepackage{mathtools}

\begin{document}
    \begin{align*}
     x &=  x_ot+v_ot+\frac{1}{2}at^2 \\
    v &= v_ot+at \\
    v^2 &= v_o^2+2a \Delta x
    \end{align*}
    \begin{align*}
     x &=  x_ot+v_ot+\frac{1}{2}at^2 \MoveEqLeft[1]\\
    v &= v_ot+at \\
    v^2 &= v_o^2+2a \Delta x
    \end{align*}
\end{document}

enter image description here

  • It's probably better to use \tfrac instead of \frac in the first of the three rows. – Mico Dec 4 '14 at 7:08
  • That is a bit misuse of \MoveEqLeft, though I do not understand the OPs intention with the question. – daleif Dec 4 '14 at 8:32

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.