I'm writing graphic application to generate latex tex. I'm making to generate text box with all it's features. Rotation alignment so on. I generated following cording but It was not Right aligned properly in paragrah box I have shown bounding box. What is wrong there...



\begin{pspicture}(10, 10)
Right Aligned
\newline Right Aligned
\newline Right Aligned
\newline Right Aligned
\newline Right Aligned
\newline Right Aligned
\newline Right Aligned
\newline Right Aligned
\newline Right Aligned

  • Welcome to TeX.sx!
    – mafp
    Mar 7, 2013 at 14:53
  • for some reason, the bounding box doesn't show up for me. adding \null\hfill to the beginning of one line and \hfill\null to the end of another does show that everything else is centered. but why that is happening is a mystery to me. Mar 7, 2013 at 15:12

1 Answer 1


flushright environment calls \raggedleft which locally redefines \\ to make a ragged break, but it does not redefine \newline. If you change all your \newline to \\ the text goes to the right edge of the box.

  • Thank you for your answer.The Problem solved.But always I got error indicating "!Latex Error : There is no line here to end". Why that is showing. Mar 10, 2013 at 10:41
  • @TextAlignment That usually means you have \\ at the start of a paragraph you can't force a line break when you have not started a line yet. Mar 10, 2013 at 10:42
  • \parbox[t][3.8cm][t]{4cm}{ \color[rgb]{0,0,0} \scriptsize \raggedleft \\ Right Aligned Text \\ Right Aligned Text } Appreciate your quick response. If I do like this \\ in beginning of line paragraph. Generate same error. Mar 10, 2013 at 11:01
  • well there you have \\ before Right Aligned Text which is an error. Also you will get the alignment wrong if you start with \color at the start of a \parbox use \mbox{}\color for technical reasons explained in the grfguide documentation that comes with latex. Mar 10, 2013 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.