tufte icon indicating copy to clipboard operation
tufte copied to clipboard

Code Chunk in Aside

Open 1danjordan opened this issue 9 years ago • 11 comments

Hi guys,

I've been using R Markdown for a while for assignments in university. My experience has been terrific and I am forever grateful to @yihui and the rest of R Studio for creating and supporting it. Some assignments require the inclusion of code in the document, and I thought using Tufte style margins might be nice for including one liners and short snippets.

I was hoping there would be chunk option, similar to fig.margin but I don't think this feature is supported. I've been looking all over but I cannot find simple way to hack it either. There is no mention or example in the RStudio material, however I did see something in Michael Sachs original example. To place the code chunk in the margin he included the html aside tags which doesn't seem to work as he's specified any more, and alludes to using the pandoc footnote syntax for LaTeX/PDF. Pandoc footnotes seem to work for outputting inline R results, but I can't get it to work for code chunks.

Is there a way to achieve this and/or are there future plans to implement something like it? I don't know if this feature clashes with the Tufte style and understand that if this were so this might make this issue irrelevant.

1danjordan avatar Apr 01 '16 17:04 1danjordan

Sorry for the late response. You are the second one who requested this feature, so I'll consider it. It should be relatively easy to implement for LaTeX output, but might be a little tricky for HTML output, since I don't use the <aside> tag.

yihui avatar Apr 07 '16 03:04 yihui

If I was a better developer I would have forked and given it a go myself, but I'm not and I think this feature would be really beneficial. Thanks yihui!

1danjordan avatar Apr 07 '16 10:04 1danjordan

I want to pitch in and say I am trying to hack a way to do this and would love to have a cleaner solution that my current one. Thanks Yihui.

spholmes avatar Apr 17 '16 17:04 spholmes

@spholmes Sure I'll think about it. You were the first one who requested this feature :)

yihui avatar Apr 18 '16 06:04 yihui

I'm not sure whether it would be a related feature or a distinct one, but being able to include htmlwidgets as a margin content would be awesome. At the moment it's a bit frustrating that you're able to include static figures in margin but not dynamic ones. (I'm only thinking about HTML output, obvisouly).

joelgombin avatar Jun 22 '16 09:06 joelgombin

First of all, thank all those who have created and expanded R markdown, and especially Yihui. We have much to thank to you. In my case, I was seeking to include code chunks in aside, in order to write a book about graphics in R. For me, Tufte's style is an example of how legibility and spatial equilibrium can be accompanied by visual beauty. Although it may seem outdated, I think that beauty is a psychological added value to any reading; a small pleasure in itself. I'm not a programmer, so I can help to use and test any improvement in this (or any other) way. Thank you all, again.

jcchacon avatar Jul 11 '16 10:07 jcchacon

+1 here, would be helpful to be able to add inline code in margin text. Especially for parameterized reporting this would be an excellent feature.

Example usage case:

A standardized report that has customized margin text by parameter.

1beb avatar Jan 24 '17 17:01 1beb

+1 for inline code in the margin for html output.

jeremy-allen avatar Nov 17 '17 22:11 jeremy-allen

+1, would be a great feature.

egarpor avatar Nov 14 '18 21:11 egarpor

+1 for code chunk in the margin!

aminadibi avatar Jun 09 '20 14:06 aminadibi

Anyone have done it? Thanks

I'm not sure whether it would be a related feature or a distinct one, but being able to include htmlwidgets as a margin content would be awesome. At the moment it's a bit frustrating that you're able to include static figures in margin but not dynamic ones. (I'm only thinking about HTML output, obvisouly).

lsempe77 avatar Sep 07 '21 09:09 lsempe77