I want to be able to present short code in the middle of a sentence. How can I highlight text in the middle of sentences in Latex so it they appear as code. Consider this example
For this purpose we use the
optim()function.
I have highlighted "optim()". How can I do this exact thing in latex document?
listingspackage has\lstinline;mintedhas\mintinline. For very short stuff you could in theory also use\textttas long as the code does not contain characters special for LaTeX. Do you also want the grey background or is it enough to change the font? – moewe Jan 29 '19 at 15:17