0

Eg. I want it to, when I type \begin{figure} and press enter, autocomplete the following:

\begin{figure}[!htb]
   \centering
   \includegraphics[width=\textwidth]{}
   \caption{}
   \label{}
\end{figure}

I am using TexStudio and \usepackage{graphicx}

I know that when I type for example \begin{itemize}, it autocompletes the following:

\begin{itemize}
   \item
\end{itemize}

So my question is: Is there a way to customize what autocompletes when entering certain commands?

Thank you.

campa
  • 31,130
Rvan8
  • 23

2 Answers2

1

You can make a macro as mentioned by @Sigur, or define the autocompletion in your own cwl. For example, you can create a file usercmds.cwl containing

# usercmds.cwl
\begin{figure}[!htb]%\  \centering%\    \includegraphics[width=\textwidth]{}%\  \caption{}%\    \label{}%\\end{figure}

and follow the instructions outlined here to permanently activate completion from this cwl.

mbert
  • 4,171
0

The other solution I have is to create a macro \myfigure. You can add a shortcut to it or have the command to automatically replace it. Here is the config

enter image description here

anis
  • 1,510
  • 5
  • 13