Is it possible to use non-letter symbols instead of backslash in the definition of a command?












4















I am trying to define new commands starting with other symbols instead of the (backslash) The use of backslash is not so intuitively for non-experienced LaTeX users. So I would prefer to use ] , [ or / etc. in many cases! For example I prefer =acircum instead of acircum because = looks like a circumflex symbol(on a) ! I tried to use active to activate an = or other character.



For example: I tried to define new commands starting with / like /abc and /abd but the following piece of code had no success!



letslash/
catcode`/active def/abd{abd..} def/abc{abc...} Example: /abc /abd catcode`/=12 let/slash


But TeX complained



Use of / doesn't match its definition.



How one could define such commands? (I hope my question is not already duplicate! )










share|improve this question




















  • 2





    Also note that slash already has a special definition. Don't clobber TeX – it will clobber you right back.

    – Sean Allred
    Oct 31 '15 at 15:10






  • 2





    Don't do it. Using = instead of backlash as the control char will break all sort keyval arguments and I don't dare to image what is will do to the math input. The slash is used in pathes and normal text too.

    – Ulrike Fischer
    Oct 31 '15 at 15:15











  • @UlrikeFischer You are right! I tried to write a code for non mathematicians. So such changes are going to be used locally(inside an invironent). I hope that I will succeed.

    – kornaros
    Oct 31 '15 at 15:36






  • 1





    Imho you are not doing them a favour. All this special syntax will mean that won't be able to use the internet to find help.

    – Ulrike Fischer
    Oct 31 '15 at 15:38






  • 1





    I've recently been designing a language for use in my work – hopefully to be adopted by my coworkers. The keys to a good language include consistency, familiarity, and modularity – you are throwing all of these into the trash. I urge you to reconsider your approach.

    – Sean Allred
    Oct 31 '15 at 17:14
















4















I am trying to define new commands starting with other symbols instead of the (backslash) The use of backslash is not so intuitively for non-experienced LaTeX users. So I would prefer to use ] , [ or / etc. in many cases! For example I prefer =acircum instead of acircum because = looks like a circumflex symbol(on a) ! I tried to use active to activate an = or other character.



For example: I tried to define new commands starting with / like /abc and /abd but the following piece of code had no success!



letslash/
catcode`/active def/abd{abd..} def/abc{abc...} Example: /abc /abd catcode`/=12 let/slash


But TeX complained



Use of / doesn't match its definition.



How one could define such commands? (I hope my question is not already duplicate! )










share|improve this question




















  • 2





    Also note that slash already has a special definition. Don't clobber TeX – it will clobber you right back.

    – Sean Allred
    Oct 31 '15 at 15:10






  • 2





    Don't do it. Using = instead of backlash as the control char will break all sort keyval arguments and I don't dare to image what is will do to the math input. The slash is used in pathes and normal text too.

    – Ulrike Fischer
    Oct 31 '15 at 15:15











  • @UlrikeFischer You are right! I tried to write a code for non mathematicians. So such changes are going to be used locally(inside an invironent). I hope that I will succeed.

    – kornaros
    Oct 31 '15 at 15:36






  • 1





    Imho you are not doing them a favour. All this special syntax will mean that won't be able to use the internet to find help.

    – Ulrike Fischer
    Oct 31 '15 at 15:38






  • 1





    I've recently been designing a language for use in my work – hopefully to be adopted by my coworkers. The keys to a good language include consistency, familiarity, and modularity – you are throwing all of these into the trash. I urge you to reconsider your approach.

    – Sean Allred
    Oct 31 '15 at 17:14














4












4








4


2






I am trying to define new commands starting with other symbols instead of the (backslash) The use of backslash is not so intuitively for non-experienced LaTeX users. So I would prefer to use ] , [ or / etc. in many cases! For example I prefer =acircum instead of acircum because = looks like a circumflex symbol(on a) ! I tried to use active to activate an = or other character.



For example: I tried to define new commands starting with / like /abc and /abd but the following piece of code had no success!



letslash/
catcode`/active def/abd{abd..} def/abc{abc...} Example: /abc /abd catcode`/=12 let/slash


But TeX complained



Use of / doesn't match its definition.



How one could define such commands? (I hope my question is not already duplicate! )










share|improve this question
















I am trying to define new commands starting with other symbols instead of the (backslash) The use of backslash is not so intuitively for non-experienced LaTeX users. So I would prefer to use ] , [ or / etc. in many cases! For example I prefer =acircum instead of acircum because = looks like a circumflex symbol(on a) ! I tried to use active to activate an = or other character.



For example: I tried to define new commands starting with / like /abc and /abd but the following piece of code had no success!



letslash/
catcode`/active def/abd{abd..} def/abc{abc...} Example: /abc /abd catcode`/=12 let/slash


But TeX complained



Use of / doesn't match its definition.



How one could define such commands? (I hope my question is not already duplicate! )







macros catcodes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 11 mins ago









Henri Menke

75.7k8165277




75.7k8165277










asked Oct 31 '15 at 15:00









kornaroskornaros

5351410




5351410








  • 2





    Also note that slash already has a special definition. Don't clobber TeX – it will clobber you right back.

    – Sean Allred
    Oct 31 '15 at 15:10






  • 2





    Don't do it. Using = instead of backlash as the control char will break all sort keyval arguments and I don't dare to image what is will do to the math input. The slash is used in pathes and normal text too.

    – Ulrike Fischer
    Oct 31 '15 at 15:15











  • @UlrikeFischer You are right! I tried to write a code for non mathematicians. So such changes are going to be used locally(inside an invironent). I hope that I will succeed.

    – kornaros
    Oct 31 '15 at 15:36






  • 1





    Imho you are not doing them a favour. All this special syntax will mean that won't be able to use the internet to find help.

    – Ulrike Fischer
    Oct 31 '15 at 15:38






  • 1





    I've recently been designing a language for use in my work – hopefully to be adopted by my coworkers. The keys to a good language include consistency, familiarity, and modularity – you are throwing all of these into the trash. I urge you to reconsider your approach.

    – Sean Allred
    Oct 31 '15 at 17:14














  • 2





    Also note that slash already has a special definition. Don't clobber TeX – it will clobber you right back.

    – Sean Allred
    Oct 31 '15 at 15:10






  • 2





    Don't do it. Using = instead of backlash as the control char will break all sort keyval arguments and I don't dare to image what is will do to the math input. The slash is used in pathes and normal text too.

    – Ulrike Fischer
    Oct 31 '15 at 15:15











  • @UlrikeFischer You are right! I tried to write a code for non mathematicians. So such changes are going to be used locally(inside an invironent). I hope that I will succeed.

    – kornaros
    Oct 31 '15 at 15:36






  • 1





    Imho you are not doing them a favour. All this special syntax will mean that won't be able to use the internet to find help.

    – Ulrike Fischer
    Oct 31 '15 at 15:38






  • 1





    I've recently been designing a language for use in my work – hopefully to be adopted by my coworkers. The keys to a good language include consistency, familiarity, and modularity – you are throwing all of these into the trash. I urge you to reconsider your approach.

    – Sean Allred
    Oct 31 '15 at 17:14








2




2





Also note that slash already has a special definition. Don't clobber TeX – it will clobber you right back.

– Sean Allred
Oct 31 '15 at 15:10





Also note that slash already has a special definition. Don't clobber TeX – it will clobber you right back.

– Sean Allred
Oct 31 '15 at 15:10




2




2





Don't do it. Using = instead of backlash as the control char will break all sort keyval arguments and I don't dare to image what is will do to the math input. The slash is used in pathes and normal text too.

– Ulrike Fischer
Oct 31 '15 at 15:15





Don't do it. Using = instead of backlash as the control char will break all sort keyval arguments and I don't dare to image what is will do to the math input. The slash is used in pathes and normal text too.

– Ulrike Fischer
Oct 31 '15 at 15:15













@UlrikeFischer You are right! I tried to write a code for non mathematicians. So such changes are going to be used locally(inside an invironent). I hope that I will succeed.

– kornaros
Oct 31 '15 at 15:36





@UlrikeFischer You are right! I tried to write a code for non mathematicians. So such changes are going to be used locally(inside an invironent). I hope that I will succeed.

– kornaros
Oct 31 '15 at 15:36




1




1





Imho you are not doing them a favour. All this special syntax will mean that won't be able to use the internet to find help.

– Ulrike Fischer
Oct 31 '15 at 15:38





Imho you are not doing them a favour. All this special syntax will mean that won't be able to use the internet to find help.

– Ulrike Fischer
Oct 31 '15 at 15:38




1




1





I've recently been designing a language for use in my work – hopefully to be adopted by my coworkers. The keys to a good language include consistency, familiarity, and modularity – you are throwing all of these into the trash. I urge you to reconsider your approach.

– Sean Allred
Oct 31 '15 at 17:14





I've recently been designing a language for use in my work – hopefully to be adopted by my coworkers. The keys to a good language include consistency, familiarity, and modularity – you are throwing all of these into the trash. I urge you to reconsider your approach.

– Sean Allred
Oct 31 '15 at 17:14










4 Answers
4






active

oldest

votes


















5














Do I advise this: No!!!



The catcode of macro escape character is 0, i.e. the catcode of / has to be changed to 0.



I did not test for the literal / however.



You can use /def/foo{blabla} then!



catcode`/=0
def/abd{abd..}
/def/dosomethingstupid{Something not recommended because it looks weird!}

/abd
/dosomethingstupid

bye





share|improve this answer
























  • ! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

    – kornaros
    Oct 31 '15 at 15:15













  • @kornaros: Actually: I don't recommend this at all!!!!

    – Christian Hupfer
    Oct 31 '15 at 15:28











  • I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

    – kornaros
    Oct 31 '15 at 18:13













  • To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

    – dgoodmaniii
    Oct 31 '15 at 20:03



















3














An expl3 approach:



documentclass{article}
usepackage{xparse}
ExplSyntaxOn

char_set_catcode_escape:N /
NewDocumentCommand /Abc {} { abc }

ExplSyntaxOff
begin{document}
/Abc
end{document}


As I said: here be dragons!






share|improve this answer





















  • 1





    Of course, Abc wouldn't be any different from /Abc.

    – egreg
    Oct 31 '15 at 15:22











  • Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

    – kornaros
    Oct 31 '15 at 15:27











  • @kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

    – egreg
    Oct 31 '15 at 15:57











  • @kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

    – Sean Allred
    Oct 31 '15 at 16:30











  • @kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

    – Sean Allred
    Oct 31 '15 at 17:10



















2














Rather than redefine / to have the meaning of , you could use LuaLaTeX and (a) set up a function that changes all instances of / in the text to "on the fly" and (b) assign this function to the so-called process_input_buffer callback, which does its work at a very early stage of processing, before (La)TeX does any of its usual work.



Of course, if you do need a forward-slash symbol in your document, you can no longer enter it as /; instead, you'll need to write /slash.



enter image description here



% !TEX TS-program = lualatex
documentclass{article}
usepackage{luacode}
begin{luacode}
function slash2bslash ( line )
return string.gsub ( line, "/", "\" )
end
luatexbase.add_to_callback ( "process_input_buffer", slash2bslash, "slash2bslash" )
end{luacode}

begin{document}
/section{Hello}
/section{Good-bye}
end{document}





share|improve this answer


























  • Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

    – kornaros
    Oct 31 '15 at 15:40











  • @kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

    – Mico
    Oct 31 '15 at 15:44











  • @kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

    – Sean Allred
    Oct 31 '15 at 17:11








  • 1





    @SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

    – Mico
    Oct 31 '15 at 17:31






  • 1





    @Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

    – Ulrike Fischer
    Oct 31 '15 at 17:40



















1














The amstex.tex style file for Plain TeX had @ as “alternative escape” and this was also used in amslatex (the first port of AMS-TeX to LaTeX), but then abandoned when amsmath was issued.



In AMS-TeX one could type @>f>g> for what would be typed xrightarrow[g]{f} in amsmath (both labels were optional, so @>>> meant a right pointing arrow). The downside was that a literal @ had to be input as @@.



There was no interface for defining “@-commands”, but there is the at package by Mark Wooding that provides it (the documentation can be read with texdoc mdwtools, because this points to the first hit, which is exactly at.sty).



For instance, the package provides by default the @-command @/, whereby



@/some text in italics/


(note the matching slash at the end) is the same as typing



textit{some text in italics}


Also predefined is @@ for printing an @. Note that @? would be different from ?: if you do



atdef ?{`?}
newcommand?{QQ}


the output of @? would be different from ?.



Of course, one could replicate the code for allowing other prefix characters. The big downside is that the prefix character must be made into an active one. If you want to use =-commands, such as your proposed =acircum, then you can't type = in a math formula any more (well, you'd need to be very careful).



When amsmath was released, AMS thought carefully about @-commands and decided to withdraw them and they had very good reasons for. I'm not sure where =acircum could be easier for users than acircum. I'm inclined to believe that they'll be very confused, actually.



You just need to know that commands should be escaped and that the signal for this escape is . Remembering different escapes for different commands would be a nightmare. Possibly funny (I'm writing this answer on All Saints' Eve), but definitely not a good user interface.





Other suggested methods such as doing catcode`/=0 are quite different.



If you do



catcode`/=0
newcommand{/Abc}{whatever}


you can then call /Abc or Abc and this will produce exactly the same result (unless you also changed the category code of /). Of course, you cannot use / for printing a slash.



There are good reasons for using the backslash as escape. The character is seldom, if ever, used in running text. For the set theory operation there is the semantically meaningful command setminus (and also the command backslash for the symbol as an ordinary atom). No other character in the ASCII range is in the same situation; except possibly @ itself (barring its usage in email addresses). Indeed, there is a TeX format that uses @ and not as escape: it's texinfo, that's been used for decades for TeXing documentation in GNU info format.






share|improve this answer
























  • And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

    – Sean Allred
    Oct 31 '15 at 17:19











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f275880%2fis-it-possible-to-use-non-letter-symbols-instead-of-backslash-in-the-definition%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























4 Answers
4






active

oldest

votes








4 Answers
4






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














Do I advise this: No!!!



The catcode of macro escape character is 0, i.e. the catcode of / has to be changed to 0.



I did not test for the literal / however.



You can use /def/foo{blabla} then!



catcode`/=0
def/abd{abd..}
/def/dosomethingstupid{Something not recommended because it looks weird!}

/abd
/dosomethingstupid

bye





share|improve this answer
























  • ! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

    – kornaros
    Oct 31 '15 at 15:15













  • @kornaros: Actually: I don't recommend this at all!!!!

    – Christian Hupfer
    Oct 31 '15 at 15:28











  • I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

    – kornaros
    Oct 31 '15 at 18:13













  • To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

    – dgoodmaniii
    Oct 31 '15 at 20:03
















5














Do I advise this: No!!!



The catcode of macro escape character is 0, i.e. the catcode of / has to be changed to 0.



I did not test for the literal / however.



You can use /def/foo{blabla} then!



catcode`/=0
def/abd{abd..}
/def/dosomethingstupid{Something not recommended because it looks weird!}

/abd
/dosomethingstupid

bye





share|improve this answer
























  • ! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

    – kornaros
    Oct 31 '15 at 15:15













  • @kornaros: Actually: I don't recommend this at all!!!!

    – Christian Hupfer
    Oct 31 '15 at 15:28











  • I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

    – kornaros
    Oct 31 '15 at 18:13













  • To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

    – dgoodmaniii
    Oct 31 '15 at 20:03














5












5








5







Do I advise this: No!!!



The catcode of macro escape character is 0, i.e. the catcode of / has to be changed to 0.



I did not test for the literal / however.



You can use /def/foo{blabla} then!



catcode`/=0
def/abd{abd..}
/def/dosomethingstupid{Something not recommended because it looks weird!}

/abd
/dosomethingstupid

bye





share|improve this answer













Do I advise this: No!!!



The catcode of macro escape character is 0, i.e. the catcode of / has to be changed to 0.



I did not test for the literal / however.



You can use /def/foo{blabla} then!



catcode`/=0
def/abd{abd..}
/def/dosomethingstupid{Something not recommended because it looks weird!}

/abd
/dosomethingstupid

bye






share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 31 '15 at 15:05









Christian HupferChristian Hupfer

151k15199394




151k15199394













  • ! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

    – kornaros
    Oct 31 '15 at 15:15













  • @kornaros: Actually: I don't recommend this at all!!!!

    – Christian Hupfer
    Oct 31 '15 at 15:28











  • I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

    – kornaros
    Oct 31 '15 at 18:13













  • To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

    – dgoodmaniii
    Oct 31 '15 at 20:03



















  • ! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

    – kornaros
    Oct 31 '15 at 15:15













  • @kornaros: Actually: I don't recommend this at all!!!!

    – Christian Hupfer
    Oct 31 '15 at 15:28











  • I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

    – kornaros
    Oct 31 '15 at 18:13













  • To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

    – dgoodmaniii
    Oct 31 '15 at 20:03

















! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

– kornaros
Oct 31 '15 at 15:15







! I tried your idea with success! Thank you! How one could use your idea locally(inside a special enviroment?) In other words, how one could go back to the normal use of / ? Onother simillar question: How one could define new functions like mycmd/ or [mycmd/ with 2 symbols (where / gives the END of the mycmd?)

– kornaros
Oct 31 '15 at 15:15















@kornaros: Actually: I don't recommend this at all!!!!

– Christian Hupfer
Oct 31 '15 at 15:28





@kornaros: Actually: I don't recommend this at all!!!!

– Christian Hupfer
Oct 31 '15 at 15:28













I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

– kornaros
Oct 31 '15 at 18:13







I tried to get back to the normal use of / with catcode`/=12 but this does not work! Any ideas?

– kornaros
Oct 31 '15 at 18:13















To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

– dgoodmaniii
Oct 31 '15 at 20:03





To keep it local, try defining an environment: newenvironment{frontslash}{catcode/=0}{catcode/=12}. Anything between begin{frontslash} and end{frontslash} will have your forward-slash commands available. Please note that this is still a terrible idea, though, unless you've got a very limited use-case.

– dgoodmaniii
Oct 31 '15 at 20:03











3














An expl3 approach:



documentclass{article}
usepackage{xparse}
ExplSyntaxOn

char_set_catcode_escape:N /
NewDocumentCommand /Abc {} { abc }

ExplSyntaxOff
begin{document}
/Abc
end{document}


As I said: here be dragons!






share|improve this answer





















  • 1





    Of course, Abc wouldn't be any different from /Abc.

    – egreg
    Oct 31 '15 at 15:22











  • Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

    – kornaros
    Oct 31 '15 at 15:27











  • @kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

    – egreg
    Oct 31 '15 at 15:57











  • @kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

    – Sean Allred
    Oct 31 '15 at 16:30











  • @kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

    – Sean Allred
    Oct 31 '15 at 17:10
















3














An expl3 approach:



documentclass{article}
usepackage{xparse}
ExplSyntaxOn

char_set_catcode_escape:N /
NewDocumentCommand /Abc {} { abc }

ExplSyntaxOff
begin{document}
/Abc
end{document}


As I said: here be dragons!






share|improve this answer





















  • 1





    Of course, Abc wouldn't be any different from /Abc.

    – egreg
    Oct 31 '15 at 15:22











  • Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

    – kornaros
    Oct 31 '15 at 15:27











  • @kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

    – egreg
    Oct 31 '15 at 15:57











  • @kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

    – Sean Allred
    Oct 31 '15 at 16:30











  • @kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

    – Sean Allred
    Oct 31 '15 at 17:10














3












3








3







An expl3 approach:



documentclass{article}
usepackage{xparse}
ExplSyntaxOn

char_set_catcode_escape:N /
NewDocumentCommand /Abc {} { abc }

ExplSyntaxOff
begin{document}
/Abc
end{document}


As I said: here be dragons!






share|improve this answer















An expl3 approach:



documentclass{article}
usepackage{xparse}
ExplSyntaxOn

char_set_catcode_escape:N /
NewDocumentCommand /Abc {} { abc }

ExplSyntaxOff
begin{document}
/Abc
end{document}


As I said: here be dragons!







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 31 '15 at 15:12

























answered Oct 31 '15 at 15:07









Sean AllredSean Allred

18k658200




18k658200








  • 1





    Of course, Abc wouldn't be any different from /Abc.

    – egreg
    Oct 31 '15 at 15:22











  • Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

    – kornaros
    Oct 31 '15 at 15:27











  • @kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

    – egreg
    Oct 31 '15 at 15:57











  • @kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

    – Sean Allred
    Oct 31 '15 at 16:30











  • @kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

    – Sean Allred
    Oct 31 '15 at 17:10














  • 1





    Of course, Abc wouldn't be any different from /Abc.

    – egreg
    Oct 31 '15 at 15:22











  • Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

    – kornaros
    Oct 31 '15 at 15:27











  • @kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

    – egreg
    Oct 31 '15 at 15:57











  • @kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

    – Sean Allred
    Oct 31 '15 at 16:30











  • @kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

    – Sean Allred
    Oct 31 '15 at 17:10








1




1





Of course, Abc wouldn't be any different from /Abc.

– egreg
Oct 31 '15 at 15:22





Of course, Abc wouldn't be any different from /Abc.

– egreg
Oct 31 '15 at 15:22













Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

– kornaros
Oct 31 '15 at 15:27





Yes xparse is very powerfull! Please, let me ask you to generalize your unswer to more comlicated cases like [abc/ where the last charecter could be used to point the end of command. Thank you for your answer!

– kornaros
Oct 31 '15 at 15:27













@kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

– egreg
Oct 31 '15 at 15:57





@kornaros There's no need for xparse, here.This is just the same as doing catcode`/=0

– egreg
Oct 31 '15 at 15:57













@kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

– Sean Allred
Oct 31 '15 at 16:30





@kornaros egreg is right; xparse is just what I use to load expl3 (mostly out of habit). You could just as easily use usepackage{expl3}…newcommand/abc{abc}…. It's just an alternative approach for new code.

– Sean Allred
Oct 31 '15 at 16:30













@kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

– Sean Allred
Oct 31 '15 at 17:10





@kornaros for the second question you asked here, refer to xparse documentation: NewDocumentCommand Abc {u/} { abc(#1) } Abc hello/

– Sean Allred
Oct 31 '15 at 17:10











2














Rather than redefine / to have the meaning of , you could use LuaLaTeX and (a) set up a function that changes all instances of / in the text to "on the fly" and (b) assign this function to the so-called process_input_buffer callback, which does its work at a very early stage of processing, before (La)TeX does any of its usual work.



Of course, if you do need a forward-slash symbol in your document, you can no longer enter it as /; instead, you'll need to write /slash.



enter image description here



% !TEX TS-program = lualatex
documentclass{article}
usepackage{luacode}
begin{luacode}
function slash2bslash ( line )
return string.gsub ( line, "/", "\" )
end
luatexbase.add_to_callback ( "process_input_buffer", slash2bslash, "slash2bslash" )
end{luacode}

begin{document}
/section{Hello}
/section{Good-bye}
end{document}





share|improve this answer


























  • Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

    – kornaros
    Oct 31 '15 at 15:40











  • @kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

    – Mico
    Oct 31 '15 at 15:44











  • @kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

    – Sean Allred
    Oct 31 '15 at 17:11








  • 1





    @SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

    – Mico
    Oct 31 '15 at 17:31






  • 1





    @Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

    – Ulrike Fischer
    Oct 31 '15 at 17:40
















2














Rather than redefine / to have the meaning of , you could use LuaLaTeX and (a) set up a function that changes all instances of / in the text to "on the fly" and (b) assign this function to the so-called process_input_buffer callback, which does its work at a very early stage of processing, before (La)TeX does any of its usual work.



Of course, if you do need a forward-slash symbol in your document, you can no longer enter it as /; instead, you'll need to write /slash.



enter image description here



% !TEX TS-program = lualatex
documentclass{article}
usepackage{luacode}
begin{luacode}
function slash2bslash ( line )
return string.gsub ( line, "/", "\" )
end
luatexbase.add_to_callback ( "process_input_buffer", slash2bslash, "slash2bslash" )
end{luacode}

begin{document}
/section{Hello}
/section{Good-bye}
end{document}





share|improve this answer


























  • Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

    – kornaros
    Oct 31 '15 at 15:40











  • @kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

    – Mico
    Oct 31 '15 at 15:44











  • @kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

    – Sean Allred
    Oct 31 '15 at 17:11








  • 1





    @SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

    – Mico
    Oct 31 '15 at 17:31






  • 1





    @Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

    – Ulrike Fischer
    Oct 31 '15 at 17:40














2












2








2







Rather than redefine / to have the meaning of , you could use LuaLaTeX and (a) set up a function that changes all instances of / in the text to "on the fly" and (b) assign this function to the so-called process_input_buffer callback, which does its work at a very early stage of processing, before (La)TeX does any of its usual work.



Of course, if you do need a forward-slash symbol in your document, you can no longer enter it as /; instead, you'll need to write /slash.



enter image description here



% !TEX TS-program = lualatex
documentclass{article}
usepackage{luacode}
begin{luacode}
function slash2bslash ( line )
return string.gsub ( line, "/", "\" )
end
luatexbase.add_to_callback ( "process_input_buffer", slash2bslash, "slash2bslash" )
end{luacode}

begin{document}
/section{Hello}
/section{Good-bye}
end{document}





share|improve this answer















Rather than redefine / to have the meaning of , you could use LuaLaTeX and (a) set up a function that changes all instances of / in the text to "on the fly" and (b) assign this function to the so-called process_input_buffer callback, which does its work at a very early stage of processing, before (La)TeX does any of its usual work.



Of course, if you do need a forward-slash symbol in your document, you can no longer enter it as /; instead, you'll need to write /slash.



enter image description here



% !TEX TS-program = lualatex
documentclass{article}
usepackage{luacode}
begin{luacode}
function slash2bslash ( line )
return string.gsub ( line, "/", "\" )
end
luatexbase.add_to_callback ( "process_input_buffer", slash2bslash, "slash2bslash" )
end{luacode}

begin{document}
/section{Hello}
/section{Good-bye}
end{document}






share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 31 '15 at 17:33

























answered Oct 31 '15 at 15:31









MicoMico

280k31383772




280k31383772













  • Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

    – kornaros
    Oct 31 '15 at 15:40











  • @kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

    – Mico
    Oct 31 '15 at 15:44











  • @kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

    – Sean Allred
    Oct 31 '15 at 17:11








  • 1





    @SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

    – Mico
    Oct 31 '15 at 17:31






  • 1





    @Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

    – Ulrike Fischer
    Oct 31 '15 at 17:40



















  • Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

    – kornaros
    Oct 31 '15 at 15:40











  • @kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

    – Mico
    Oct 31 '15 at 15:44











  • @kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

    – Sean Allred
    Oct 31 '15 at 17:11








  • 1





    @SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

    – Mico
    Oct 31 '15 at 17:31






  • 1





    @Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

    – Ulrike Fischer
    Oct 31 '15 at 17:40

















Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

– kornaros
Oct 31 '15 at 15:40





Oh my God! So LuaLaTeX has pre-processing capabilities! Fantastic! No worry for any kind of "control" symbols!

– kornaros
Oct 31 '15 at 15:40













@kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

– Mico
Oct 31 '15 at 15:44





@kornaros - LuaTeX has opened up TeX's paragraph building process, by providing "callbacks" that operate at various stages of the process. The process_input_buffer callback is one of these callbacks, and it indeed offers all kinds of possibilities for pre-processing.

– Mico
Oct 31 '15 at 15:44













@kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

– Sean Allred
Oct 31 '15 at 17:11







@kornaros Just be careful. It's so easy to break things this way – especially if you have no idea what you're actually doing.

– Sean Allred
Oct 31 '15 at 17:11






1




1





@SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

– Mico
Oct 31 '15 at 17:31





@SeanAllred - Note that my answer is "safe" as it does not change the TeX's treatment of /. Because the Lua function is assigned to the process_input_buffer callback, TeX's eyes -- let alone its mouth, stomach, etc -- do not get to see instances of / -- they will all have been converted to `` before TeX starts its own work.

– Mico
Oct 31 '15 at 17:31




1




1





@Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

– Ulrike Fischer
Oct 31 '15 at 17:40





@Mico but this is the problem: every slash will be replaced by a backslash. There only need to be a real slash somewhere, e.g. in a graphicspath, or in a math and you get (exactly) the same problems as when you change the catcode of /.

– Ulrike Fischer
Oct 31 '15 at 17:40











1














The amstex.tex style file for Plain TeX had @ as “alternative escape” and this was also used in amslatex (the first port of AMS-TeX to LaTeX), but then abandoned when amsmath was issued.



In AMS-TeX one could type @>f>g> for what would be typed xrightarrow[g]{f} in amsmath (both labels were optional, so @>>> meant a right pointing arrow). The downside was that a literal @ had to be input as @@.



There was no interface for defining “@-commands”, but there is the at package by Mark Wooding that provides it (the documentation can be read with texdoc mdwtools, because this points to the first hit, which is exactly at.sty).



For instance, the package provides by default the @-command @/, whereby



@/some text in italics/


(note the matching slash at the end) is the same as typing



textit{some text in italics}


Also predefined is @@ for printing an @. Note that @? would be different from ?: if you do



atdef ?{`?}
newcommand?{QQ}


the output of @? would be different from ?.



Of course, one could replicate the code for allowing other prefix characters. The big downside is that the prefix character must be made into an active one. If you want to use =-commands, such as your proposed =acircum, then you can't type = in a math formula any more (well, you'd need to be very careful).



When amsmath was released, AMS thought carefully about @-commands and decided to withdraw them and they had very good reasons for. I'm not sure where =acircum could be easier for users than acircum. I'm inclined to believe that they'll be very confused, actually.



You just need to know that commands should be escaped and that the signal for this escape is . Remembering different escapes for different commands would be a nightmare. Possibly funny (I'm writing this answer on All Saints' Eve), but definitely not a good user interface.





Other suggested methods such as doing catcode`/=0 are quite different.



If you do



catcode`/=0
newcommand{/Abc}{whatever}


you can then call /Abc or Abc and this will produce exactly the same result (unless you also changed the category code of /). Of course, you cannot use / for printing a slash.



There are good reasons for using the backslash as escape. The character is seldom, if ever, used in running text. For the set theory operation there is the semantically meaningful command setminus (and also the command backslash for the symbol as an ordinary atom). No other character in the ASCII range is in the same situation; except possibly @ itself (barring its usage in email addresses). Indeed, there is a TeX format that uses @ and not as escape: it's texinfo, that's been used for decades for TeXing documentation in GNU info format.






share|improve this answer
























  • And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

    – Sean Allred
    Oct 31 '15 at 17:19
















1














The amstex.tex style file for Plain TeX had @ as “alternative escape” and this was also used in amslatex (the first port of AMS-TeX to LaTeX), but then abandoned when amsmath was issued.



In AMS-TeX one could type @>f>g> for what would be typed xrightarrow[g]{f} in amsmath (both labels were optional, so @>>> meant a right pointing arrow). The downside was that a literal @ had to be input as @@.



There was no interface for defining “@-commands”, but there is the at package by Mark Wooding that provides it (the documentation can be read with texdoc mdwtools, because this points to the first hit, which is exactly at.sty).



For instance, the package provides by default the @-command @/, whereby



@/some text in italics/


(note the matching slash at the end) is the same as typing



textit{some text in italics}


Also predefined is @@ for printing an @. Note that @? would be different from ?: if you do



atdef ?{`?}
newcommand?{QQ}


the output of @? would be different from ?.



Of course, one could replicate the code for allowing other prefix characters. The big downside is that the prefix character must be made into an active one. If you want to use =-commands, such as your proposed =acircum, then you can't type = in a math formula any more (well, you'd need to be very careful).



When amsmath was released, AMS thought carefully about @-commands and decided to withdraw them and they had very good reasons for. I'm not sure where =acircum could be easier for users than acircum. I'm inclined to believe that they'll be very confused, actually.



You just need to know that commands should be escaped and that the signal for this escape is . Remembering different escapes for different commands would be a nightmare. Possibly funny (I'm writing this answer on All Saints' Eve), but definitely not a good user interface.





Other suggested methods such as doing catcode`/=0 are quite different.



If you do



catcode`/=0
newcommand{/Abc}{whatever}


you can then call /Abc or Abc and this will produce exactly the same result (unless you also changed the category code of /). Of course, you cannot use / for printing a slash.



There are good reasons for using the backslash as escape. The character is seldom, if ever, used in running text. For the set theory operation there is the semantically meaningful command setminus (and also the command backslash for the symbol as an ordinary atom). No other character in the ASCII range is in the same situation; except possibly @ itself (barring its usage in email addresses). Indeed, there is a TeX format that uses @ and not as escape: it's texinfo, that's been used for decades for TeXing documentation in GNU info format.






share|improve this answer
























  • And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

    – Sean Allred
    Oct 31 '15 at 17:19














1












1








1







The amstex.tex style file for Plain TeX had @ as “alternative escape” and this was also used in amslatex (the first port of AMS-TeX to LaTeX), but then abandoned when amsmath was issued.



In AMS-TeX one could type @>f>g> for what would be typed xrightarrow[g]{f} in amsmath (both labels were optional, so @>>> meant a right pointing arrow). The downside was that a literal @ had to be input as @@.



There was no interface for defining “@-commands”, but there is the at package by Mark Wooding that provides it (the documentation can be read with texdoc mdwtools, because this points to the first hit, which is exactly at.sty).



For instance, the package provides by default the @-command @/, whereby



@/some text in italics/


(note the matching slash at the end) is the same as typing



textit{some text in italics}


Also predefined is @@ for printing an @. Note that @? would be different from ?: if you do



atdef ?{`?}
newcommand?{QQ}


the output of @? would be different from ?.



Of course, one could replicate the code for allowing other prefix characters. The big downside is that the prefix character must be made into an active one. If you want to use =-commands, such as your proposed =acircum, then you can't type = in a math formula any more (well, you'd need to be very careful).



When amsmath was released, AMS thought carefully about @-commands and decided to withdraw them and they had very good reasons for. I'm not sure where =acircum could be easier for users than acircum. I'm inclined to believe that they'll be very confused, actually.



You just need to know that commands should be escaped and that the signal for this escape is . Remembering different escapes for different commands would be a nightmare. Possibly funny (I'm writing this answer on All Saints' Eve), but definitely not a good user interface.





Other suggested methods such as doing catcode`/=0 are quite different.



If you do



catcode`/=0
newcommand{/Abc}{whatever}


you can then call /Abc or Abc and this will produce exactly the same result (unless you also changed the category code of /). Of course, you cannot use / for printing a slash.



There are good reasons for using the backslash as escape. The character is seldom, if ever, used in running text. For the set theory operation there is the semantically meaningful command setminus (and also the command backslash for the symbol as an ordinary atom). No other character in the ASCII range is in the same situation; except possibly @ itself (barring its usage in email addresses). Indeed, there is a TeX format that uses @ and not as escape: it's texinfo, that's been used for decades for TeXing documentation in GNU info format.






share|improve this answer













The amstex.tex style file for Plain TeX had @ as “alternative escape” and this was also used in amslatex (the first port of AMS-TeX to LaTeX), but then abandoned when amsmath was issued.



In AMS-TeX one could type @>f>g> for what would be typed xrightarrow[g]{f} in amsmath (both labels were optional, so @>>> meant a right pointing arrow). The downside was that a literal @ had to be input as @@.



There was no interface for defining “@-commands”, but there is the at package by Mark Wooding that provides it (the documentation can be read with texdoc mdwtools, because this points to the first hit, which is exactly at.sty).



For instance, the package provides by default the @-command @/, whereby



@/some text in italics/


(note the matching slash at the end) is the same as typing



textit{some text in italics}


Also predefined is @@ for printing an @. Note that @? would be different from ?: if you do



atdef ?{`?}
newcommand?{QQ}


the output of @? would be different from ?.



Of course, one could replicate the code for allowing other prefix characters. The big downside is that the prefix character must be made into an active one. If you want to use =-commands, such as your proposed =acircum, then you can't type = in a math formula any more (well, you'd need to be very careful).



When amsmath was released, AMS thought carefully about @-commands and decided to withdraw them and they had very good reasons for. I'm not sure where =acircum could be easier for users than acircum. I'm inclined to believe that they'll be very confused, actually.



You just need to know that commands should be escaped and that the signal for this escape is . Remembering different escapes for different commands would be a nightmare. Possibly funny (I'm writing this answer on All Saints' Eve), but definitely not a good user interface.





Other suggested methods such as doing catcode`/=0 are quite different.



If you do



catcode`/=0
newcommand{/Abc}{whatever}


you can then call /Abc or Abc and this will produce exactly the same result (unless you also changed the category code of /). Of course, you cannot use / for printing a slash.



There are good reasons for using the backslash as escape. The character is seldom, if ever, used in running text. For the set theory operation there is the semantically meaningful command setminus (and also the command backslash for the symbol as an ordinary atom). No other character in the ASCII range is in the same situation; except possibly @ itself (barring its usage in email addresses). Indeed, there is a TeX format that uses @ and not as escape: it's texinfo, that's been used for decades for TeXing documentation in GNU info format.







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 31 '15 at 16:10









egregegreg

722k8719163216




722k8719163216













  • And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

    – Sean Allred
    Oct 31 '15 at 17:19



















  • And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

    – Sean Allred
    Oct 31 '15 at 17:19

















And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

– Sean Allred
Oct 31 '15 at 17:19





And I can vouch that Texinfo is a monstrous beast that has very few of the selling points of 'normal' TeX.

– Sean Allred
Oct 31 '15 at 17:19


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f275880%2fis-it-possible-to-use-non-letter-symbols-instead-of-backslash-in-the-definition%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)