Abhi-1U / texor

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

rnw_to_rmd fails on some vignettes from PerformanceAnalytics package #97

Open braverock opened 4 days ago

braverock commented 4 days ago

Thank you for the very useful package. I've been able to use it to convert some old Sweave vignettes from PerformanceAnalytics, but it fails on others.

All the vignettes that fail fail with error

Error in if (wrapper_input == "") { : the condition has length > 1

and with a traceback() that points to get_wrapper_type

the vignette PA-Bacon.Rnw converted, though the title,author,and abstract were not carried over (this was easily fixed by hand).

vignettes EstimationComoments.Rnw, PA-charts.Rnw, PerformanceAnalyticsChartsPresentation-Meielisalp-2007.Rnw, PerformanceAnalyticsPresentation-UseR-2007.Rnw, portfolio_returns.Rnw, and textplotPresentation-CRUG-2011.Rnw all fail with the above referenced error.

PerformanceAnalytics

Abhi-1U commented 3 days ago

Thanks for the feedback. The errors you are facing were somewhat fixed in a newer version of the package, please try with version 1.5.0 of texor and 0.5.0 of rebib, both of which should be available on CRAN or the latest github commit.

I have been able to convert the listed vignettes using this command: texor::rnw_to_rmd('vignettes/EstimationComoments.Rnw', output_format = 'bookdown',autonumber_eq = TRUE) .

However I found that some of the Sweave articles have used duplicate chunk labels so while compiling Rmarkdown it raises issues which needs to be fixed manually as of now.

Similarly I tried to convert the Beamer presentations as well and it will be converted to a single page Rmd file but it needs some modifications such as removing the figure environment block around the sweave code chunk :

\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}

Also, if you further face some errors, I would recommend to convert the individual Sweave files with dependencies in a seperate/isolated folder, as left over artifacts from previous failed conversions may cause the current conversion to fail as well.

Do let me know if you face any further issues. Thanks.