I'm just finishing my first document (a book), and I have to create an index (\makeindex
, \printindex
, \index{WORD}
, ...).
I am using TexMaker on Linux.
I was wondering if it's possible to define something like a "macro", to be able to avoid adding \index{WORD}
before each word to be indexed (my document will have very many words to be indexed... :-).
I mean, I'd like to be able to define a command which would allow me - clicking a keyboard short-cut, for example [Ctrl][F9]
- to insert \index{WORD}
just before the WORD the cursor is on...
Skimming through TexMaker docs, I couldn't find anything useful to that intent...
UPDATE I am following the suggestions in the comments, but I can't yet fully understand how to solve my problem... Feel quite dumb right now... :-(
So: I add the command \iindex
in my book heading, as Sigur suggested:
\newcommand\iindex[1]{#1\index{#1}}
So far so good. Now I would like to associate a keyboard shortcut to it.
As suggested (always by Sigur) I look for a macros menu, but I can't find it (I use Texmaker 4.0.3).
As suggested by Aradnix, I open the User menu, and find these sub-menus:
- User Tags
- User Commands
- Customize Completion
Both Tags, Commands can be customized, but I suppose:
- Commands are for external commands (not my case).
- Tags are more promising, but what do I write in tag's LaTeX content? I mean, how do I refer to the word under cursor, which I want to index?
- Customize completion lists items already defined (which include for example \index{•}
), and I can add new commands; but, I can't understand how to associate it with a shortcut... :-).
Any more literal suggestion for a LaTeX newbe...?
If anybody solves and answers, I will accept the answer, of course... :-)
\newcommand\iindex[1]{#1\index{#1}}
. then you can add a shortcut to this command and then you double click a word and press the shortcut. I guess that this should work.\index
already exists. So I defined a new command, so you can not use the same name. The new command makes use of the old one.\iindex{foo}
. After this you can access the macro in the same menu or you can use the shortcut. In my editor,shift+F1
. Then, select the word and press it.user
menu you can add and custom tags, commands or improve the autocompletation. For me is the easiest way to do what you want.