Text Formattingtext alignment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
xnonamex
Posts: 2
Joined: Sat Feb 13, 2010 9:05 pm

text alignment

Post by xnonamex »

Hi,

I'm new to TeX, so i guess my question will be quite foolish, but still, i have a problem and i can't find a solution in any tutorials i have checked.

Code: Select all

\documentclass{article}
\begin{document}
\begin{center}
{\huge No.21}\newline
\end{center}
\begin{flushright}
Myname\newline
Surname\newline
text1\newline
\today\newline
\end{flushright}
\end{document}
my task is to get the first line "No.21" in center, and everything aligned to the right side. but althou i use flushright etc, everything is in center, just a bit to the right side.

Thanks :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

text alignment

Post by gmedina »

Hi,

try with something like this:

Code: Select all

\documentclass{article}

\begin{document}

\begin{center}
  \huge No.21
\end{center}

\begin{flushright}
Myname\\
Surname\\
text1\\
\today\\
\end{flushright}

\end{document}
or this:

Code: Select all

\documentclass{article}

\begin{document}

{\centering\huge No.21\par}

\begin{raggedleft}
Myname\\
Surname\\
text1\\
\today\\
\end{raggedleft}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
xnonamex
Posts: 2
Joined: Sat Feb 13, 2010 9:05 pm

Re: text alignment

Post by xnonamex »

ty, works fine :)
Post Reply