2

I am trying to preserve a history of the latex commands and environment initializations I use in a typeset html or pdf file. Is there a way where I can force a pre-process action on all commands defined in my document or external packages without having to redefine them all manually, or run a script on all my files to pre-process the commands (kind of like the way lilypond does in producing modified copies of all tex files)? I would like to declare a macro that is run on every (expandable command) and treats any document command as a string and gives it actions.

I don't think these details are needed for this question, but these actions would look something like:

  1. A refname call (not ideal because I think this only works on labels, so maybe verbatim, if this could be applied to the content of #1.
  2. An execution call
  3. Places these together in a hyperref (or some other way to customize the retrieval of two superimposed text objects).

Descriptive Example that won't work

\documentclass[10pt]{article}
\usepackage{xparse}
\usepackage{siunitx}
\usepackage{natbib}
\usepackage{cleveref}
\DeclareDocumentCommand{\WorkContentBlock}{ m }{%
     \href{\refname{#1}}{#1}%
     %refname or other custom verb command to display the command as a string
     %
}
\begin{document}
    Show the latex string of \cite{XXX,YYY} or \cref{label:A}
\end{document}

Please note: Not a duplicate of Display shortcuts other than urls with href because (while they are part of the same proposal) this linked question assumes that I have successfully implemented the answer to this question or coded it manually).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.