SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 365 forks source link

Prefix auto label by section #1290

Open tobiasdiez opened 6 years ago

tobiasdiez commented 6 years ago

The auto-label feature works really nice. However, for bigger projects (like a thesis or book) one may want to structure the labels a bit more and e.g. preappend the label for the section. It would be nice if LatexTools could be configured to do this automatically.

\begin{equation}
    \label{eq: <>} // Here no context is available and thus use nothing as prefix  
\end{equation}

\section{First section}
\label{sec:first}

\begin{equation}
    \label{eq:first: <>} // We are in the first section, so prepend "first"  
\end{equation}
lirm-math commented 6 years ago

That is helpful but may be difficult to implement or design.
And #1290 reminds me of Hungarian notation.

Some of the authors would like to add \labels to sections, while some not. it is difficult to design the algorithm generating prefixes.

Some environments are user-defined by means of \newtheorem. You can never include everything \newtheoremed by authors.

The \items inside an enumerate may also be \labeled, but the enumerate may be insie another enumerate.