0

I like to use \tag and \label on an self-defined environment in the same style as for equations. But so far this leads to an error, because the amsmath equation-environment is not happy with tags not placed right behind the opening \begin{equation}.

How can I solve this?

Below is my minimal-example. I indeed use the \varwidth environment in my application in order to embed a bussproofs tree, but I omitted the latter, because it is not of interest I think

\documentclass[]{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

%opening
\title{Test}
\author{aiquita}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}

\usepackage{varwidth}

\newenvironment{myenv}
{\begin{equation*}\varwidth{.9\textwidth}}
{\endvarwidth\end{equation*}}

\begin{document}
    
    \maketitle
        
    \begin{myenv} \tag{abc} \label{cba}
        1234    
    \end{myenv}
    
\end{document}

Thanks for your help!

4
  • Change the order of equation* and varwidth inside varwidth you are in text, there \tag is not well defined.
    – daleif
    Aug 19, 2021 at 14:19
  • Hello daleif, what is set inside varwidth needs to be in text mode. In the end, I don't even need the math mode, but the capabilities of the equation environment.
    – aiquita
    Aug 19, 2021 at 14:30
  • Yes, I already have a similar solution, which uses DisplayProof from the implementation of bussproofs. The advantage over yours is that vskips are not doubled. However, I simply hoped for a more concise solution, that is indistinguishable from amsmaths equation environment. \newenvironment{eqprooftree} {\varwidth{.9\textwidth}\centering\leavevmode} {\DisplayProof\endvarwidth}
    – aiquita
    Aug 19, 2021 at 14:45
  • Moreover I may wrap the environment again and again. Finally, I want to be able to tag/label the outermost environment only.
    – aiquita
    Aug 19, 2021 at 14:52

0

You must log in to answer this question.

Browse other questions tagged .