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

chunk names, dots and plots #321

Closed
romunov opened this issue Jul 8, 2012 · 6 comments
Closed

chunk names, dots and plots #321

romunov opened this issue Jul 8, 2012 · 6 comments
Labels
bug Bugs
Milestone

Comments

@romunov
Copy link

romunov commented Jul 8, 2012

I've noticed that if one (accidently) uses chunk name with dots, the result plot will not behave as expected - it will not produce an image, but it will "plot". If one uses fig.cap argument, there will be figure caption. Just no plot. It would be helpful if the diagnostic output of "knitting" would indicate an invalid chunk name which may result in "unexpected behavior".

\documentclass[a4paper]{article}
\SweaveOpts{out.width = "\\maxwidth"}

\begin{document}

<<chunk.with.dot, echo = TRUE>>=
plot(1:10, 1:10, main = "chunk with dots")
@

<<chunk_no_dots, echo = TRUE>>=
plot(1:10, 1:10, main = "chunk with no dots")
@

\end{document}
@yihui
Copy link
Owner

yihui commented Jul 8, 2012

you have been warned in the documentation: http://yihui.name/knitr/options

but you might be right -- I should replace dots with more robust characters for LaTeX

@romunov
Copy link
Author

romunov commented Jul 8, 2012

In my case, I was copy/pasting some variables names to chunk names for diagnosis purposes and dots slipped past me. I'm just saying it would be nice to have a warning when knitting.

@yihui
Copy link
Owner

yihui commented Jul 8, 2012

I agree. I'll do it. Thanks!

@yihui yihui closed this as completed in bb2021c Jul 9, 2012
@yihui
Copy link
Owner

yihui commented Jul 9, 2012

Should be fixed now.

BTW, note \SweaveOpts{out.width = "\\maxwidth"} is no longer necessary; it is the default now (in the latest version).

@yihui yihui reopened this Jul 9, 2012
@yihui
Copy link
Owner

yihui commented Jul 9, 2012

The fix was problematic. I should have only fixed options$fig.path instead of options$label; the latter can confuse users when they use chunk references.

@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
bug Bugs
Projects
None yet
Development

No branches or pull requests

2 participants