Should I put an apostrophe to indicate a plural or past tenses? Technically, plurals shouldn't be indicated with apostrophes.

However, in maths and computer science textbooks, I've often seen people write things like "if we combine the x's and y's" or "string A is the same as string B xor'd with string C".

Is that right? Should I adopt this convention when writing an academic paper, or is there a better way?
The Cambridge guide to English usage by Pam Peters has a long discussion on the usage of the apostrophe in the case of plural nouns. For what concerns your example, under the section Apostrophes, it says:


  Single letter in lower case still usually mark the plural with apostrophes, as in Dot the i's and cross the t's


The purpose is that of highlighting that you have the plural of a word composed of a single letter. However, under the section Letters as words there is the following remark:


  Yet even the apostrophe is unnecessary if italics are used and the plural s itself is in roman.


Though the above remark is probably meant for ordinary text, in mathematics variables are commonly typeset in italics, and I think that the above remark can be applied as well.

According to the above, I'd say that the apostrophes in your first example cannot be considered wrong, but they are actually unnecessary.

In LaTeX, I'd then write
your first example as

if we combine the $x$s and $y$s


Instead, in the past tense of your second example the apostrophe marks the elision of the letter e, and in this case it is required: xored -> xor'd.