I've looked into this before and after a quick search through Google this is what I found the last time I looked:
simulate this circuit – Schematic created using CircuitLab
Basically when the TX pin is high (idle), the capacitor will slowly charge up until the Schmitt trigger inverter threshold is reached at which point it will switch the MAX485 into receive mode.
When you want to transmit, the start bit (and any subsequent 0 bits) will rapidly discharge the capacitor through the diode switching over the Schmitt trigger inverter causing the MAX485 to go into transmit mode. The during any 1 bits the capacitor will start to charge again, though slowly because of the resistor until it will eventually switch back into receive mode.
You need to select the R-C values such that the capacitor doesn't reach the positive going threshold of the inverter until sufficient time has passed for one byte of data. Each UART byte will always start with a start bit (0) which will keep the MAX485 in transmit mode while you are sending.
To save space you can get Schmitt trigger inverters in single gate packages which are no bigger than a surface mount transistor - the 74LVC1G14 would suffice for the job.