Q. Would you italicize “x” in a phrase like “x number of dollars”? It seems like a variable, but I wasn’t sure if this casual use merited italics.
A. When an ordinary expression is borrowed from a specialized discipline like math, any basic convention that would be recognized by nonspecialists can often be retained, even in casual usage. For example, Chicago style is to italicize the n in “nth degree” (see CMOS 9.6); by extension, we would write “x number of dollars” (with the letter x in italics). As you suggest, these letters act like variables, which in math are usually italicized.
Another approach that’s common in published works is to use a capital X (normally without italics): “X number of dollars.” A capital X can stand in for anything that’s unknown or mysterious in some way—as in “X factor” or “X marks the spot”—and it’s arguably easier to read than a lowercase x. But either choice should work well as long as you’re consistent.