Texstudio \begin{subfigure} unbekannter Befehl

Texstudio \begin{subfigure} unbekannter Befehl

Ich verwende das Subcaption-Paket, um in meinem Dokument Unterabbildungen wie folgt zu erstellen:

\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}[ht]
\begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{images/1.png}
    \caption{Subcap1}
    \label{fig:1}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
    \includegraphics[width=\textwidth]{images/2.png} 
    \caption{Subcap2}
    \label{fig:2}
\end{subfigure}
\caption{Cap}
\label{fig:3}
\end{figure}

\end{document}

Dies wird einwandfrei kompiliert, aber im Texstudio-Editor werden \begin{subfigure}und \end{subfigure}als „unerkannter Befehl“ hervorgehoben. Ich habe versucht, die CWL-Dateien „Caption“, „Subcaption“, „Subfig“ und „Subfigure“ unter „Optionen > Vervollständigung“ zu aktivieren, aber die Hervorhebung wird dadurch nicht entfernt.

Dies hat zwar keinen Einfluss auf die Kompilierung, ist aber ziemlich ärgerlich. Übersehe ich etwas oder verwende ich die Pakete falsch?

Antwort1

Speichern Sie dies subcaptionTemp.cwlals ~/.config/texstudio/oder %APPDATA%\texstudio\!

# manipulated the auto-generated subcaption.cwl for Holt
# subcaption package
# Axel Sommerfeldt 04/16/2013
# URL: http://mirror.switch.ch/ftp/mirror/tex/help/Catalogue/entries/subcaption.html

#include:caption
#
#
# Chapter 1 Loading the package
#
#
\captionsetup[sub]{%<options%>}
#keyvals:\captionsetup
margin=%<num%>pt
margin={%<left amount%>,%<right amount%>}
margin*=%<num%>pt
margin*={%<left amount%>,%<right amount%>}
font=#scriptsize,footnotesize,small,normalsize,large,Large,normalfont,up,it,sl,sc,md,bf,rm,sf,tt,singlespacing,onehalfspacing,doublespacing,{strech=%<amount%>},normalcolor,{color=%<colour%>},normal
font+=#scriptsize,footnotesize,small,normalsize,large,Large,normalfont,up,it,sl,sc,md,bf,rm,sf,tt,singlespacing,onehalfspacing,doublespacing,{strech=%<amount%>},normalcolor,{color=%<colour%>},normal
font={%<option 1%>,%<option 2%>}
labelfont=#scriptsize,footnotesize,small,normalsize,large,Large,normalfont,up,it,sl,sc,md,bf,rm,sf,tt,singlespacing,onehalfspacing,doublespacing,{strech=%<amount%>},normalcolor,{color=%<colour%>},normal
labelfont+=#scriptsize,footnotesize,small,normalsize,large,Large,normalfont,up,it,sl,sc,md,bf,rm,sf,tt,singlespacing,onehalfspacing,doublespacing,{strech=%<amount%>},normalcolor,{color=%<colour%>},normal
labelfont={%<option 1%>,%<option 2%>}
textfont=#scriptsize,footnotesize,small,normalsize,large,Large,normalfont,up,it,sl,sc,md,bf,rm,sf,tt,singlespacing,onehalfspacing,doublespacing,{strech=%<amount%>},normalcolor,{color=%<colour%>},normal
textfont+=#scriptsize,footnotesize,small,normalsize,large,Large,normalfont,up,it,sl,sc,md,bf,rm,sf,tt,singlespacing,onehalfspacing,doublespacing,{strech=%<amount%>},normalcolor,{color=%<colour%>},normal
textfont={%<option 1%>,%<option 2%>}
labelformat=#default,empty,parens,simple,brace
labelsep=#none,period,space,quad,colon,newline,endash
skip=%<num%>pt
list=#false,true,no
hypcap=#false,true
indention=%<amount%>pt
position=#auto,top,above,bottom,below
#endkeyvals
#
#
# Chapter 2 The \subcaption command
#
#
\subcaption{heading}#/minipage
\subcaption[list entry]{heading}#/minipage
\subcaption*{heading}#/minipage
\setcaptionsubtype#S
\setcaptionsubtype*#S
#
#
# Chapter 3 The subfigure & subtable environments    
#
#
\begin{subfigure}{width}
# pos can be b (default: )
\begin{subfigure}[pos]{width}
\begin{subtable}{width}
\begin{subtable}[pos]{width}
\end{subfigure}
\end{subtable}
\captin@For{subtyelist}#S
#
#
# Chapter 4 The \subcaptionbox command
#
#
# inner-pos can be c, l, r, s (default: c)
\subcaptionbox[list entry]{heading}[width][inner-pos]{contents}
\subcaptionbox[list entry]{heading}[width]{contents}
\subcaptionbox[list entry]{heading}{contents}
\subcaptionbox{heading}[width][inner-pos]{contents}
\subcaptionbox{heading}[width]{contents}
\subcaptionbox{heading}{contents}
\subcaptionbox*{heading}[width][inner-pos]{contents}
\subcaptionbox*{heading}[width]{contents}
\subcaptionbox*{heading}{contents}
#
#
# Chapter 5 The \DeclareCaptionSubType command
#
#
# numbering-pos can be arabic, roman, Roman, alph, Alph, fnsymbol... (defaul: alph)
\DeclareCaptionSubType[numbering scheme]{float type}#*d
\DeclareCaptionSubType{float type}#*d
\DeclareCaptionSubType*[numbering scheme]{float type}#*d
\DeclareCaptionSubType{float type}#*d
#
#
# Chapter 6 References
#
#
\thesubfigure#S
\thesubtable#S
\p@subfigure#S
\p@subtable#S
\subref{key}#*r
\subref*{key}#*r
#keyvals:\captionsetup
subrefformat=#parens
#endkeyvals
\phantomsubcaption
# other commands
\subfigureautorefname#S
\subfigurename#S
\subtableautorefname#S
\subtablename#S
\theHsubfigure#S
\theHsubtable#S

Gehen Sie dann zu Ihren Einstellungen und laden Sie diese Datei:

Bildbeschreibung hier eingeben


Ich freue mich über jede Rückmeldung. Wenn das für Sie gut funktioniert, werde ich es an die Betreuer von TXS weiterleiten.

verwandte Informationen