3

I'd like for RefTeX to know about labels defined by tcbtheorem environments. Here's an example where RefTeX does not find the relevant label...

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{theorem}{Theorem}{}{thm}
\begin{document}

\begin{theorem}{Important theorem}{foobar}
  Test of theorem.
\end{theorem}

Reference to theorem: \ref{thm:foobar}.

\end{document}

The most similar question I can find is RefTeX not finding `label={name}` in custom environment, but it doesn't quite answer the question for me.

1 Answer 1

1

RefTeX is not able to parse the label prefix argument defined in \newtcbtheorem and then add it to the label definition foobar so you can reference thm:foobar. If you can skip the prefix and add it manually to each label definition, you probably can use the technique described in RefTeX manual under 15 Problems and Work-arounds and do something like this in your init file:

(setq reftex-label-alist
      '(("\\begin{theorem}{}{*}" ?o "thm:" "~\\ref{%s}" 3)))

This way, RefTeX should be able to detect your label definition and support referencing it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .