Skip to content

Instantly share code, notes, and snippets.

@tyleransom
Last active February 25, 2023 19:33
Show Gist options
  • Save tyleransom/078b045584ad537e85d2a6846ff31f65 to your computer and use it in GitHub Desktop.
Save tyleransom/078b045584ad537e85d2a6846ff31f65 to your computer and use it in GitHub Desktop.
* Dodging local macros (backtick)
* works
file open tb using "test1.tex", write replace
file write tb "These are backticks: " "`" "`" "air quotes''. "_n
file close tb
* works
!echo "These are backticks:" "`=char(92)'`=char(96)'""`=char(92)'`=char(96)'""air quotes''." > test2.tex
* doesn’t work
file open tb using "test1-bad.tex", write replace
file write tb "These are backticks: ``air quotes''. "_n
file close tb
* doesn't work
!echo "These are backticks:" "\`\`air quotes''." > test2-bad.tex
* also doesn't work
!echo "These are backticks:" "\" "`" "\" "`" "air quotes''." > test2-bad2.tex
* Dodging global macros (dollar sign)
* works
file open tb using "test3.tex", write replace
file write tb "The shirt costs " "$" "USD 15. "_n
file close tb
* works
!echo "The shirt costs" "`=char(92)'`=char(36)'""USD 15." > test4.tex
* doesn’t work
file open tb using "test3-bad.tex", write replace
file write tb "The shirt costs $USD 15. "_n
file close tb
* doesn't work
!echo "The shirt costs $USD 15." > test4-bad.tex
* also doesn't work
!echo "The shrit costs " "\" "$USD " "15." > test4-bad2.tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment