# Text alignment within a minipage

I want to create three rows of text. Each should start at the same distance from the left of the page. But that distance isn't just where the left margin ends; instead, the text should be centered in the middle of the page.

To try to achieve this, I tried the following:

\noindent\makebox[\textwidth][c]
{\begin{minipage}{0.5\textwidth}
\Large
Alpha\\
\vspace{2mm}
Beta\\
\vspace{2mm}
Gamma\\
\end{minipage}}


But this gave me the following output:

I have two questions:

1) Why are the three rows not aligned?

2) Changing the value of the vspace between Alpha and Beta actually only affects the gap between Beta and Gamma. Hence, the gaps between the three rows are not equal (to 2mm). Why?

Thanks!

Try

\documentclass{article}
\usepackage{showframe}

\begin{document}
\noindent\makebox[\textwidth]
{\begin{minipage}{0.5\textwidth}
\Large
Alpha\\[2mm]
Beta\\[2mm]
Gamma
\end{minipage}}
\end{document}


or

\documentclass{article}
\usepackage{showframe}

\begin{document}
\noindent\makebox[\textwidth]
{\begin{minipage}{0.5\textwidth}
\Large
Alpha\par\vspace{2mm}
Beta\par\vspace{2mm}
Gamma
\end{minipage}}
\end{document}


if this gives what you looking for.

When you write

Alpha\\
\vspace{2mm}
Beta\\
\vspace{2mm}
Gamma\\


then you create only one paragraph with the instructions:

Alpha\hfil\break\vadjust{\vskip2mm} Beta\hfil\break\vadjust{\vskip2mm} Gamma\hfil\break\par


Note the spaces before Beta and Gamma. These spaces occur here from the end lines where your \vsapce{2mm}<space> is written (spaces generated by token processor).

Now, this paragraph is broken to the lines:

Alpha\hfil


The \vadjust primitive produced by \vspace LaTeX macro puts its vertical material below the current line, so the lines look like:

Alpha\hfil
<space>Beta\hfil
\vskip2mm
<space>Gamma\hfil
\vskip2mm


This is typical misunderstanding of LaTeX users with \vspace macro. What you need: understand more about TeX principles about vertical mode, horizontal mode, about tokenizer, about \vadjust primitive etc. But, unfortunately, these things are not documented in common LaTeX manuals.

Edit There is another problem (or common bug in LaTeX documents) in your code: the usage of \\ at the end of paragraph, namely:

...Gamma\\


This is processed as

...Gamma\hfil\break<space>\par


and \par primitive runs \unskip (which removes the <space> from end of line) and adds \nobreak\hskip\parfillskip\break, so we have:

...Gamma\hfil\break\nobreak\hskip\parfillskip\break


\nobreak means \penalty10000 and \break means \penalty-10000 here. The \hskip and \penalty with value bigger than -10000 are discardable (removable) items, only \penalty-10000 (alias \break) is non-discardable. So, all items are removed after first \break except the last \break and we have:

...Gamma\hfil\break\break


When this material is divided into lines, the empty line is created after first \break. But this line does not have any stretchable material, so the warning: Underfull hbox badnes 10000 occurs. Your example definitely makes a paragraph like this:

Alpha\hfil
<space>Beta\hfil
\vskip2mm
<space>Gamma\hfil
\vskip2mm
<empty line plus warning Underfull hbox>


And what you can do? Don't use \\ inside paragraphs nor at the end of paragraph. If you need to achieve the same effect, simply close the current paragraph. Your example can be printed as three paragraphs. If you use \vskip primitive (instead \vspace LaTeX macro), then the behaviour is more intuitive, because \vskip closes the current paragraph when it is in horizontal mode. More precisely, \vskip adds \par token before itself in such situation. So the code:

Alpha
\vskip2mm
Beta
\vskip2mm
Gamma


does exactly, what you need. But your first word of the next paragraph must not be Plus or Minus (read more about \vskip in TeX documentation).