Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

\documentclass[a4paper]{article}
\usepackage{pstricks}
\usepackage{xcolor}
\usepackage[arabic,english]{babel}

\begin{document}

\textLR{
\begin{pspicture}(10, 10)
\psgrid
\definecolor{Black}{RGB}{0,0,0}
\rput{0}(3.9,7){%
\psframe[,linestyle=solid,linewidth=0.265mm,linecolor=Black](-2.1,1.9)(2.1,-1.9)
\uput{0.01cm}[320]{0}(-2.1,1.9){%
\parbox[t][3.8cm][t]{4cm}{
\color[rgb]{0,0,0}
\scriptsize
\begin{flushright}
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
\newline\end{flushright}
}
}
}
\end{pspicture}}

\end{document}
share|improve this question
    
Welcome to TeX.sx! –  mafp Mar 7 '13 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. –  barbara beeton Mar 7 '13 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.

share|improve this answer
    
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. –  Text Alignment Mar 10 '13 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. –  David Carlisle Mar 10 '13 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. –  Text Alignment Mar 10 '13 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. –  David Carlisle Mar 10 '13 at 11:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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