# Why is Cell > Convert To > InputForm not invertible?

I sometimes post code to PhysicsSE, and I usually convert it to InputForm first before posting, in order to avoid pages and pages of RowBox and Offset fluff. I usually instruct the user to copy/paste it into a new notebook, and use Cell > Convert To > StandardForm in order to get everything properly formatted.

Unfortunately, this does not always work. For example, consider the following StandardForm code:

Q = Sum[Array[a[10 k], {3}], {k, 4}] // MatrixForm // TeXForm

It looks fine, and in this case there isn't any need to convert to InputForm, but that's just because this is meant to be a minimal example. Now let's convert it to InputForm (on Mac OSX, this is performed via Command+Shift+I):

Q = \text {MatrixForm}\left[\sum _k^4 \text {Array}[
a (10 k), \{3\}] \r ight]

This is, of course, completely un-runnable, and executing Cell>Convert To>StandardForm fails to produce the original expression, let alone anything which is syntactically correct. Why is this? Is this a glitch with the front end's implementation of Convert To? Or am I doing something wrong?

The very similar expression

Q = Sum[Array[a[10 k], {3}], {k, 4}] // MatrixForm

gets converted via InputForm to

Q = MatrixForm[Sum[charge[[k]]*f[position[[k]]], {k, 4}]]

which is, of course, correct; this makes me suspect that the front-end is getting tripped up by the sequence of two // operators.

More generally, what do you recommend is the best way to copy and paste Mathematica code to StackExchange sites?

-
Would it be fair to summarize your question as: Why does the TeXForm wrapper break conversion to InputForm? –  Mr.Wizard May 13 '14 at 0:37
@Mr.Wizard: Hmm, interesting point, it seems that replacing TeXForm with a couple other functions (such as FullForm) doesn't cause the error. So yeah, I suppose that is the problem. –  DumpsterDoofus May 13 '14 at 0:43