I have numbers from an R script that I would like to include in a report that I am typing in LaTeX. There are enough numbers that I am concerned about making a typo, and I don't want to do copy/paste over and over, either.
Doing something over and over? That sounds like a job for a computer!
I have found it easy to save graphs and include them in LaTeX files, and I figure I should be able to do the same with a sentence. My idea is to have R print my sentence to a .txt file, and then I will call some command that will import the verbatim text. The sentence will include numbers that I will format in dollar signs to make them look math-y. An example sentence might be:
"We found the predicted rise in temperature to be $8.6 ^{\circ}C$."
I would use R to calculate and then print out the 8.6, which I know how to do.
I found this post that almost solves my issue, but I want the imported sentence to have the same font characteristics as the rest of the text in my paragraph, which the linked material does not solve.


\inputwould preserve the font. If you\input{somefile}, it will behave as if the contents ofsomefilewere pasted at that location. Which is more viable if you are the one controlling the R output. – Teepeemm Sep 30 '21 at 01:42