Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanest way to use marginfigure from Tufte #364

Closed
bryanhanson opened this issue Aug 13, 2012 · 4 comments
Closed

Cleanest way to use marginfigure from Tufte #364

bryanhanson opened this issue Aug 13, 2012 · 4 comments
Labels
feature Feature requests
Milestone

Comments

@bryanhanson
Copy link

If I have this code

<< plot1, echo = FALSE, fig.cap = "Sample Data" >>=
qplot(data = df, x = x, y = y, geom = "point", xlab = "x values", ylab = "y values")
@

It puts it in a figure environment. But what if I want it in a marginfigure environment? Is there some option that can be specified? Or, do I split into two parts: a code chunk to make the pdf, and then an empty code chunk to place the figure in the document, like this one from the manual:

\begin{marginfigure}
<<pdf-dev, ref.label='test-plot', dev='pdf', out.width='\\linewidth', echo=FALSE>>=
@
\caption{The default PDF device.\label{mar:pdf-dev}}
\end{marginfigure}

Just wondering if there is an option I missed that would make this a one step process. Thanks, Bryan

@yihui
Copy link
Owner

yihui commented Aug 13, 2012

unfortunately \begin{figure} is currently hard-coded, but that is a very good question, and I have also been considering how to support other environments like figure* or marginfigure; I'll decide how to do it soon since you brought it up

@bryanhanson
Copy link
Author

Appreciated Yihui. What got me thinking about this was actually margintable and using xtable. xtable has some ability to pass in alternate LaTeX environments through it's argument floating.environment. In fact, someone has asked that margintable be added to xtable (https://r-forge.r-project.org/tracker/?func=detail&atid=4864&aid=2168&group_id=1228) You might be able to get some ideas there. Thanks for considering it.

@yihui yihui closed this as completed in b1bd23c Aug 22, 2012
@yihui
Copy link
Owner

yihui commented Aug 22, 2012

It is actually very easy to add the support to customize the figure environment; I was just struggling on whether to introduce a new option (already too many options). Finally I decided to add fig.env, e.g. fig.env='marginfigure'.

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests
Projects
None yet
Development

No branches or pull requests

2 participants