Half a year ago I adopted a Pomeranian. He had never had a permanent home before, travelling from shelters to foster homes over and over again. He's very smart but absolutely unruly and untrained.

The most annoying part of his behavior is that he begs for attention all the time, and it doesn't matter how much of that I give him. I do try to give him as much of love as possible because it's something he always lacked in the past, but it's never enough for him. He'll keep jumping or crawling on me. I've tried to ignore him but it doesn't help, I tried to make loud noises to discourage him but it doesn't help either. If I command him to sit, and I know he knows this command, he will sit only when he feels like doing it. He doesn't recognize my authority.

I love him to bits and I'm so happy to give him a home but it's been six months with no improvement and I'm really run out of ideas.

Just ignore him even if it takes 2 hours he will eventually get the idea, right now he knows that you think it wont work and if he just keeps doing it you will eventually give in and give him what he wants, he just doesn't take you seriously ignore him completely for as long as it takes until he understands that nothings gonna come out of his behavior. when he is calm you can give him attention but if you approach him and he immediately starts being exited you need to ignore him again. You need to teach him the attention will only be given when he is in a calm state and when you feel like it. Get all those thoughts of him needing attention and being lonely because he is a rescue out of your head, he knows that's what you think and he knows he can get his wish and doesn't take you seriously because of that. a well behaved calm dog is a happy dog, being exited and anxious is a bad thing for any dog.
do you use positive reinforcement for good behavior? people usually forget to praise focusing on ignoring only which is of course much less effective