Hi all

Almost all LaTeX source files I receive from colleagues have dozens or
more definitions of the sort 

\newcommand{\fluidenergy}[1]{\underline{E}_{\partial \Phi;#1}}
\newcommand{\eq}[2]{
\begin{equation}\label{E:#1}
\begin{aligned}
  #2
\end{aligned}
\end{equation}
}
\newcommand{\rrho}{\rho}

etc 

I understand that this might be a little faster for typing (if one
remembers all the definitions 😇), but it causes problems

    1. The Emacs, AuCTeX filling functions will not work properly

    2. The prettify-mode will not work as expected (and I am going to
       add these definitions to the tex--prettify-symbols-alist
       (add-to-list 'tex--prettify-symbols-alist more)) 

So usually I expand (query-replace) the most annoying definitions.

Do you think that could be done somehow in a bit more automated way.

For example
 
\newcommand{\fluidenergy}[1]{\underline{E}_{\partial \Phi;#1}}
^cursor

Run magic, auctex-replace-macro-in-buffer

That magic lisp function would scan the line, 

    1. Observe  what is the definiens (\fluidenergy)

    2. Observe what is the  definiendum, \underline{E}_{\partial
       \Phi;#1}

But then would run query-replace correctly?

Do you think that is possible

Now that I realize it, I think I will also write the auctex-dev list


Kind regards

Uwe Brauer

-- 
I strongly condemn Hamas heinous atrocities on Israel, especially the 
despicable pogroms.
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the NATO membership of Ukraine.
I support the EU membership of Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to