Automatische Beschriftungsformeln mit (*) und (**) statt Zahlen

Automatische Beschriftungsformeln mit (*) und (**) statt Zahlen

Wie im Titel beschrieben, möchte ich Formeln in bestimmten Umgebungen (z. B. Beweisen) mit (*), (**), ... statt mit Nummerierung kennzeichnen. Gibt es eine Möglichkeit, dies zu erreichen?

Antwort1

Etwas wie das?

Bildbeschreibung hier eingeben

Dies funktioniert hyperrefauch bei mehrfachem Vorkommen von **(was dann allerdings unklar ist), solange der Idiotenzähler proofnicht zurückgesetzt wird.

Die Gleichungsnummer wird zuerst erweitert, bevor sie in verwendet wird \loopstars.

Dies führt natürlich zu Problemen, wenn mehr als 10 Symbole vorhanden sind, d. h. die Gleichung „Zahl“ wird zu breit!

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newcounter{starcnt}
\makeatletter
\newcommand{\loopstars}[1]{%
  \c@starcnt\z@%
  \loop\unless\ifnum\c@starcnt = #1%
  \advance \c@starcnt by \@ne%
  *%
  \repeat%
}
\makeatother

\newcounter{proof}
\usepackage{xpatch}

\makeatletter
\AtBeginEnvironment{proof}{%
  \refstepcounter{proof}%
  \renewcommand{\theHequation}{equation.\arabic{proof}.\arabic{equation}}
  \renewcommand{\theequation}{\protect\loopstars{\number\value{equation}}}
}

\makeatother

\usepackage{hyperref}


\begin{document}

In \eqref{foo} we see that and in \eqref{foobar}


\begin{proof}
  \begin{equation}
    E=mc^2
    \end{equation}  
    \begin{align}
      E=mc^2 \label{foo} \\
      E=mc^2
 \end{align}    
\end{proof}

\clearpage
\setcounter{equation}{0}
\begin{proof}
  \begin{equation}
    E=mc^2
    \end{equation}  
    \begin{align}
      E=mc^2 \label{foobar} \\
      E=mc^2
 \end{align}    
\end{proof}

Code Golfen voraus

  \documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newcounter{starcnt}
\newcounter{proof}
\newcounter{dummycntr}

\newcommand{\mynumberingplaceholder}{$\int\!$}
\makeatletter
\newcommand{\loopsymbols}[1]{%
  \raggedleft%
  \c@starcnt\z@%
  \loop\unless\ifnum\c@starcnt = #1%
  \advance \c@starcnt by \@ne%
  \mynumberingplaceholder%
  \repeat%
}
\makeatother

\usepackage{xpatch}

\makeatletter
\AtBeginEnvironment{proof}{%
  \refstepcounter{proof}%
  \renewcommand{\theHequation}{equation.\arabic{proof}.\arabic{equation}}
  \renewcommand{\theequation}{\protect\loopsymbols{\number\value{equation}}}
}

\makeatother

\usepackage{hyperref}


\begin{document}

In \eqref{foo} we see that and in \eqref{foobar}


\begin{proof}
  \begin{equation}
    E=mc^2
    \end{equation}  
    \begin{align}
      E=mc^2 \label{foo} \\
      E=mc^2
    \end{align} 
    \loop\unless\ifnum\value{dummycntr} = 10
    \stepcounter{dummycntr}
    \begin{equation}
      c^2 = a^2 +b^2 \\
    \end{equation}  
    \repeat
\end{proof}

\clearpage
\setcounter{equation}{0}
\begin{proof}
  \begin{equation}
    E=mc^2
    \end{equation}  
    \begin{align}
      E=mc^2 \label{foobar} \\
      E=mc^2
 \end{align}    
\end{proof}



\end{document}

Bildbeschreibung hier eingeben

Antwort2

Aufbauend auf Christians Ideen gibt es hier eine Version, die die Gleichungsnummer in den Beweisen zurücksetzt und die äußeren auf dem Standard belässt. Sie ermöglicht auch das (lokale) Ändern des Symbols in einer bestimmten proofUmgebung (Standard sind Sternchen).

\documentclass{article}

\usepackage{amsmath,amsthm,xpatch}
\usepackage{hyperref}

\ExplSyntaxOn
\cs_new:Npn \stars #1
 {
  \prg_replicate:nn { \use:c { c@#1 } } { \l_anhoa_eqsym_tl }
 }
\tl_new:N \l_anhoa_eqsym_tl
\NewDocumentCommand{\seteqsymbol}{m}
 {
  \tl_set:Nn \l_anhoa_eqsym_tl { #1 }
 }
\ExplSyntaxOff
\seteqsymbol{*} % initialize

\newcounter{saveequation}
\newcounter{proof}
\xapptocmd{\proof}
 {%
  \stepcounter{proof}%
  \setcounter{saveequation}{\value{equation}}%
  \setcounter{equation}{0}%
  \renewcommand{\theequation}{\stars{equation}}%
  \renewcommand{\theHequation}{\theproof.\arabic{equation}}%
 }{}{}
\xapptocmd{\endproof}
 {\setcounter{equation}{\value{saveequation}}}
 {}{}

\begin{document}

Here is an equation
\begin{equation}
a=b
\end{equation}

\begin{proof}
This is an important equation
\begin{equation}
0=0\label{a}
\end{equation}
Note that \eqref{a} together with
\begin{equation}
0=0
\end{equation}
ends the proof.
\end{proof}

\begin{proof}\seteqsymbol{\ensuremath{\vee}}
This is an important equation
\begin{equation}
0=0\label{b}
\end{equation}
Note that \eqref{b} together with
\begin{equation}
0=0
\end{equation}
ends the proof.
\end{proof}

Here is an equation
\begin{equation}
a=b
\end{equation}

\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen