Paperport from Nuance is what we use. It has been improving.
You scan in the page and then you can click where you want to type and you type on the line or anywhere on the page. My DS does it and loves it. Then saves it as PDF and prints or hands it in on flash drive. You can also just email it to the teacher.
We are finding that a lot of PDFs now allow you to type on them too. Though printing can be flaky--sometimes the stuff you type doesn't show up. So, if you scan and save to PDF, you may --with out the software you have to pay for--be able to type on your PDF.
If you get really fancy, you can carry around a hand held scanner that has paperport on it (neat receipts). We are not that fancy at this house. Instead, we looked for a printer/scanner that already has paperport installed (Brother MFC 7840 W is ours). There are cheaper ones, but we needed waterproof so laser was our best choice. If you get the software with the printer, you can put the software on all your computers. If you buy Paperport separately (maybe this is changed?) you are limited, and it doesn't update. And it costs about half the price of our printer.
If you read reviews, they say Paperport is awful, but for our purposes--which are not mentioned in any of the reviewers purposes--it has worked flawlessly and been fantastic.
If you have a Mac, I believe there's something called "form typer". It seems to be exactly what you want, though we have a PC so never investigated it.
Efofex is the math program kids use once they reach pre-algebra and are starting to type equations. There are free trials and you can get it free for 10 years with a letter verifying disability. It is an add in for word so goes right into the word documents. However, my stick in the mud prefers to not use it in word and to save as a PDF directly from Efofex. It should be available for Macs within the next couple of years. They are still developing it.
For elementary school math, there's nothing yet that lines up the numbers for you. Many have tried. We looked at some stuff and are always looking to see if there is an app yet. Some have claimed to have it solved, but we haven't seen one good yet. We relied on the kindness of the math teacher to stand over DS and ask him what he was writing. Lots of people have made Excel work for them. We were lucky to never have to go down that path.