GeneralAcronyms in Macros Worth It?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Acronyms in Macros Worth It?

Post by LaTexLearner »

Is it worth it to use acronyms to save space in macros?

For example, instead of writing

Code: Select all


\newcommand{\mynewmacro}{\blahblahblah}

Is it worth it to instead write:

Code: Select all


\newcommand{\MNM}{\blahblahblah} %MNM = my new macro

Or perhaps, in the preamble, make a "glossary" of all the acronyms? Or is it better to simply write out the names of all macros with whole words?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Acronyms in Macros Worth It?

Post by Stefan Kottwitz »

Technically, the length of a macro name doesn't matter.

In my opinion, the macro names should just have the right balance of being easily readable versus typing effort, for you. I prefer to type a bit more but to have better understandable names, no cryptic abbreviations.

Stefan
LaTeX.org admin
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Re: Acronyms in Macros Worth It?

Post by LaTexLearner »

ok, got it
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Acronyms in Macros Worth It?

Post by Johannes_B »

Bad example: Some people define \def\be{\begin{equation}. Please never, never do stuff like that.

If you are giving the code away, for a friend to proof-read or to the copy-editor, the cursing will begin soon after, because the document is extremely hard to read. Imaging talking like that in real life. ;-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Acronyms in Macros Worth It?

Post by LaTexLearner »

Johannes_B wrote:Bad example: Some people define \def\be{\begin{equation}. Please never, never do stuff like that.

If you are giving the code away, for a friend to proof-read or to the copy-editor, the cursing will begin soon after, because the document is extremely hard to read. Imaging talking like that in real life. ;-)
Heh, there does not appear to me to be a purpose to making a macro that "summarizes" a single command.

Is that what makes it a bad example?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Acronyms in Macros Worth It?

Post by Johannes_B »

It is just unreadable for everybody but you, it disguises the meaning of beginning an equation. If you want to save some time typing, get a decent text editor that helps you. Typing beq␣ could be expanded to \begin{equation}. Easy to type, easy to read.

On the other hand, some environments cannot be disguised that way
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply