[R] Getting Rmarkdown to generate custom LaTEX environment

Thierry Onkelinx thierry.onkelinx at inbo.be
Wed Feb 25 19:53:36 CET 2015


This has nothing to do with *r*markdown but with the markdown language
itself. Markdown has the concept of a figure caption. Hence fig.cap in
Rmarkdown can work.
Op 25 feb. 2015 18:42 schreef "Huan Truong" <_ op tnhh.net>:

> Hi Thierry,
>
> Thanks for the quick and informative answer. I understand that
> rmarkdown doesn't know the concept of figure*. However, I wonder why
> it knows that I could pass fig.cap fine, but not fig.env? Where in the
> code of rmarkdown does it take care of that fig.cap handling, so I can
> patch it to make it understand fig.env?
>
> - Huan.
>
> On Wed, Feb 25, 2015 at 3:39 AM, Thierry Onkelinx
> <thierry.onkelinx op inbo.be> wrote:
> > Dear Huan,
> >
> > Markdown doesn't know the concept of figure*. So you can't generate it
> with
> > native Markdown markup. If you really need figure*, then the only option
> in
> > markdown is to generate the LaTeX code yourself. Note that is will break
> > conversion to formats that don't handle LaTeX code.
> >
> > Best regards,
> >
> > ir. Thierry Onkelinx
> > Instituut voor natuur- en bosonderzoek / Research Institute for Nature
> and
> > Forest
> > team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> > Kliniekstraat 25
> > 1070 Anderlecht
> > Belgium
> >
> > To call in the statistician after the experiment is done may be no more
> than
> > asking him to perform a post-mortem examination: he may be able to say
> what
> > the experiment died of. ~ Sir Ronald Aylmer Fisher
> > The plural of anecdote is not data. ~ Roger Brinner
> > The combination of some data and an aching desire for an answer does not
> > ensure that a reasonable answer can be extracted from a given body of
> data.
> > ~ John Tukey
> >
> > 2015-02-25 3:28 GMT+01:00 Huan Truong <_ op tnhh.net>:
> >>
> >> Hi all,
> >>
> >> I was struggling trying to make my Rmarkdown document to generate
> >>
> >> \begin{figure*}
> >>
> >> instead of
> >>
> >> \begin{figure}
> >>
> >> So that the figure spans on two columns (I'm using a custom template).
> >>
> >> in my figure. I have read the Rmarkdown Reference Guide, and searched
> >> for it on StackOverflow, and the general idea seems to be that I could
> >> somehow pass the fig.env variable to the figure, but I have tried it
> >> with no success: Something like this still doesn't have any effect
> >> whatsoever on the latex code generated:
> >>
> >> ```{r test-plot, echo=FALSE, fig.cap = "Test
> >> plot.\\label{fig:test-plot}", fig.env='figure*' }
> >> options(fig.env='figure*')
> >> plot(blah)
> >> ```
> >>
> >> I know I must have missed something but couldn't figure out what I'm
> >> missing after hours of struggling. Any help is much appreciated.
> >>
> >> I have a smaller problem where I want to customize the [htbp] option
> >> of the figure, and facing the same problem.
> >>
> >> Cheers,
> >> - Huan.
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >>
> >> Eccentric Graduate Student
> >> Google Talk/Jabber huant op tnhh.net - Website tnhh.net - Phone
> >> 1-858-848-ROFL
> >>
> >> ______________________________________________
> >> R-help op r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
>
>
> --
>
> Eccentric Graduate Student
> Google Talk/Jabber huant op tnhh.net - Website tnhh.net - Phone
> 1-858-848-ROFL
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list