<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 14px;" lang="x-unicode">Le 19/09/2011 10:14, Wilfried
Kirschenmann a écrit :
<br>
<blockquote type="cite" style="color: rgb(0, 0, 0);">Hi,
<br>
I would like to write a command \toRight{#1} allowing me to
align a piece of thext to be flushed the right at the end of a
justified paragraph, creating a nex line of necessary.
<br>
</blockquote>
<br>
\def\toRight#1{{\unskip\nobreak\hfil\penalty50
<br>
\hskip2em\hbox{}\nobreak\hfil #1
<br>
\parfillskip=0pt \finalhyphendemerits=0 \par}}
<br>
<br>
Explained in the <span class="moz-txt-underscore"><span
class="moz-txt-tag">_</span>TeXbook<span class="moz-txt-tag">_</span></span>,
page 106:
<br>
<br>
If a line break occurs at the \penalty50, the \hskip2em will
disappear and the empty<br>
\hbox will occur at the beginning of a line, followed by \hfil
glue. This yields two lines
<br>
whose badness is zero; the fi<span class="moz-txt-formfeed"></span>rst
of these lines is assessed a penalty of 50. But if no line<br>
break occurs at the \penalty50, there will be glue of 2 em
plus 2 <span class="moz-txt-formfeed"></span>fil between the
review<br>
and the name; this yields one line of badness zero. TeX will
try both alternatives,<br>
to see which leads to the fewest total demerits. The one-line
solution will usually be<br>
preferred if it is feasible.<br>
<br>
(The `review' is your paragraph and the `name' is your argument to
\toRight.)
<br>
<br>
Best,
<br>
Paul
<br>
</div>
</body>
</html>