Footnote in Longtable

Maybe many of you have such problem. You have a table and want to have a reference inside, but it doesn’t work. Propably you get this or similar error:

name{Hfootnote.7} has been referenced but does not exist, replaced by a fixed one

This happens, because hyperref has problems with its counters, when they are inside of a table environment.

I searched the net for a couple of hours with no real solution. Mostly it says, don’t use footnote in table. But it’s much more nice to have. With some inspiration from some boards I came up with this solution which works fine for me.

 

Hyperref will not mark these created footnotes as links, but I think it’s not a big deal.

I’m just a beginner with latex, so if you think you have a better solution leave me a comment.