Respectable-abbreviations macro
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
How might one write a macro that makes slovenly abbreviations respectable?
documentclassarticle
% newcommandabr...
begindocument
I've seen it in the abrOED.
enddocument
What I mean is that OED
should be rendered as O.,E.,D.
.
macros
add a comment |Â
up vote
1
down vote
favorite
How might one write a macro that makes slovenly abbreviations respectable?
documentclassarticle
% newcommandabr...
begindocument
I've seen it in the abrOED.
enddocument
What I mean is that OED
should be rendered as O.,E.,D.
.
macros
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
How might one write a macro that makes slovenly abbreviations respectable?
documentclassarticle
% newcommandabr...
begindocument
I've seen it in the abrOED.
enddocument
What I mean is that OED
should be rendered as O.,E.,D.
.
macros
How might one write a macro that makes slovenly abbreviations respectable?
documentclassarticle
% newcommandabr...
begindocument
I've seen it in the abrOED.
enddocument
What I mean is that OED
should be rendered as O.,E.,D.
.
macros
macros
asked 39 mins ago
Toothrot
1,324417
1,324417
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
3
down vote
Will only break if you pass a blank argument. If that is a worry, can be resolved with an extra relax
, as in newcommandabr[1]abraux#1relaxrelax
.
documentclassarticle
newcommandabr[1]abraux#1relax
defabraux#1#2relax%
#1.ifxrelax#2relaxdefnext@elsedefnext,abraux#2relaxfinext%
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
enddocument
1
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
add a comment |Â
up vote
3
down vote
All in all the same as the answer by Steven B. Segletes, but expandable. Also almost everything as contents should be fine (except the really unlikely endabr@
).
documentclassarticle
makeatletter
newcommandabr[1]
%
abr@#1endabr@
defabr@#1#2endabr@
%
#1.%
ifrelaxdetokenize#2relax
@%
expandafter@gobble
else
,%
expandafter@firstofone
fi
abr@#2endabr@%
makeatother
begindocument
Single letter:
abreg
Multi letter:
abrthe
enddocument
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
@StevenB.Segletesdef
is not expandable.
– Skillmon
15 mins ago
Got it. I meant to say, mine can be placed in anedef
. But you are right, the contents of theedef
are not the final expansion.
– Steven B. Segletes
13 mins ago
@StevenB.Segletes It can't be placed inside anedef
as theedef
would try to expandnext
before it gets defined.
– Skillmon
12 mins ago
1
@StevenB.Segletes no. Just tryedeftmpabrOED
right after the definition ofabr
andabraux
in your MWE. It'll throw an error.
– Skillmon
10 mins ago
 |Â
show 2 more comments
up vote
0
down vote
documentclassarticle
newcommandabr[1]abraux#1..
defabraux#1#2#3%
#1.ifx.#2defnext@else,defnextabraux#2#3fi
next
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
Here is abrXOOED abbreviation.
enddocument
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Will only break if you pass a blank argument. If that is a worry, can be resolved with an extra relax
, as in newcommandabr[1]abraux#1relaxrelax
.
documentclassarticle
newcommandabr[1]abraux#1relax
defabraux#1#2relax%
#1.ifxrelax#2relaxdefnext@elsedefnext,abraux#2relaxfinext%
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
enddocument
1
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
add a comment |Â
up vote
3
down vote
Will only break if you pass a blank argument. If that is a worry, can be resolved with an extra relax
, as in newcommandabr[1]abraux#1relaxrelax
.
documentclassarticle
newcommandabr[1]abraux#1relax
defabraux#1#2relax%
#1.ifxrelax#2relaxdefnext@elsedefnext,abraux#2relaxfinext%
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
enddocument
1
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Will only break if you pass a blank argument. If that is a worry, can be resolved with an extra relax
, as in newcommandabr[1]abraux#1relaxrelax
.
documentclassarticle
newcommandabr[1]abraux#1relax
defabraux#1#2relax%
#1.ifxrelax#2relaxdefnext@elsedefnext,abraux#2relaxfinext%
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
enddocument
Will only break if you pass a blank argument. If that is a worry, can be resolved with an extra relax
, as in newcommandabr[1]abraux#1relaxrelax
.
documentclassarticle
newcommandabr[1]abraux#1relax
defabraux#1#2relax%
#1.ifxrelax#2relaxdefnext@elsedefnext,abraux#2relaxfinext%
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
enddocument
edited 23 mins ago
answered 25 mins ago


Steven B. Segletes
150k9188396
150k9188396
1
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
add a comment |Â
1
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
1
1
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
Cheers to you :-) for your good solution. I have removed my comment. Is it correct in English language?
– Sebastiano
24 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
@Sebastiano 5:5 (loud and clear). Excellent English. Saluti!
– Steven B. Segletes
17 mins ago
add a comment |Â
up vote
3
down vote
All in all the same as the answer by Steven B. Segletes, but expandable. Also almost everything as contents should be fine (except the really unlikely endabr@
).
documentclassarticle
makeatletter
newcommandabr[1]
%
abr@#1endabr@
defabr@#1#2endabr@
%
#1.%
ifrelaxdetokenize#2relax
@%
expandafter@gobble
else
,%
expandafter@firstofone
fi
abr@#2endabr@%
makeatother
begindocument
Single letter:
abreg
Multi letter:
abrthe
enddocument
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
@StevenB.Segletesdef
is not expandable.
– Skillmon
15 mins ago
Got it. I meant to say, mine can be placed in anedef
. But you are right, the contents of theedef
are not the final expansion.
– Steven B. Segletes
13 mins ago
@StevenB.Segletes It can't be placed inside anedef
as theedef
would try to expandnext
before it gets defined.
– Skillmon
12 mins ago
1
@StevenB.Segletes no. Just tryedeftmpabrOED
right after the definition ofabr
andabraux
in your MWE. It'll throw an error.
– Skillmon
10 mins ago
 |Â
show 2 more comments
up vote
3
down vote
All in all the same as the answer by Steven B. Segletes, but expandable. Also almost everything as contents should be fine (except the really unlikely endabr@
).
documentclassarticle
makeatletter
newcommandabr[1]
%
abr@#1endabr@
defabr@#1#2endabr@
%
#1.%
ifrelaxdetokenize#2relax
@%
expandafter@gobble
else
,%
expandafter@firstofone
fi
abr@#2endabr@%
makeatother
begindocument
Single letter:
abreg
Multi letter:
abrthe
enddocument
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
@StevenB.Segletesdef
is not expandable.
– Skillmon
15 mins ago
Got it. I meant to say, mine can be placed in anedef
. But you are right, the contents of theedef
are not the final expansion.
– Steven B. Segletes
13 mins ago
@StevenB.Segletes It can't be placed inside anedef
as theedef
would try to expandnext
before it gets defined.
– Skillmon
12 mins ago
1
@StevenB.Segletes no. Just tryedeftmpabrOED
right after the definition ofabr
andabraux
in your MWE. It'll throw an error.
– Skillmon
10 mins ago
 |Â
show 2 more comments
up vote
3
down vote
up vote
3
down vote
All in all the same as the answer by Steven B. Segletes, but expandable. Also almost everything as contents should be fine (except the really unlikely endabr@
).
documentclassarticle
makeatletter
newcommandabr[1]
%
abr@#1endabr@
defabr@#1#2endabr@
%
#1.%
ifrelaxdetokenize#2relax
@%
expandafter@gobble
else
,%
expandafter@firstofone
fi
abr@#2endabr@%
makeatother
begindocument
Single letter:
abreg
Multi letter:
abrthe
enddocument
All in all the same as the answer by Steven B. Segletes, but expandable. Also almost everything as contents should be fine (except the really unlikely endabr@
).
documentclassarticle
makeatletter
newcommandabr[1]
%
abr@#1endabr@
defabr@#1#2endabr@
%
#1.%
ifrelaxdetokenize#2relax
@%
expandafter@gobble
else
,%
expandafter@firstofone
fi
abr@#2endabr@%
makeatother
begindocument
Single letter:
abreg
Multi letter:
abrthe
enddocument
answered 17 mins ago


Skillmon
19.7k11738
19.7k11738
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
@StevenB.Segletesdef
is not expandable.
– Skillmon
15 mins ago
Got it. I meant to say, mine can be placed in anedef
. But you are right, the contents of theedef
are not the final expansion.
– Steven B. Segletes
13 mins ago
@StevenB.Segletes It can't be placed inside anedef
as theedef
would try to expandnext
before it gets defined.
– Skillmon
12 mins ago
1
@StevenB.Segletes no. Just tryedeftmpabrOED
right after the definition ofabr
andabraux
in your MWE. It'll throw an error.
– Skillmon
10 mins ago
 |Â
show 2 more comments
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
@StevenB.Segletesdef
is not expandable.
– Skillmon
15 mins ago
Got it. I meant to say, mine can be placed in anedef
. But you are right, the contents of theedef
are not the final expansion.
– Steven B. Segletes
13 mins ago
@StevenB.Segletes It can't be placed inside anedef
as theedef
would try to expandnext
before it gets defined.
– Skillmon
12 mins ago
1
@StevenB.Segletes no. Just tryedeftmpabrOED
right after the definition ofabr
andabraux
in your MWE. It'll throw an error.
– Skillmon
10 mins ago
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
I believe mine is fully expandable, as well.
– Steven B. Segletes
15 mins ago
@StevenB.Segletes
def
is not expandable.– Skillmon
15 mins ago
@StevenB.Segletes
def
is not expandable.– Skillmon
15 mins ago
Got it. I meant to say, mine can be placed in an
edef
. But you are right, the contents of the edef
are not the final expansion.– Steven B. Segletes
13 mins ago
Got it. I meant to say, mine can be placed in an
edef
. But you are right, the contents of the edef
are not the final expansion.– Steven B. Segletes
13 mins ago
@StevenB.Segletes It can't be placed inside an
edef
as the edef
would try to expand next
before it gets defined.– Skillmon
12 mins ago
@StevenB.Segletes It can't be placed inside an
edef
as the edef
would try to expand next
before it gets defined.– Skillmon
12 mins ago
1
1
@StevenB.Segletes no. Just try
edeftmpabrOED
right after the definition of abr
and abraux
in your MWE. It'll throw an error.– Skillmon
10 mins ago
@StevenB.Segletes no. Just try
edeftmpabrOED
right after the definition of abr
and abraux
in your MWE. It'll throw an error.– Skillmon
10 mins ago
 |Â
show 2 more comments
up vote
0
down vote
documentclassarticle
newcommandabr[1]abraux#1..
defabraux#1#2#3%
#1.ifx.#2defnext@else,defnextabraux#2#3fi
next
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
Here is abrXOOED abbreviation.
enddocument
add a comment |Â
up vote
0
down vote
documentclassarticle
newcommandabr[1]abraux#1..
defabraux#1#2#3%
#1.ifx.#2defnext@else,defnextabraux#2#3fi
next
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
Here is abrXOOED abbreviation.
enddocument
add a comment |Â
up vote
0
down vote
up vote
0
down vote
documentclassarticle
newcommandabr[1]abraux#1..
defabraux#1#2#3%
#1.ifx.#2defnext@else,defnextabraux#2#3fi
next
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
Here is abrXOOED abbreviation.
enddocument
documentclassarticle
newcommandabr[1]abraux#1..
defabraux#1#2#3%
#1.ifx.#2defnext@else,defnextabraux#2#3fi
next
begindocument
Here is abrOED abbreviation.
Here is abrXO abbreviation.
Here is abrXOOED abbreviation.
enddocument
answered 16 mins ago


Herbert
264k23399712
264k23399712
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458975%2frespectable-abbreviations-macro%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password