Abhi-1U / texor

Converting 'LaTeX' 'R Journal' Articles into 'RJ-web-articles'
https://abhi-1u.github.io/texor/
Other
7 stars 2 forks source link

Unwrap Sweave code chunks out of figure blocks #98

Open Abhi-1U opened 1 month ago

Abhi-1U commented 1 month ago

Try to add a check for raw block of Rmarkdown code during conversion and remove the figure wrapper if it encapsulates a code block.

However this can possibly conflict with the inclusion of other code blocks within figure environments.

An example of this is :

\begin{frame}[fragile]
  \frametitle{\texttt{PerformanceAnalytics:::textplot} example}
  \begin{figure}
    \centering
    \begin{scriptsize}
<<PAtextplot, echo=TRUE, fig=TRUE>>=
PerformanceAnalytics:::textplot(ham1.f.downside,  halign = "center", valign = "top", row.valign="center", col.rownames=peer.colorset,  mar = c(0,0,3,0)+0.1)
box(col="lightblue")
@
    \end{scriptsize}
  \end{figure}
\end{frame}

To :

\begin{frame}[fragile]
  \frametitle{\texttt{PerformanceAnalytics:::textplot} example}

<<PAtextplot, echo=TRUE, fig=FALSE>>=
require(PerformanceAnalytics)
args(PerformanceAnalytics:::textplot)
@

\end{frame}

Originally posted by @Abhi-1U in https://github.com/Abhi-1U/texor/issues/97#issuecomment-2421612373