Replies: 5 comments
-
I created texor-playground repo to show a reproducible test process, this test example has been added to the repo. |
Beta Was this translation helpful? Give feedback.
-
I create pandoc reader The output of the example is file.md and file.tex : ``` {r }
options(OutDec = ',')
```
``` {r }
options(OutDec = '.')
``` \documentclass{article}
\usepackage{amsmath}
\begin{document}
When the option OutDec is not \texttt{.}, put numbers in \texttt{\textbackslash{}text}. See \#348.
% R_CODE_CHUNK_PLACEHOLDER
This is the first test. abc \Sexpr{0.6} def
another test $a = \Sexpr{0.6}$.
and the last one $a = \Sexpr{'0.6'}$.
% R_CODE_CHUNK_PLACEHOLDER
This is the first test. abc \Sexpr{0.6} def
another test $a = \Sexpr{0.6}$.
and the last one $a = \Sexpr{'0.6'}$.
\end{document} To separate the .Rnw file, execute following commands: pandoc 008-outdec.Rnw --from latex -f sweave_code_reader.lua --lua-filter code_chunk_patch.lua -t markdown-simple_tables-pipe_tables-fenced_code_attributes -o file.md
pandoc 008-outdec.Rnw --from latex -f Sweave_code_remove.lua -t latex -o file.tex |
Beta Was this translation helpful? Give feedback.
-
I played around a bit with your approach, it seems to be good but has a few issues in my mind.
|
Beta Was this translation helpful? Give feedback.
-
Let me reply one by one.
\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
This is all you need to do if you want to go back to the Sweave style:
<<setup, include=FALSE>>=
library(knitr)
render_sweave()
@
The quick brown fox jumps over the lazy dog the quick brown fox jumps over the
lazy dog the quick brown fox jumps over the lazy dog.
\begin{verbatim}
try this:
\Sexpr{1+1}
\end{verbatim}
\end{document}
In this case, \Sexpr{1+1} will be shown as
|
Beta Was this translation helpful? Give feedback.
-
You can disregard the last point, after some investigating it turned out to be accepted by the knitting tool.
It depends on the method you use to merge the two documents, if it works out without numbering that should be fine as well.
I tried out something like this in R markdown file and it worked as intended :
But the
It is regarded as the inline equivalent, however pandoc does not seem to touch the macros inside verbatim/math environments, hence the command is not substituted. Its good to see we are progressing in the right direction. |
Beta Was this translation helpful? Give feedback.
-
Based on the custom reader posted as a solution to the test case, I have modified it and tried to pass through non-sweave components (LaTeX) into the pandoc LaTeX reader. However there are a few Issues in properly capturing the non code block parts of the document, which will require some efforts or collaboration to find out what the correct LPEG expression would be to capture it.
Figuring out the Capture expression will be crucial on working with this approach.
pandoc command
Test file source
Beta Was this translation helpful? Give feedback.
All reactions