2

This question already has an answer here:

I would like to typeset text (a link) at the end of the current line, like this

1 Text.                                                  [Link]

2 More text, that is unfortunately too long to fit the link.  
                                                         [Link]

3 Text that goes over two lines just places the link at the end
  of the last line, if it fits.                          [Link]

4 If it doesn't fit into the second line, because the text is
  just too long, put it flushright on the next line, as in 2.
                                                         [Link]

I don't want to break the [Link] into two lines.


Update. Thank you for all your answers. The code from the accepted answer on the "duplicate" question works best:

perfect

marked as duplicate by Werner spacing Oct 16 '15 at 21:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

(Not tested.)

enter image description here

\documentclass{scrartcl}

\newcommand*\link[1]{\hspace*{0em plus 1fill}\makebox{[#1]}}

\textwidth=.5\textwidth % Just for this example

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. \link{whatever}

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat. \link{another}

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. \link{this}

Excepteur sint occaecat cupidatat non pro ident, sunt in culpa qui officia
deserunt mollit anim id est laborum. \link{that}
\end{document}

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