output-location
Showing code and output side-by-side or delayed reveal of the output are commonly used techniques for teaching programming when the mode of delivery is slides. The output-location
chunk option makes it easy to achieve these.
Possible values for the output-location
option are as follows:
fragment
: Display output as a fragment, i.e., delay showing it until it is explicitly stepped through by advancing the slides.slide
: Display output on the subsequent slide.column
: Display output in a column adjacent to the code. This splits the slide into two columns, each of which span 50% of the width of the slidecolumn-fragment
: Display output in a column adjacent to the code and delay showing it until its explicitly stepped through by advancing the slides.
You can see these in action in the slide deck below.
Note that for the column options I also adjusted fig-height
and fig-width
since the default size and aspect ration doesn’t work well for figures spanning only half the width of the slide.