5

I want to have right and left- aligned text on the same line. I tried the \hfill command, but my problem is, if the right-aligned text is to long and the line breaks, the rest is left aligned, even if I use \raggedright.

Additionally I want a comment on the right side, wich is always in the first line, but the rest of the text before (after linebreak) should be aligned right under this comment. I don't know, if I can achive this with tables and how. It is important, that the space between the "left" text and the right one can vary from paragraph to paragraph, because I want as few linebreaks as possible.

Does anyone have a solution for this? The following example shows the problem with the left-aligned text after linebreaks - I want it on the right side and the italic-styled comment on the first line at the right side.

\documentclass[c6paper,DIV=14,pagesize=auto,fontsize=8pt]{scrbook}
\begin{document}
\textbf{I} Some Name \hfill {\raggedright \tiny Lorem ipsum dolor sit amet, consectetur adipiscing elit.}
\textbf{II} Another Name \hfill {\raggedright \tiny Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum elit}
\noindent \textbf{IIa} Variant of Another Name\hfill {\raggedright \tiny Lorem ipsum dolor sit amet, consectetur adipiscing elit.}
\end{document}
3
  • Is this question and its answers of any help?
    – Ludovic C.
    Commented Nov 10, 2013 at 13:46
  • It is a question. The example should be illustrating my problem.
    – seflue
    Commented Nov 10, 2013 at 15:08
  • Because David Carlisle solved a part of my problem, I posted a new question, which focuses on the "comment" part: tex.stackexchange.com/questions/144279/…
    – seflue
    Commented Nov 10, 2013 at 19:07

1 Answer 1

5

It's not really clear from your description what layout you want (it may be better use a drawing program and "fake" and image of the desired output to show what you mean). However if you put \raggedright in a group that ends before the end of the paragraph it does nothing other than set the paragraph indent to zero. Similarly if you use \tiny in such a group you get tiny text set to a normalsize baseline.

Perhaps this is close to what you need, but it is hard to tell.

enter image description here

\documentclass[c6paper,DIV=14,pagesize=auto,fontsize=8pt]{scrbook}
\newcommand\zz[2]{\par{\normalsize\strut\textbf{#1} #2} \hfill\ignorespaces}
\begin{document}
\begin{flushright}\tiny

\zz{I}{Some Name}Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\zz{II}{Another Name} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum elit
\zz{IIa}{Variant of Another Name}Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{flushright}
\end{document}
1
  • Thank you for this clean solution. I think, the placing of the comment is an extra question.
    – seflue
    Commented Nov 10, 2013 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .