I am trying to align some text to left/center/right in the same line. For example, I want to put my phone number on the left, my name in the center, and my email on the right, how do I do that?
[Tex/LaTex] How to make text aligned left/center/right in the same line
horizontal alignment
Best Answer
Using
\hfill
won't necessarily result in the middle text being centered, as the example below demonstrates. If you want to place the text in such a way that the middle text is really centered, I would suggest using\parbox
es, as the example shows (I used the\lipsum[2]
command to generate text to be used only as a reference):If this construct will be used many times, it would be better to have a command; something along the lines of the
\textline
command whose definition and use are illustrated in the following example (in which I also incorporated egreg's suggestion about\raggedleft
,\centering
and\raggedright
):