Math & ScienceIndentation in math mode

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Dick Justice
Posts: 2
Joined: Thu Mar 10, 2011 1:10 pm

Indentation in math mode

Post by Dick Justice »

Hello forum,

I'm writing a paper in Latex containing excerpts from ProLog code. The paper that I'm writing is about to be merged with a much bigger paper where all predicates are written in a pseudocode-like form:

Code: Select all

head<--
  rule1, 
  rule2,
  ...,
  ruleN.
Which means that I need \leftarrow, which is only available in math mode. However, even though I am able to insert line breaks wherever I like, I am unable to obtain the initial spacing I require so that "ruleX" is indented in the way that I sketch above. I have tried \quad, \qquad, \hspace{} and the like, but to no avail. All forum posts that I have searched tend to specify examples where horizontal spacing techniques are applied to the equation environment, which is of no use to me.

Any tips? Thanks
Last edited by Dick Justice on Thu Mar 10, 2011 8:42 pm, edited 1 time in total.

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Indentation in math mode

Post by gmedina »

Hi,

Why don't you use some of the verbatim capabilities of LaTeX? Something along these lines:

Code: Select all

\documentclass{article}
\usepackage{fancyvrb}

\DefineShortVerb{\|}

\begin{document}

|head|$\leftarrow$ \\
|     rule1,|\\
|     rule2,|\\
|     ...,| \\
|     ruleN.|

\end{document}
The listings package could offer you even more flexibility.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Dick Justice
Posts: 2
Joined: Thu Mar 10, 2011 1:10 pm

Re: Indentation in math mode

Post by Dick Justice »

Thanks a lot for your input. As it turns out, the people I work with had already design an environment based on \arraycolsep with aim just to address the problem of flexibility with spacing in math mode.

I will use verbatim when I need more flexibility, though.

Marking this solved.
Post Reply