# [Tex/LaTex] Refer to the “name” of an equation, while a List of Equations is generated using these names

cleverefequationslistssubequations

I link two questions below because I use their solution, to number my equations and generate a list of my equations.

Although they might not be directly relevant, I mention I use them because I am not sure if this messes up possible solutions.

Below my MWE. This works fine so far (Figures attached).

But I want the "list name" of my equation (in this case: \myequations{PDE of the diffsion process}) to be available as a kind of variable so that
I can refer to it as "The \XXX is given by", where \XXX is a command giving me the Name (\myequations{...}) of the equation I refer to (e.g., \tag{\ref{eq:litdiff}}).

I hope my equation is clear, if not, please tell.

MWE:

\documentclass[12pt]{report}
\usepackage{tocloft}
\usepackage{amsmath}
\usepackage{physics}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}

\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\setlength{\cftmyequationsnumwidth}{2.5em}

\newcommand{\subs}{\text{s}}

\begin{document}

\listofmyequations

\chapter{Diffsion}

The PDE of the diffsion process is given by
\begin{subequations}\label{eq:litdiff}
$$\pdv{}{t} (\widetilde{c}_{\subs}(r,z,t)+c_{\subs,0})=\frac{D_{\subs}}{r^{2}}\pdv{}{r} \left(r^{2}\frac{\partial (\widetilde{c}_{\subs}(r,z,t)+c_{\subs,0})}{\partial r}\right) \tag{\ref{eq:litdiff}}$$
\myequations{PDE of the diffsion process}
\noindent The boundary conditions of Eq.~\eqref{eq:litdiff} are given by
\begin{align}
D_{\subs}\pdv{}{r} \widetilde{c}_{\subs}(0,z,t) &= 0 \label{eq:diffusionpartialdiff_boundaries0}\\
D_{\subs}\pdv{}{r} \widetilde{c}_{\subs}(R_{\subs},z,t) &= -j(z,t)\label{eq:diffusionpartialdiff_boundariesRs}
\end{align}
and the initial condition is given by
$$\widetilde{c}_{\subs}(r,z,0) = 0 \quad r\in [0;R_{\subs}]. \label{eq:diffusionpartialdiff_init}$$
\end{subequations}

\end{document}


Here is one way to incorporate \mylabel into \myequation. The \makeatletter...\makeatother is needed due to the @ symbols used in \protected@write and \@auxout.

\documentclass[12pt]{report}
\usepackage{tocloft}
\usepackage{amsmath}
\usepackage{physics}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}

\makeatletter
{\newcommand{\mylabel}[2]% #1=name, #2 = contents
{\protected@write\@auxout{}{\string\newlabel{#1}{{#2}{\thepage}%
{\@currentlabelname}{\@currentHref}{}}}}}%
{\newcommand{\mylabel}[2]% #1=name, #2 = contents
{\protected@write\@auxout{}{\string\newlabel{#1}{{#2}{\thepage}}}}}
\makeatother

\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[2][\empty]{% #1 = label (optional), #2 = description
\ifx#1\empty\else\mylabel{#1}{#2}}
\setlength{\cftmyequationsnumwidth}{2.5em}

\newcommand{\subs}{\text{s}}

\begin{document}

\listofmyequations

\chapter{Diffsion}

The \ref{desc:litdiff} is given by
\begin{subequations}\label{eq:litdiff}
$$\pdv{}{t} (\widetilde{c}_{\subs}(r,z,t)+c_{\subs,0})=\frac{D_{\subs}}{r^{2}}\pdv{}{r} \left(r^{2}\frac{\partial (\widetilde{c}_{\subs}(r,z,t)+c_{\subs,0})}{\partial r}\right) \tag{\ref{eq:litdiff}}$$
\myequations[desc:litdiff]{PDE of the diffsion process}% to avoid adding an extra space
\medskip% same effect as \par\noindent
The boundary conditions of Eq.~\eqref{eq:litdiff} are given by
\begin{align}
D_{\subs}\pdv{}{r} \widetilde{c}_{\subs}(0,z,t) &= 0 \label{eq:diffusionpartialdiff_boundaries0}\\
D_{\subs}\pdv{}{r} \widetilde{c}_{\subs}(R_{\subs},z,t) &= -j(z,t)\label{eq:diffusionpartialdiff_boundariesRs}
\end{align}
and the initial condition is given by
$$\widetilde{c}_{\subs}(r,z,0) = 0 \quad r\in [0;R_{\subs}]. \label{eq:diffusionpartialdiff_init}$$
\end{subequations}

\end{document}