2

The purpose of this question is colleting the exhaustive information about text alignment in tabular environment and it's derivatives.

As base, let us use the possibilities of Microsot Word's tools. The picture bellow is the text alignment tools for table cells.

Cell alignment tools in Microsoft Word

  • The first row of tools matrix (yellow row) are equivalent to tabular's l, c and r handles. However, this specification don't allow to define the fix width of the column.
  • The first column of tools matrix (green column) are equivalent to tabular's p{w}, m{w}, b{w}. However, it's not working, as shown on figure bellow:

The failure of the **m{w}** specification

\begin{tabular}{|m{10mm}|m{30mm}|m{50mm}|m{20mm}|} \hline
  \huge{A} & O'K Here & \footnotesize{I don't want ...} &  \\ \hline
  \huge{B} & O'K Here & \footnotesize{I don't want ...} &  \\ \hline
\end{tabular}
  • Next, it's hard to find the solution for really simple procedure- the simultaneous horizontal and vertical alignment (red tool is first figure). I've tried to use \makebox inside the cell:

    \begin{tabular}{|m{10mm}|m{30mm}|m{50mm}|m{20mm}|} \hline
    \makebox[10mm][c]{\huge{A}} & O'K Here & \footnotesize{I don't want ...} &  \\ \hline
    \huge{B} & O'K Here & \footnotesize{I don't want ... } & \bigstrut \\ \hline
    \end{tabular}
    

The result is not ideal, but acceptable:

enter image description here

So, please, answer the next questions.

  1. What is the fix-length versions of l, c and r specification?
  2. Why the m{w} specification do not provide the center vertical alignment as shown on second figure?
  3. Is there the most compact solution for simultaneous horizontal and vertical alignment than my? For example, new column type?
  4. For Exhaustive Information, please teach how to create remain column type of fix width, which are not colored in first figure.
  5. Also, what is the solution for combining multiple columns type (e. g. p{w} and m{w})? As you know, if to create the table like this, it's will not be desired vertical alignment:

    \begin{center}\begin{tabular}{|p{30mm}||p{20mm}|m{20mm}|b{20mm}|} \hline No desired alignment

Sorry for long querstion, everyone. I Hope, one day this info helps you too.

1 Answer 1

6

I think really it's a mistake to try to make a one-one mapping of the alignment specifiers (with either Word or HTML) as the underlying table models are fundamentally different.

However I think the main problem is that your first comment isn't really correct:

The first row of tools matrix (yellow row) are equivalent to tabular's l, c and r handles. However, this specification don't allow to define the fix width of the column.

The l c r are singe line table fields. The alignments that you show in the screenshot are all paragraph justification options so they correspond to \raggedleft \centering and \raggedright either entered directly at the start of a table cell or via the >{\centering}p{2cm} preamble syntax of the array package.

Not really related but size commands do not take an argument so \footnotesize{I don't want ...} is the same as \footnotesize I don't want ...

What is the fix-length versions of l, c and r specification?

See above. >{\centering}p{...}

Why the m{w} specification do not provide the center vertical alignment as shown on second figure?

m puts the reference point of the cell in the vertical centre of the cell contents as shown in your image.

Is there the most compact solution for simultaneous horizontal and vertical alignment than my? For example, new column type?

Yes, see above.

For Exhaustive Information, please teach how to create remain column type of fix width, which are not colored in first figure.

This seems to be a repeat of the earlier question? >{\centering}p{...}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .