-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option "escapeinside=``" does not work in *nix #262
Comments
Fixing this will need to make There are likely other escaping issues remaining elsewhere...there are a lot of ways that shell commands and macros can interact in undesirable ways. My longer-term plan is to have |
That is the approach taken in |
@gpoore |
Example
When user sets minted option
escapeinside=``
, the latex engine will runpygmentize
with option-P "escapeinside=``"
. But character U+0060 (`
) has special syntax in *nix shells, so the following example to use`
as escape delimiter, simplified from #260, won't work:output
![image](https://user-images.githubusercontent.com/6376638/80948063-f3974c80-8e23-11ea-8de0-6fa251736c9d.png)
Using
pygmentize
onlyThis can be manually confirmed in macOS (with bash or zsh) or other *nix OS (for example, on overleaf.com, which runs latex in "Linux 4.19.112+ #1 SMP"). Suppose I have a file
test-escapeinside.pyg
containing-P "escapeinside=``"
, which ispygmentize -l haskell -f latex -P commandprefix=PYG -F tokenmerge -P "escapeinside=``" -o output.pygtex test-escapeinside.pyg
, then theoutput.pygtex
contains\pause
as part of the code, not an escaped latex command.-P "escapeinside=\`\`"
, which ispygmentize -l haskell -f latex -P commandprefix=PYG -F tokenmerge -P "escapeinside=\`\`" -o output.pygtex test-escapeinside.pyg `, then the `output.pygtex
, then theoutput.pygtex
containsDiscussion
So the *nix shell needs
`
character to be escaped. But since\`
is (re)defined by latex2e as a text accent command,escapeinside=\`\`
results inpygmentize ... -P "escapeinside=<expansion of `><expansion of `>"
.I find setting
\AtBeginEnvironment{minted}{\chardef\`=`\`}
andescapeinside=\`\`
works, at the risk of cannot use\`
as text accent anymore inside minted environment. Also, this only fixes a single environment. Changing how the value of optionescapeinside
is parsed may be a more general and elegant solution.Other special characters with their corresponding escaped form defined as macros rather than characters may run into similar problems.
The text was updated successfully, but these errors were encountered: