# Right alignment of a single line

I have some pieces of metrical text, set in quoting environments, in which some verse halves are longer than a line. The standard verse environment would just break automatically and indent the second line. I am not so happy with that solution, and anyway I want to use the quoting environment for its flexibility. I would now actually like to try the following: Manually break the line, and right align its second half. But I don't quite get it working the way I want, I don't think I understand yet how \raggedleft works, see the following example:

\begin{document}
Some text here.
\begin{quoting}
Here some metrical text, longer than one line, and I want the
{\raggedleft second line to be right aligned.\quad 1\par}
%The result of the two lines above looks about what
%I want, but curiously "second" remains in the first line.
Here some metrical text, longer than one line, and I want the\\
{\raggedleft second line to be right aligned.\quad 1\par}
and another line.
%And if I force a line break, the first line gets indented oddly.
\end{quoting}
\end{document}


Another option might be to use verse and gmverse, but that would probably require more changes to my document which I would currently like to avoid. It's just around 10 lines I have to deal with, thus it's not such a big thing to do it manually. I might be able to live with the first solution in my example, I'm a bit scared though as I don't understand what LaTeX does there.

• i'm unable to try this out, so be sceptical. try this: ...I want the\break\hspace*{\fill}second ... \quad 1\par. \break is a primitive that keeps the full width of the line, and the \hspace*{\fill} will overcome the one-l \fil of \par, flushing the fragment to the right. (don't forget the *.) it could easily be made into a macro. – barbara beeton Jul 26 '15 at 13:25
• @barbarabeeton This seems to be doing exactly what I had in mind first, giving me the control over the line break. However, now I'm thinking it might be smarter to let LaTeX decide where to do the line break, which on first look seems to be what's happening in my first two lines, but I'm still confused what's happening there. – muk.li Jul 26 '15 at 13:44
• i agree that letting latex decide where to break the line is most desirable, and using \newline instead of \break would do that. but without being able to experiment, i don't know how to delay the space until after the line break. maybe someone else will take this suggestion and run with it. (i'm away from my test system, and won't be back until august.) regarding "what's happening", the string in braces won't fit on the first line, so latex just makes a "normal" (i.e. justified) break. but if you put a \fill in braces, it won't stretch, so not flush right. – barbara beeton Jul 26 '15 at 13:53

When you process the first example

Here some metrical text, longer than one line, and I want the
{\raggedleft second line to be right aligned.\quad 1\par}


the \par command appears when \raggedleft is in effect and so the whole paragraph will be ragged left. In the second case you're telling TeX where to break the first line, but the paragraph is ragged left nonetheless.

Here's how you can do it:

\documentclass{article}
\usepackage{quoting}
\begin{document}
Some text here.
\begin{quoting}[indentfirst=true]
Here some metrical text, longer than one line, and I want the\\
\hspace*{\fill}second line to be right aligned.\quad 1

Here some metrical text, longer than one line, and I want the\\
\hspace*{\fill}second line to be right aligned.\quad 1
\end{quoting}
\end{document}