# texmaker automatically sets scale=1 in the includegraphics tool. Can this be customised?

I got this set up in Kile, but can't figure it out in texmaker. I want almost all my figures to be as wide as the text, at the moment I have to type this in manually each time. There is already a default size argument (scale=1), how can I customise this default?

-
No editor can automatically set the width of graphics: it's the LaTeX code that does that. You are probably looking for `\setkeys{Gin}{wdith = \textwidth}` or something similar. – Joseph Wright Nov 8 '12 at 12:25
I don't think I'm looking for `setkeys` this time, although that could be useful too. What I mean is that I use a GUI to select which image to include, and when I click ok, texmaker writes the line for me: `\includegraphics[scale=1]{my_image.pdf}` I'd like it to say `width=\textwidth` instead of `scale=1`. Of course, I can edit it manually later, regardless of the editor. – craq Nov 8 '12 at 15:09
I discovered another workaround recently, by defining a new command `\includegraphicsTW`. It doesn't solve the problem, but it does retain the use of the GUI for selecting image files, which @doncherry's answer doesn't. See here for details – craq Jan 12 at 13:55

Go to UserCustomize Completion and add your preferred `\includegraphics[width=\textwidth]{@}` (`@` is the placeholder). From now on, when you start typing `\incl...`, both variants of `\includegraphics` will pop up (probably `\include{@}` as well). Presumably your custom entry will be at the bottom, which would mean you'd have to press (x2)+Tab. You'll have to insert the name of your image file manually.

I think this is as far as you'll get Texmaker; I don't see any way of customizing the LaTeX\includegraphics{file} menu entry, which you seem to be using so far.

-
as i pointed out menu items are hard-coded, but - indeed - auto completion can be customized – long tom Nov 15 '12 at 8:10
thanks long tom and doncherry. So it's not possible the way I wanted it, but that's a good solution. Long tom's post is really the 'answer' to my question, but the workaround is useful so I'll put the tick here. I hope that's ok. – craq Nov 19 '12 at 6:55
@craq Glad it helped! I think it's ok to accept the answer that helped you the most; the check is kind of a subjective judgment by the asker. (Of course I would say that, I get the points `;)`.) Regarding Texmaker functionality, you could make a feature request at the Texmaker isses site if you want. – doncherry Nov 19 '12 at 6:58
I can agree... it's not always the 'ultimate correct' answer that helps you out... – long tom Nov 20 '12 at 6:39

I'm afraid this is hard-coded in texmaker... (source code: texmaker.cpp, line 5521, in current version: 3.5.2)

So i guess the only way to change it, is to alter the source code and compile it...

-