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
Escape inline verbatim spaces in LaTeX output (\texttt
)
#1694
Comments
I now note that highlighted code uses the The quick and easy option there is to use However, perhaps a more future-proof option to ensure that highlighted and non-highlighted verbatim text don't diverge would be to push both through the highlighting? Either by defaulting to an “empty language” for all verbatim text (inline and blocks) where no language is specified (along the lines of the proposal in jgm/highlighting-kate#40), or by faking it as was done in b371e83. While it adds overhead, both in processing time and size of the output, simply pushing all verbatim text through the highlighter would be better as it avoids having to individually address other special cases similar to jgm/highlighting-kate#40 that may arise. If this is preferred over my current pull request I could have a go at it, but as the change goes a bit “deeper” I won't speculatively invest the time. In that case I also think a new issue is warranted as the impact would not be limited to LaTeX output. |
Interesting idea, well worth considering. One reason for the present behavior was to avoid the need for the fancyvrb package if you're not using highlighting, but maybe that's not so important. +++ Björn Buckwalter [Oct 16 14 02:37 ]:
|
Unfortunately I'm not qualified to judge the severity of the fancyvrb dependency. Either way, I still think the pull request is good and worth pulling, if nothing else as an interim solution addressing the white-space problems while deferring the decision about going via the highlighter. Now that you mention dependencies, I also seem to recall that highlighting (and the highlighting-kate dependency) used to be enabled (disabled?) with a cabal flag. |
Can this be merged @jgm ? |
@jgm , I am using Pandoc 2.2.3.2. Now the space in inline code is escaped in the generated LaTeX source file. I wonder if there is a switch to turn this behavior off? |
Why would you want to turn it off? The escaping is important when you have consecutive spaces, and harmless in other cases. |
@jgm , I am using soul package in LaTeX to color the background of inline code (which is implemented using Unfortunately, |
Currently e.g.
f . g
is rendered to LaTeX as\texttt{f . g}
. LaTeX in turn will treat the.
as a regular sentence ending period and substitutes an em/quad(?) for the following space. Furthermore, multiple spaces in inline verbatim blocks are also discarded by LaTeX:becomes
I would argue that neither of these are ever the desired behavior for verbatim text.
The solution appear to be to escape all spaces within the backticks, giving
\texttt{f\ .\ g}
and\texttt{f\ \ \ \ .\ g}
for the above examples. This leaves automatic line breaking “intact”, where all\
at the break are replaced by a single line break. I think is reasonable behaviour for inline verbatim text.The text was updated successfully, but these errors were encountered: