0

I want to introduce some command renaming. It is usually claimed that definitions are to be included in the preamble, with the document text put within the document body. What are the considerations that would put the definition of commands within the body, rather than in the preamble?

\makeatletter

\let\pipe\galex@pipe \let\divid\galex@divid \let\bfblue\galex@bfblue \let\nopari\galex@nopari \let\pari\galex@pari

\makeatother

Veak
  • 1
  • 1
    It should be all right, but some documentclasses or packages will be hooked at the end of the preamble or after \begin{document}. – Clara Sep 06 '22 at 14:02
  • I am using my own sty files. I suppose there are specific commands for hooking after the preamble. Right? – Veak Sep 06 '22 at 14:20
  • 1
    Sorry to be blunt, but like most of your question also this one is pretty cryptic. Whether you should do that in the preamble or not depends on what you are actually trying to do, and as your usual you are not very clear about that. I'd say the preamble is fine, but who knows... anyway you can delay code by putting it into \AtBeginDocument{...}. – campa Sep 06 '22 at 15:04
  • Am not against bluntness. Will put more detail. – Veak Sep 06 '22 at 15:07
  • why would you want definitions in-document at all? place the \let commands in mynames.sty and use \usepackage{mynames} in the preamble, allowing re-use and cleaner document structure. – David Carlisle Sep 06 '22 at 16:58
  • what is your actual question? – David Carlisle Sep 06 '22 at 17:01
  • Shall take your re-use and cleaner structure as instructed. I figured that after using \catcode``-=11, the way to reset it is \catcode``-=12. The question was about some information about situations when one would hook commands after the promable. – Veak Sep 06 '22 at 18:21
  • You might sometimes want definitions after begin document but never with @ commands and preferably not using \let which is not a latex command. – David Carlisle Sep 06 '22 at 18:24
  • Fine, what would be your recommendation instead of \let? – Veak Sep 06 '22 at 18:29
  • \newcommand or (in recent releases) \NewCommandCopy – David Carlisle Sep 06 '22 at 20:35
  • @ close voters: I actually find this question rather clear, and the comments by Clara and campa contain the core of the answer, which indicates that they understood the question (even before the edit). At least the OP seems to move towards more established coding practises :) Voting to leave open. – Marijn Sep 07 '22 at 13:43

0 Answers0