The answer is easy when the pronunciation of a single letter or acronym is known to your readers.
For example, we all had maths in school, we know what what a "variable x" means and how to pronounce it. In a case like this you can use the conventions familiar to all of us and write the variable name as it is written in all the school books of the western world as simply "x".
The answer is also easy when an acronym is unpronouncable as a word.
English words need a vowel, and they do not contain digits, so it is clear that "TM" must be pronounced "tee em" and "TM1" is read "tee em one".
But what if the meaning is not readily apparent or the acronym is pronouncable as a word? Does "i" signify a Roman numeral 1 or the letter i? Is "m" the letter or an abbreviation for meters? Is "cobev" a Swedish word or the abbreviation of a Colorado based beverage company?
To clear this confusion there are conventions.
For example, Roman numerals are not used in English except in places where the context makes their meaning clear as in page numbers ("p. vii"). Outside scientific texts, units are never abbreviated ("twelve metres"). Acronyms are written in capital letters ("COBEV"), foreign words in italics ("cobev").
But how do you write single letters or strings of characters that are not abbreviations, acronyms, mathematical symbols or units of measure?
To answer this question we need to consider when they would appear in a written text at all.
In a story, a character might see, hear, speak or write a letter. In that case it will be in quotes:
John's t-shirt read "Straight Edge" and he had drawn a big black "X" on the back of his hand.
Only rarely will single letters appear without markup, but then the context will make their "letterhood" clear:
Verena pressed a random key: h.
As @SF pointed out in his comment below, a series of letters is often connected by dashes, for example when a character spells a word:
"The code is 'cohac', C-O-H-A-C."
The last represents something like "see ou eytch ey see".
With great pride Lucy showed her mother what she had written: "br$4Agm"