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.

3
  • You can create a macro and give a shortcut to it.
    – Sigur
    Oct 22, 2021 at 10:55
  • Also if you use \centering all the time, you can look at tex.stackexchange.com/a/53383/56823.
    – Archange
    Oct 22, 2021 at 11:26
  • 2
    Technically, this is an editor question, not a LaTeX question. Oct 22, 2021 at 14:31

2 Answers 2

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .