# Text Editor Autocompletion vs direct LaTeX macros

In terms of research paper writing and in general usage, is there a preferred convention for one or the other? I'd like to know simply so that I get into the habit of using the norm as opposed to forcing myself to adopt a new procedure in the future.

By "text editor autocompletion", I mean the text editor has the feature that writing something like `bb` expands into `\mathbb{}`, where as for LaTeX macros, we define a new command in the preamble and employ it as `\bb{}`.

I apologize if this is too soft a question for StackExchange, although I do not know a better location to ask this.

• Whenvever the editor provides auto completion use it and whenever it is not, if it is absolutely needed or you have some other reason, define a macro. But here one should be careful in choosing macro names for they might have already been used resulting in error. I add some words like `\mybb` to make it unique. – user11232 Feb 23 '14 at 0:41
• This is not too soft for our sites. Since we treat only one very special language at a time, we allow soft question about good or bad coding styles and habits. However, I believe that this has been asked before, I just can't find it now. – yo' Feb 23 '14 at 0:42
• Very short custom macro names can be bad for at least two reasons: 1) their name can clash with primitives/macros of packages 2) they can make the code obscure. My rule of thumb: if what you need is speed in typing use autocompletion, if instead you need a semantic tag use a macro. – Bordaigorl Feb 23 '14 at 0:46
• These are great responses. Mind expanding a bit and including it as an answer? – Dustin Tran Feb 23 '14 at 1:20
• Also, journals etc. which accept LaTeX are likely to be much happier if you use autocomplete as they then get a document which uses standard commands. They will be significantly less keen on a document full of author-created macros. Whether this matters is rather discipline specific. If nobody in your field accepts LaTeX, it is essentially a non-issue. (My code can be as eccentric as I like so long as the result looks OK.) Although, even then, conversion (e.g. to Word as often required) is easier with standard macros. – cfr Feb 23 '14 at 2:11

## 2 Answers

The main disadvantages of LaTeX macros (already defined commands, journals requeriments,...) has been well covered by the comments, so I will focus on the opposite aspects:

I particularly hate unsolicited autocompletion (like in Word or LibreOffice) because often is not helping, but distracting. A requested autocompletion, either through a shortcut (`ctrl-B`) or a menu (`LaTeX> Font Styles> Boldface`) is fine, especially if the user can define the shortcuts. But a little problem is to remember all the shortcuts and menus. If you change between several editors for some reason, this could be a problem.

Instead, LaTeX macros do not depend on the editor. The code is not obscured even for others, if macros are well commented and formatted in the preamble (and used judiciously). At least no more obscured that code in packages or classes, that sometimes is not well documented. Instead, this could make the content even more readable since text is cleared of many LaTeX commands. In fact, separation of content and style is a major objective of LaTeX. Isn’t it?

But above all, you always can change very easily what your macro has done in the last compilation, but may be not so easily what the autocompletion has wrote. In the end, LaTeX is nothing more that a set of TeX macros, that is, the use and abuse of this wonderful advantage.

Source code (in this case LaTeX) should primarily be readable. Not only for yourself in a week, but hopefully by somebody else who wants to filch some of your text. Shortcut-macros hinder this. You should define macros with meaningful names for common constructions (no typing shortcut there, I'm afraid), particularly if their definition might change.