I posted the issue on the website recommended and got a very helpful reply:
Updates:
Status: Done
Comment #1 on issue 1306 by ... : Auto-completion for \citet
http://code.google.com/p/texmaker/issues/detail?id=1306
You can add what you want for the auto-completion :
"User" menu -> "Customize completion" : \citet{#bib#}
I wasn't aware that you could do that. It works perfectly now.
Thanks!
For that, you will have to make use of a custom .cwl file (which, afaik, requires a recent version of TeXstudio).
Create a file, let's say mycwl.cwl
, in either %appdata%\texstudio\completion\user
or .config/texstudio/completion/user
according to your system.
In it, place the following line:
\alternative{label}#r
and save it. Technically, you can put anything meaningful in the argument, but some terms are reserved and have special meaning. And, as you wish TeXstudio to recognize a label there, you require one of those, namely label
. The comment at the end of the line tells TeXstudio what kind of command yours is. #r
stands for this command declares a reference like "\ref{key}"
. For further commands, just add a new line to your mycwl.cwl
.
Then, in TeXstudio, go to Options
-> Configure TeXstudio
-> Completion
and check mycwl.cwl
on the list (crucial). And that's about it.
For more details on customizing autocompletion with cwl files, check the TeXstudio manual, section "4.13 Description of the cwl format".
A tip: If the manual seems complicated, and you'd like to emulate the behavior of some command's autocompletion you like, you might want to download the sourcecode tarball at http://texstudio.sourceforge.net/, unpack it and look at the built-in cwl files in the "completion" folder. From there, you can proceed by means of examples of your commands of interest.
Best Answer
Here are a few examples of what I put in the field:
\makeatletter
(see What do \makeatletter and \makeatother do?)\makeatother
\documentclass{@}
(Texmaker only has\documentclass[@]{@}
preconfigured)\cref{#label#}
(for thecleveref
package)\Cref{#label#}
\qroof{@}.@
(for theqtree
package)When you start typing one of these commands, Texmaker will offer you matching options for autocompletion, which you can choose between with the arrow keys and select with Tab.
If the command you entered had an
@
placeholder in it (Note: That's Texmaker syntax and has nothing to do with the@
used in package internal macros), it'll be turned into a•
, to which you can jump with Tab:The same idea applies for
#bib#
(bibliography items, i.e. items in a .bib file you specified in your document) and#label#
(created through\label{labelname}
). Unfortunately, the implementation of the latter seems to be flawed(note to self: file bug report):To answer your question succinctly: You can enter whatever macros you're planning on using frequently, using one of the three placeholders Texmaker offers, if necessary.