So is there way to tell just by the formula whether we're talking about covalently bonded or separate atoms?
Unfortunately, no, not really, because of the reason Borek pointed out. There is some chemical intuition involved, and also familiarity with certain ions. Generally, though, when a set of atoms is grouped together in a formula for a salt, it means they are discrete units, usually complex ions, that are bonded internally. So in the case of Ca(OH)
2, the OH's are discrete complex ions (OH
-) that are not bound covalently together (i.e., one OH is not bound to the other OH in any covalent way), BUT the O and the H within a single OH
are bound covalently together. On the other hand, if you had a hypothetical Ca(O
2H
2) substance, then you could say that the O's are likely bound together covalently to form a complex ion like [H-O-O-H]
2-. Thus, the use of parentheses can be your guide.
(These rules don't apply to organic molecules, the formulae of which also use parentheses.)