Closed hughjonesd closed 5 years ago
It might be this issue https://github.com/jgm/pandoc/issues/2493
With Pandoc 2.x (currently shipped with the RStudio preview version), there is a simple solution, which is to use raw blocks: http://pandoc.org/MANUAL.html#generic-raw-attribute
Is there a way to do that programmatically? raw_output
seems to do
something different.
On Tue, 23 Oct 2018 at 14:35, Yihui Xie notifications@github.com wrote:
It might be this issue jgm/pandoc#2493 https://github.com/jgm/pandoc/issues/2493
With Pandoc 2.x (currently shipped with the RStudio preview version), there is a simple solution, which is to use raw blocks: http://pandoc.org/MANUAL.html#generic-raw-attribute
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yihui/knitr/issues/1622#issuecomment-432248346, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjJ92WHd4LNd6vjLUfU0gUrDSnUTcKJks5unxsxgaJpZM4X1f1Y .
-- Sent from Gmail Mobile
That sounds like a good idea, but I don't have time for it.
I sympathize! I will try and find a hack that does not trigger pandoc's hissy fits.
Am I right in thinking that knitr could take advantage of this pandoc
feature, by emitting raw blocks around raw_output
? Is this a substitute
for the current raw_output mechanism? (Or does it address a different use
case?)
I don’t mind trying to fix this myself if you’re open to it, because the situation at the moment makes TeX output unpredictable for huxtable (or indeed other solutions like xtable, as I discovered yesterday...).
David -- Sent from Gmail Mobile
It might be this issue jgm/pandoc#2493
With Pandoc 2.x (currently shipped with the RStudio preview version), there is a simple solution, which is to use raw blocks: http://pandoc.org/MANUAL.html#generic-raw-attribute
The explicit raw blocks (```{=latex}) helped me to solve my problem, which is not related at all with issue #2493, as no $ is present in my file. I'm using a Markdown file, where I insert some Latex raw blocks. Since I've upgraded Pandoc to a more recent version (currently 2.1.2), there's some crazy escaping.
This is the source:
\begin{figure}[H]
\centering
\begin{lilypond}[nofragment]
\include "lilypond-book-preamble.ly"
\include "custom.ly"
musica = {
\time 2/4
c'8-1 e' d'16-3 c'-1 a-2 g |
c'2-1 %\bar "|." |
}
\score {
\new StaffGroup <<
\new Staff { \clef "treble_8" \musica }
\new TabStaff { \clef "moderntab" \new TabVoice \musica }
>>
}
\paper { line-width = 8\cm }
\end{lilypond}
\end{figure}
and this is the latex output:
\textbackslash{}begin\{figure\}{[}H{]} \centering
\textbackslash{}begin\{lilypond\}{[}nofragment{]}
\include ``lilypond-book-preamble.ly'' \include ``custom.ly'' musica =
\{ \time 2/4 c'8-1 e' d'16-3 c'-1 a-2 g \textbar{} c'2-1
\%\bar ``\textbar{}.'' \textbar{} \} \score {
\new StaffGroup <<
\new Staff { \clef "treble_8" \musica }
\new TabStaff { \clef "moderntab" \new TabVoice \musica }
>>
} \paper { line-width = 8\cm } \textbackslash{}end\{lilypond\}
\textbackslash{}end\{figure\}
Which change in Pandoc might have caused this?
(I'm using lyluatex to process music fragments with Lilypond)
Sorry, I thought I was on Pandoc issue tracker
My problem is probably this issue. Sorry for the noise!
If you are using Pandoc 2.x, you could use knitr::raw_latex(htl_raw)
instead of cat()
+ results='asis'
.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
When knitting the attached file, the
\begin{table}
and\end{table}
lines are escaped, even though the chunk hasresults="asis"
.The relevant chunk is:
The result looks like:
This is as small a MWE as I could get. I think it has something to do with the TeX being parsed, because very similar examples don't do the same thing. For example, if I change
\\somecommand{}
to\\somecommand{}{}
, then the TeX is not escaped.Apologies if this is pandoc (on one side) or rmarkdown (on the other). The toolchain becomes long here, and I'm not even sure I understand how these tools interact.
I guess the underlying question is, why is the TeX being escaped ever?
asis-output-heisenbug.zip
Sessioninfo: