#413 Commands creating new environment

open
nobody
None
5*
2014-08-17
2013-03-12
Anonymous
No

A few packages have commands which provide new environments, however TeXstudio does not seem to recognise them and more importantly, does not seem to offer a way of manually adding them.

For example, the enumitem package provides the command \newlist but it does not recognise the new list. Additionally, thmtools only works if the entire \declaretheorem command is given on the one line, but if it is split, no longer works as demonstrated in this minimal working example.

\documentclass{article}

\usepackage[shortlabels]{enumitem}
\usepackage{thmtools}

\newlist{testlist}{enumerate}{5}
\setlist[testlist]{label=\fbox{x}}

\declaretheorem[refname=The Theorem]
    {Theorem}

\begin{document}

\begin{testlist}
    \item 1
    \item 2
\end{testlist}

\begin{Theorem}
    $a^2 + b^2 = c^2$
\end{Theorem}

\end{document}

This was on Windows and in version 2.5.2 (SVN 3661).

Discussion

  • Tim Hoffmann
    Tim Hoffmann
    2013-03-14

    Defining new commands works via cwl files. See the user manual. TXS even tries to autogenerate them from the latex sources. This does not work for all cases, but for enumitem and \newlist it does. You may need to restart, before the autogenerated cwl is used.

    Due to limitations of the parser (line-based) commands split across multiple lines cannot be handled correctly.

     
    Last edit: Tim Hoffmann 2013-03-14