inbo / INBOmd

An R package with a collection of RMarkdown styles and templates. Elaborate examples are available at https://github.com/inbo/INBOmd_examples
https://inbo.github.io/INBOmd
GNU General Public License v3.0
11 stars 2 forks source link

pandoc #75

Closed jwijffels closed 3 years ago

jwijffels commented 3 years ago

I'm using a modified variant of INBOmd for slides. I noticed that using the latest Rstudio which ships an updated pandoc, the conversion from Rmd to tex provides other code tags. From the docs at https://hackage.haskell.org/package/pandoc-2.3/docs/Text-Pandoc-Highlighting.html

Format tokens using HTML spans inside code tags. For example, A KeywordTok is rendered as a span with class kw. Short class names correspond to TokenTypes as follows: KeywordTok = kw, DataTypeTok = dt, DecValTok = dv, BaseNTok = bn, FloatTok = fl, CharTok = ch, StringTok = st, CommentTok = co, OtherTok = ot, AlertTok = al, FunctionTok = fu, RegionMarkerTok = re, ErrorTok = er, ConstantTok = cn, SpecialCharTok = sc, VerbatimStringTok = vs, SpecialStringTok = ss, ImportTok = im, DocumentationTok = do, AnnotationTok = an, CommentVarTok = cv, VariableTok = va, ControlFlowTok = cf, OperatorTok = op, BuiltInTok = bu, ExtensionTok = ex, PreprocessorTok = pp, AttributeTok = at, InformationTok = in, WarningTok = wa. A NormalTok is not marked up at all.

That give latex compilation issues indicating AttributeTokwas not found in a simple chunk like where that n = was wrapped using that AttributeTok.

! Undefined control sequence.
<argument> ... {rnorm}\NormalTok {(}\AttributeTok 
                                                  {n =} \DecValTok {500}\Nor...
l.11 ...ibuteTok{n =} \DecValTok{500}\NormalTok{)}

As you can see in the .tex which generated this error

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{x }\OtherTok{\textless{}{-}} \FunctionTok{rnorm}\NormalTok{(}\AttributeTok{n =} \DecValTok{500}\NormalTok{)}
\NormalTok{x }\OtherTok{\textless{}{-}} \FunctionTok{cumsum}\NormalTok{(x)}
\FunctionTok{str}\NormalTok{(x)}
\end{Highlighting}
\end{Shaded}

My guess is that you have the same issues in e.g. https://github.com/inbo/INBOmd/blob/main/inst/local_tex/tex/latex/inbogeneric_2015/inbogeneric_2015.sty

x <- rnorm(n = 500)
ThierryO commented 3 years ago

I've noticed that too (I'm running daily build Rstudio).

Fixed in #69

jwijffels commented 3 years ago

Hadn't looked at that pull requests, seems fixed indeed there. Let me close this.