Text align left, right and left, right, center on same line in LaTeX
In this tutorial, you will learn how to align text left, and right on the same line and also align text left, right, and center on the same line in LaTeX.
Text align left and right on same line
To align text left and right on the same line in LaTeX, the easiest way is using \hfill
command like this.
\documentclass{article} \begin{document} \noindent Text \hfill Text \noindent\underline{\textbf{Name:}} \hfill \underline{\textbf{Date:}}\\ Parvez Akhtar Pasha \hfill \today \end{document}
Output:
Text align left, right, and center on same line
With a similar process (with \hfill
) you can align the text left, right, and center on the same line. Take a look.
\documentclass{article} \begin{document} \noindent Text \hfill Text \hfill Text \noindent\underline{\textbf{Name:}} \hfill \noindent\underline{\textbf{Site:}} \hfill \underline{\textbf{Date:}}\\ Parvez Akhtar Pasha \hfill CodeSpeedy.com \hfill \today \end{document}
Output:
Leave a Reply