[Tex/LaTex] Text alignment in a minipage

horizontal alignmentminipage

I have a little problematic in LaTeX, and I have not found any solution.

I have a minipage like this :

\begin{minipage}[t]{\textwidth}
    \raggedleft
    {\bfseries Some text}\\[.35ex]
    \small
    Text again\\
    And again\\\[.35ex]
\end{minipage}

This code permit me to put my minipage in the right of my page, but the text in the minipage have a right alignment, and I need it left center (no center in the page but center in the minipage).

So, if someone had a solution… Maybe use a minipage is not the right solution ?

Thanks !

Best Answer

This can be done in several ways; below I include two options; the first one, using a minipage and the second one, a tabular with one l column (in case that the contents is required to wrap, a p{<length>} column should be used instead); showframe was only used to draw a frame as visual guideline for the alignment:

\documentclass{article}
\usepackage{showframe}

\begin{document}

%Using a minipage:
\hfill\begin{minipage}[t]{2.6cm}
    {\bfseries Some test text} \\[.35ex]
    \small
    Text again \\
    And again
\end{minipage}

%Using a tabular:
\hfill\begin{tabular}{@{}l@{}}
    {\bfseries Some test text} \\[.35ex]
    \small
    Text again \\
    And again
\end{tabular}

\end{document}

enter image description here