3

Suppose that for random reasons I want the footnote mark before the text it is related to instead of after it. Then the code

\documentclass{memoir}

\begin{document}

Hello my name is Gaussler and I have a problem with footnotes before linebreaks. If the word is sufficiently long, the line breaks look just \footnote{Footnote}superhypoerproblematic and I don't know what to do about it, so can you help me solve this problem? It would be really nice, and I would appreciate it and +1 your answer and say thank you very much, you're very nice.

\end{document}

produces

enter image description here

Wait, that looks horrible. The word goes outside the margin. How to solve this?

(BTW, yes, I have noticed the typo. And I don't care.)

  • 1
  • 2
    in english, any non-letter that precedes a word that should really be hyphenated suppresses the hyphenation check. thus a "pre-footnote" means that the word won't even be examined for possible hyphenation. (this isn't true, in some cases, for other languages, like italian -- see the comments to this question: Hyphen that appears only if near end of line.) – barbara beeton Dec 29 '14 at 19:19
  • Happened already. ;-) – Gaussler Dec 29 '14 at 20:09
  • 2
    \footnote{x}\nolinebreak\hspace{0pt}overlongword. But what's the meaning of footnote markers attached to the following word? – egreg Dec 29 '14 at 21:04
  • It's converted from an XML document where this is the standard. Don't ask me why. – Gaussler Dec 30 '14 at 6:58
5

You could do this...

\documentclass{memoir}

\begin{document}

  Hello my name is Gaussler and I have a problem with footnotes before linebreaks. If the word is sufficiently long, the line breaks look just \footnote{Footnote}\nolinebreak\hspace{0pt}superhypoerproblematic and I don't know what to do about it, so can you help me solve this problem? It would be really nice, and I would appreciate it and +1 your answer and say thank you very much, you're very nice.

\end{document}

hyphenation after marker

EDIT Corrected thanks to egreg's comment.

  • And I don't risk something like a line break between the footnote and the word? – Gaussler Dec 29 '14 at 19:27
  • @Gaussler Actually, I don't know. You might need to tell LaTeX not to break the line there as well, but I'm not certain of the best way to do this. – cfr Dec 29 '14 at 20:50
  • 1
    @Gaussler Yes, but adding \nolinebreak before \hspace{0pt} (better than \hskip0pt) fixes the problem. Why not \hskip? Well, try \footnote{x}\hskip0pt minuscule – egreg Dec 29 '14 at 21:05
  • @Gaussler I've corrected/adjusted this in light of egreg's comment. (Of course, \hskip 0pt minus... gets read as a single instruction which is not what you want!) – cfr Dec 29 '14 at 21:11
  • 1
    @Gaussler I'm not sure to follow: if I have \footnote{foo}\nolinebreak\hspace{0pt}bar at the start of a paragraph, I get no error. – egreg Dec 30 '14 at 15:19
2

My original \kern0pt approach suffered from breaking hyphenation. So far, the only remedy I have found is to manually supply hyphenatation points to the word following the footnote. In this case, the \kern or \hskip is unnecessary.

\documentclass{memoir}

\begin{document}


Hello my name is Gaussler and I have a problem with footnotes before linebreaks. If the word is 
sufficiently long, the line breaks look just 
\footnote{Footnote}su\-per\-hy\-po\-er\-prob\-lem\-at\-ic and I don't know what to do about it, 
so can you help me solve this problem? It would be really nice, and I would appreciate it 
and +1 your answer and say thank you very much, you're very nice.

Hello my name is Gaussler and I have a problem with footnotes before linebreaks. If the word is 
sufficiently long, the line breaks look xxxxxxxjust 
\footnote{Footnote}su\-per\-hy\-po\-er\-prob\-lem\-at\-ic and I don't know what to do about it, 
so can you help me solve this problem? It would be really nice, and I would appreciate it 
and +1 your answer and say thank you very much, you're very nice.

\end{document} 

enter image description here

  • Okay, I'm (hopefully temporarily) unaccepting your answer while you think. Don't take it personally, I'm sure you'll get it back. :-) – Gaussler Dec 29 '14 at 20:08
  • 1
    @Gaussler My revision is improved, but not ideal. If I were you, I would hold out for egreg or David to mount up and ride to the rescue. – Steven B. Segletes Dec 29 '14 at 20:28
  • I'm sorry, egreg chose to correct the other answer. Nevertheless, I'll +1 everything you've posted as a compensation. :-) – Gaussler Dec 30 '14 at 7:46
  • 1
    @Gaussler My answer was not deserving of "acceptance". No need to compensate for that fact. – Steven B. Segletes Dec 30 '14 at 13:22
  • I liked the fact that you tried anyway. – Gaussler Dec 30 '14 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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