Using LaTeX Macros as Shortcuts

57 views
Skip to first unread message

Thomas Judson

unread,
May 31, 2021, 10:40:19 AM5/31/21
to pretext...@googlegroups.com
I’m just curious about the prevailing option on using LaTeX macros as shortcuts. For example, one might declare the following:

\newcommand{\Z}{\mathbb{Z}}

and then write <m>\Z</m> instead of <m>\mathbb Z</m>. Yes, this would save you a few keystrokes, but I am against this for the following reasons.

1. There is no standard way of doing this. If you are modifying someone else’s PreTeXt, macros such as this can be a real pain.

2. Declaring new commands can come back to haunt you if you are not careful.

3. This could become a big annoyance if several people are working on a project.

How do others feel about this?

Tom

David Farmer

unread,
May 31, 2021, 12:16:00 PM5/31/21
to pretext...@googlegroups.com

If we want to be able to share source across documents, everyone
(everyone who wants to come to the party) has to agree to use the
same macros. For example:

macro meaning
----- -------

\Z rational integers
\Q rational numbers
\C complex numbers
\R real numbers
\GL general linear group

In the last case, the macro expects 2 arguments, as in
\GL{2}{\R}
for the group of 2 \by 2 invertible matrices with real entries.

Work needs to be done to come up with a list of macros which
people can agree to use.

If a group comes up with such a list, I volunteer to convert all
the source files and send a pull request with the agree-upon macros.

A way thwart sharing of source material is for everyone to expand
their macros. Are the reals a bold R or a blackboard-bold R?
Are the 2 \by 2 invertible real matrices GL(2, \R) or GL_2(\R) ?

If the macro is the same, everyone can define the macro as they wish.
People can share source even though they use different notation.

Regards,

David

ps. "shortcuts" are bad. Semantic macros are good.
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/07B013E9-F354-4995-9086-64DE01BDDD48%40gmail.com.
>

Rob Beezer

unread,
May 31, 2021, 1:38:20 PM5/31/21
to pretext...@googlegroups.com
On 5/31/21 9:15 AM, David Farmer wrote:
> Work needs to be done to come up with a list of macros which
> people can agree to use.

A project to discuss, catalog, and document such macros would be a very valuable
project. It'd be a great complement to PreTeXt and could be leveraged to create
some big improvements in the accessibility of mathematics.

Rob


Sean Fitzpatrick

unread,
May 31, 2021, 4:20:47 PM5/31/21
to PreTeXt support
The \C command might need to be defined with some logic. In xelatex it already has some meaning.
(Or is it pdflatex? In any case, one engine will give you an error and the other doesn't.)

There's a long list of macros (some semantic, some less so) in APEX that were contributed (I think) by Alex.
I could maybe check in with Alex, and between APEX and ORCCA there's probably a good start to such a catalogue.
(Presumably we'd offer those up with the understanding that others will find many things to object to.)

Rob Beezer

unread,
Jun 1, 2021, 12:11:07 AM6/1/21
to pretext...@googlegroups.com
On 5/31/21 1:20 PM, Sean Fitzpatrick wrote:
> The \C command might need to be defined with some logic. In xelatex it already
> has some meaning.
> (Or is it pdflatex? In any case, one engine will give you an error and the other
> doesn't.)

That's crazy! ;-)

> There's a long list of macros (some semantic, some less so) in APEX that were
> contributed (I think) by Alex.
> I could maybe check in with Alex, and between APEX and ORCCA there's probably a
> good start to such a catalogue.
> (Presumably we'd offer those up with the understanding that others will find
> many things to object to.)

I have a battle-tested collection for linear algebra, some of which *I* would
object to!

Rob

arech...@gmail.com

unread,
Jun 1, 2021, 12:36:44 PM6/1/21
to PreTeXt support
This very topic came up last week in some local efforts to port CLP questions to the prairielearn platform.... are vectors bold-face or do they have little arrows on top. To an extent it doesn't matter (is concern for the 'publisher' perhaps over the 'author' maybe?). So rather than worrying too much - we decided (or at least I think we did) to just write all vectors as \vec{blah} and then redefine \vec if needed.

I'm not sure that it is really possible to make a list that will work for everyone... I think it is easy to rule out some macros, but very hard to rule them in. We had a reasonable list of macros for CLP - which are <sarcasm> perfect and never caused any internal problems or confusions</sarcasm>.

So I'll (+1)^n David's comment "shortcuts bad, semantic macros good".

I can imagine that it is easier to make a good list of semantic macros... but that those macros are (in general) cumbersome to type. What I could imagine doing is authors having their own local macro list which works nicely for them... and then having a (sorry Rob) post-processing script that translates "my idiosyncratic shortcuts to good wholesome semantic macros".

Rob Beezer

unread,
Jun 1, 2021, 6:34:23 PM6/1/21
to pretext...@googlegroups.com
Agreed, with one nit:

> but that those macros are (in general) cumbersome to type

And I find it *much more* cumbersome to remember just which short form is the
abbreviated version. Rather than interrupting myself to check someplace if it
is \t or \tran or \trans, rather than \transpose.

My experience is that I get some long line in a proof, and then copy it with
minimal edits to provide whatever progression is needed. And with semantic
macros, it is even kinda fun:

\transpose{(AB)}

becomes

\transpose{B}\transpose{A}

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/855ab87f-c6be-416b-bd5e-9eab16d2f983n%40googlegroups.com
> <https://groups.google.com/d/msgid/pretext-support/855ab87f-c6be-416b-bd5e-9eab16d2f983n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages