0

I want to space some texts horizontally but I want all of them to be aligned equally even if they are unequal. This is what I mean:

Instead of:

A    Hallo
AB    Hallo
ABC    Hallo

I would like to have:

A    Hallo
AB   Hallo
ABC  Hallo

In other words, I want "Hallo" to always be aligned equally vertically. Easiest and best way to do this?

  • You can use a tabular with {@{}ll@{}} to lose the extra space on the left and right. – John Kormylo Apr 30 '16 at 12:41
  • @JohnKormylo: I can't see a tabular or array here ;-) – user31729 Apr 30 '16 at 12:48
  • @ChristianHupfer -- would tabbing avoid your objections? – barbara beeton Apr 30 '16 at 12:53
  • @barbarabeeton: Of course it would -- the code is invisible, an Enigma ;-) – user31729 Apr 30 '16 at 12:57
  • verbatim is also an option. – John Kormylo Apr 30 '16 at 13:03
0

What do you think of this?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}

\begin{document}

\begin{description} [font=\normalfont, labelwidth=2cm, leftmargin=\dimexpr\labelwidth + \labelsep, nosep]%
  \item[A] Hallo. Hallo. Hallo. Hallo. Hallo. Hallo. Hallo. Hallo. Hallo. Hallo. Hallo. Hallo.

  \item[AB] Hallo
  \item[ABC] Hallo

\end{description}

\end{document} 

enter image description here

|improve this answer|||||
  • Perfect. That is what I was looking for, thanks! – Enigma Apr 30 '16 at 14:51
  • You're welcome. Beware this code supposes the first ‘column’ is one-line long. – Bernard Apr 30 '16 at 14:54

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.