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.

My attempt was to use tabular:

\begin{tabular}{cccc}
   Let & $M_1$ recognize $A_1$, where $M_1 = (Q_1, \Sigma, \delta_1, q_1, F_1)$, & \\
   & $M_2$ recognize $A_2$, where $M_1 = (Q_2, \Sigma, \delta_2, q_2, F_2)$. &
\end{tabular}

However, there are several spaces between Let and M_1, how could I get rid of these spaces? Furthermore, is this a standard way to align text? If I want to be the most flexible, i.e. editing on the fly, which approach should I use?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

There are many ways of doing this, and it depends on your preference, or even how big of a structure you are working with. For example, still using tabular, you could consider using

\begin{tabular}{*{3}{@{}l@{\ }}}
  Let & $M_1$ recognize $A_1$, & where $M_1=(Q_1,\Sigma,\delta_1,q_1,F_1)$, \\
  & $M_2$ recognize $A_2$, & where $M_1=(Q_2,\Sigma,\delta_2,q_2,F_2)$.
\end{tabular}

This creates 3 identical, left-aligned columns (via *{3}{..l..}), where each column has the formatting @{}l@{\ }. This formatting adds a regular space {\ } between columns, and remove the column separation at the beginning of each column (via @{}).

Horizontal alignment of stuff


Alternatively you could use boxes (and other structures) to align text components. Here's an example:

\usepackage{calc}%
...
Let $M_1$ recognize $A_1$, where $M_1=(Q_1,\Sigma,\delta_1,q_1,F_1)$, \\
\phantom{Let} $M_2$ recognize \makebox[\widthof{$A_1$}][c]{$A_2$}, where $M_1=(Q_2,\Sigma,\delta_2,q_2,F_2)$.

Although somewhat superfluous, I hope it demonstrates the principle. You can use

\phantom{<stuff>}

to typeset a box exactly the size of <stuff>, without actually typesetting <stuff> itself. Also, using the calc package, you can define boxes of specific width using \widthof{<stuff>} in conjunction with

\makebox[<width>][<horizontal alignment>]{<stuff>}

I'm sure there are other (perhaps more elegant) ways as well.

share|improve this answer
    
Many thanks for a very detailed solution ;). –  Chan Jul 29 '11 at 5:03
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.