1

When I type \begin{figure}, it is automatically filled to the following:

\begin{figure}
    \centering
    \includegraphics{}
    \caption{Caption}
    \label{fig:enter-label}
\end{figure}

Is it possible to change this (and other automatically filled pieces of code) to another default? For example like this:

\begin{figure}[H]
    \centering
    \includegraphics[width=\textwidth]{}
    \caption{Caption}
    \label{fig:enter-label}
\end{figure}

I am now addding the float and width options manually for every figure, but I wonder if there is a way to automate this.

Thanks in advance!

8
  • 1
    For float placements you can change the macro \fps@<type>, so to change figure you can use \renewcommand\fps@figure{H}. For \includegraphics, take a look here: tex.stackexchange.com/questions/439918/…
    – Skillmon
    Commented May 7 at 11:04
  • 5
    "it is automatically filled to the following" This sounds like something your editor would do, but you don't tell us which editor you use. Commented May 7 at 11:06
  • 5
    (also are you sure that using [H] by default is a good idea? This will lead to awful results as you don't allow latex to properly position the figures.) Commented May 7 at 11:08
  • 3
    Welcome to TeX.SE! Which editor do you use? WinEdt, TeXStudio etc.?
    – Mensch
    Commented May 7 at 11:26
  • 2
    Your question is just about overleaf as the completion is unrelated to tex which only sees the expanded text. I don't think you can add more text fragments in overleaf. Defaulting H is certainly not ideal as it means you are adding a float and disabling it by default, it would be simpler not to add the float at all. Commented May 7 at 15:56

0

Browse other questions tagged .