cdominik / cdlatex

Fast input methods to enter LaTeX environments and math with GNU Emacs
231 stars 48 forks source link

The figure environment #29

Closed linwaytin closed 3 years ago

linwaytin commented 3 years ago

For now, the default figure and figure* environments are structured like

\begin{figure}[htbp]
\centerline{\includegraphics[]{xxxxxxx}}
\caption[]{\label{xxxx} }
\end{figure}

I would suggest changing the default to like

\begin{figure}[htbp]
\centering
\includegraphics[]{xxxxxxxx}
\caption[]{}
\label{xxxx}
\end{figure}

which seems more popular. I'm not a LaTeX expert, but \centerline seems not a good option here?

Or, is there an easy way to customize the environment?

cdominik commented 3 years ago

Hi,

you can certainly customize the figure environment, using the variable cdlatex-env-alist, for example like this:

(setq cdlatex-env-alist '(("figure" "\begin{figure}[htbp] \centering \includegraphics[]{AUTOFILE} \caption[]{?} AUTOLABEL \end{figure}" nil) ("figure" "\begin{figure}[htbp] \centering \includegraphics[]{AUTOFILE} \caption[]{?} AUTOLABEL \end{figure}" nil)))

For now, I am not changing the default, we would have to have more support for this request.

Regards

Carsten Dominik

linwaytin commented 3 years ago

Thank you!

linwaytin commented 3 years ago

Excuse me, I have tried the code you gave, but the AUTOLABEL does not work. it does not ask for a label. Do you know why?

cdominik commented 3 years ago

Hi,

Autolabel works if you also use RefTeX.

Carsten

On Fri, Jul 9, 2021, 01:56 linwaytin @.***> wrote:

Excuse me, I have tried the code you gave, but the AUTOLABEL does not work. it does not ask for a label. Do you know why?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/cdominik/cdlatex/issues/29#issuecomment-876815550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIABPK2KB5EMTEY4N4RZ3TWY3J5ANCNFSM472Z524Q .

linwaytin commented 3 years ago

I didn't know that. Thanks!