# How to format a short inline code in a paragraph of text?

If I have a paragraph of text and have some very short code inline such as a function/symbol names in the sentences, how to format them more like code? Sort of like an analogue of computerCode in Markdown.

As you are typing, you can toggle between Code and Text styles using Alt+8 and Alt+7 (version 9.0.1.0 windows 8 x64)

If the paragraph is already typed, you can highlight the part you want to change and use Alt+8 to change its style to Code. Or, you can use Format menu and select Code in the Style sub-menu.

Alternatively, you can use Style[#,"Code"] to change the style of selected elements. For example:

text = StringTake[ExampleData[{"Text", "LoremIpsum"}], 400];

reStyle = TextCell[Row[List @@ StringReplace[#,  p : Alternatives @@ #2 :> Style[p, "Code"]]], 16,
"Panel"] &;

reStyle[text, {"Integer", "condimentum", "porttitor", "vitae", "rutrum", "justo"}]


• this doesn't seem to work for v11. It generates an all-gray area with the code blocks in bold – glS Feb 23 '17 at 16:06
• Thank you @glS. Looks like "Panel style definition has been modifed since version 9 to add a gray background. Does adding the option Background->None in TextCell work in version 11? – kglr Feb 23 '17 at 17:37
• nope. It makes the background white, but the code blocks also have a white background. – glS Feb 23 '17 at 17:45