1

I realized that hfill only flushes the first word to the right if the line started with the second half of a syllabification. If there is a manual linebreak afterwards the problem does not occure:

\documentclass{article}
\begin{document}
This is a very long sentence such that there has to be a point where a stu\-pendous line should be cut. \hfill test 123

This is a very long sentence such that there has to be a point where a stu\-pendous line should be cut. \hfill test 123\\

This is a very long sentence such that there has to be a point where this line should be cut. \hfill test 123
\end{document}

produces this: enter image description here This is a problem since I use hfill after quotes to give the author and date. Is there a reason for this behavior, is this a bug? I tested it with texlive 2017 and miktex 2.9.6300.

1 Answers1

2

It's a bug in your input markup, you should be using \hspace*{\fill} to make a space that is not dropped at the start of a line. Unrelated to hyphenation, \hfill is dropped at the start of a line for the same reason that you do not get an inter-word space at the start of a line if tex inserts a linebreak, all discardable space is discarded after a line break. You may also want test~123 to prevent a line break at that space. (It is hard to be sure what you want to happen in general)

David Carlisle
  • 757,742