# Kile: How can I insert repeated code snippet and make keyboard shortcut in kile for LaTeX?

To insert figures in LaTeX document I use this code repeatedly:

%%%%%%%%%%%%%%%%%%%%%%%%%%% figure environment start %%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[hb!]
\centering
\includegraphics [scale=0.35]{images/fig1.eps}
\caption{mycaption.}
\label{fig:fig1}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure environment end %%%%%%%%%%%%%%%%%%%%%%%%%%%%


Is there any way i can make macro of this code block and create a keyboard shortcut such as CTRL+Shift+f that automatically insert this code.

Or, could we write a snippet and so that i can insert this code block in KILE text editor. I know how to make template in kile but what I need is shortcut key that inserts this piece of code automatically.

Maybe I can create a simple text file somewhere in kile directory and use it. But I don't know how to do this.

Any suggestions will be greatly appreciated!

• Welcome! Since you already saw the questions concerning snippets, could you explain the problem? Why can't you just define the snippet and assign it a shortcut? That works fine for me. – cfr Apr 12 '16 at 19:38