Help with button hole in ribbing pattern PLEASE!

I am knitting a baby jacket and have just picked up 50sts along the front of the cardigan. I need to do 5 rows of ribbing (k2, p2) and create button holes in the 4th row.

For the 4th row, the pattern says this:
P2, *K2tog, yfwd, rib 9. Rep from * 3 times more. K2tog, yfwd, rib to end of row.

So if I P2 then K2tog, then the next 2 sts would be purl so why does the pattern say yfwd when I would do this anyway to purl the next two stitches? I assume it is saying yfwd to make up for the stitch lost when I k2tog to make the buttonhole but I just don’t understand how bringing the wool to the front is going to make an extra stitch when the wool needs to be at the front to purl the next stitch anyway.

Also, after the 2tog, it says to rib 9. So this means I would P2, K2, P2, K2, P1 and then repeat from * which would be two K2tog again. So now I am knitting a purl stitch and a knit stitch together and muking up all the ribbing pattern.

Welcome to Knitting Help!
Yes, you do need to make up an extra stitch and you need to have the yarn in front to purl. So really what you do is bring the yarn forward between the needles, over the right needle to the back and then around to the front again. That will give you a loop over the needle and put the yarn in the correct place to purl.
You won’t be changing the ribbing pattern even if it’s a K and a P that are worked together because you’ll continue the columns of K2P2 that you’ve established on the previous rows. On the next row, you’ll K2P2 over the buttonhole row. Still, it might be neater to move the next buttonhole one stitch down (work 10sts) and then move the next buttonhole one stitch up (work 8sts).

Hi. salmonmac explained it beautifully. One small thing you might miss, is that yfwd really means the same as yo. I get hung up on details like that.

Your best bet in a case like this is to just look at your work. Knit the knit ‘v’ stitches and purl the bumps. When you interrupt the ribbing with the buttonholes, you can stay in pattern this way.

I just have to thank you so much for quickly jumping on board to answer and help me! What a lovely world of online knitters. Thank you!

The best advice I’ve ever read is to make the button hole fit the button. Adjust the hole to fit as you’re knitting it, either adding stitches or subtracting. Push the button through to make sure it’s not too loose or tight before you move on to the next hole. Life is too short to be driving around town trying to find the right size button to fit that particular size hole the pattern wants you to do. I have better things to do with my time and a perfectly good stash of free buttons in my sewing drawer.