# footnote non-breakable

I am typesetting in a bidirectional environment, the language is right to left but the commands are left to right. Due to this i rather distinguish the commands and the actual text by typing every command in a new line. Unfortunately this caused me some trouble, please consider the following sample:

\documentclass{article}

\begin{document}

thus \footnote{this is a footnote} the main issue remains. The quick brown fox jumps over the lazy dog \footnote{Why did it jump} The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog

\end{document}


which results in the following output:

As you can see, the output has two problems:

1. The space between the main text and number representing a footnote is wide (look at the space between "thus" and "footnote number 1".
2. The second footnote has moved to the new line.

I know that they are all my fault! I must not put space between the footnote command and the text before. But I provided this example to let you know what are the problems. Now considering the case in a bidi environment where I have used many \footnote commands in a new line but without any space, as shown below:

this is the text
\footnote{this is a footnote}


How can I overcome this problem and remove that whitespace which tex assumes when going to new line and still maintain the readability of the text? Should I renew the footnote command and add the \hspace with negative value to it?

-
You might want to try Emacs 24 (not released as such at the current point of time, but reasonably easy to compile and/or get hold off from development sources). Its display of the unwrapped source line in a Bidi paragraph is very much what you would sensibly expect apart from the rendition of {...}footnote\. But placing the backslash to the right is at best a minor distraction, and it does follow the reading order. –  user9588 Apr 18 '12 at 9:26

I played only a bit ...

\documentclass{article}

\makeatletter
\let\Footnote\footnote
\def\pst@@killglue{\unskip\ifdim\lastskip>\z@\expandafter\pst@@killglue\fi}
\def\footnote{\pst@@killglue\Footnote}
\makeatother

\begin{document}

foo      \footnote{A foot note without spaces in front.} bar baz

bar
\footnote{Another foot note without spaces in front.} bar baz
\end{document}

-
This is my preferred solution. (I've edited the answer slightly to cope better with optional arguments.) –  Will Robertson Jan 8 '11 at 9:40

You're include spaces, so of course TeX is. Use % at the end of lines where you don't want there to be a space:

this is the text%
\footnote{this is a footnote}

-