Common abbreviations are surprisingly tricky to format correctly. I'd like some simple macros for them, to be used like so:
You should eat more fruit, \eg apples, bananas, oranges, \etc.
There are (at least) three (interrelated) problems to overcome in defining this:
- If used at the end of a sentence, we end up with doubled-up periods. Simply leaving off the period in the macro seems ugly (especially for things like 'e.g.', 'i.e.', ...). A better solution calls for something like
\consumeif{.}
, but I can't find a beast. - The macro should include the behavior of
\xspace
. - It should also produce correct spacing depending on whether it ends a sentence, like the logic of
\@
.
How would I (you) write such a macro? Note: I'm aware of this question and others like it, but the answers don't resolve my problems.
\etc
doesn't even save you any keystrokes!? I think I just wouldn't bother. Do you really need a macro to save you from writinge.g.
or more properlye.g.\
\eg
to expand to, literally, ‘for example’, but sometimes to use the short-hand abbreviation in a paper or some such.\textit{i.e.\@\xspace}
.\,
in acronyms like "e.g." or "i.e.". This makes it clear that there are actually two words behind it, but the space doesn't look too big, as a regular space or~
would. (The German typographical quick reference typokurz recommends this as well.)