Text FormattingCenter align left

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Philosophaie
Posts: 17
Joined: Sat Mar 21, 2015 8:59 pm

Center align left

Post by Philosophaie »

This works:

Code: Select all

\noindent    $\text{If }M \leq  2 \text{ Then}$\\
\indent\indent$\text{     y = Y - 1}$\\
\indent\indent    $\text{     m = M + 12}$\\
    $\text{Else}$\\
\indent\indent    $\text{    y = Y}$\\
\indent\indent    $\text{    m = M}$\\
    $\text{End If}$\\
but I want it centered and aligned to the left:

Code: Select all

\begin{center}
\begin{??align left??}
\noindent    $\text{If }M \leq  2 \text{ Then}$\\
\indent\indent$\text{     y = Y - 1}$\\
\indent\indent    $\text{     m = M + 12}$\\
    $\text{Else}$\\
\indent\indent    $\text{    y = Y}$\\
\indent\indent    $\text{    m = M}$\\
    $\text{End If}$\\
\end{??align left??}
\end{center}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Center align left

Post by Johannes_B »

Please always post minimal working examples.

There are several packages that help in typesetting algorithms. http://ctan.org/topic/pseudocode
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply