<sec:sectionA>
Code is enclosed within #+begin_src/#+end_src
blocks.
x <- 1:10
y <- 1:10
These blocks are extracted creating a source code file (tangling)
with C-c C-v t
. Without header arguments the code chunk is exported
and tangled as is. Use C-c
’ to edit the current code block. This
brings up a language major-mode edit buffer containing the body of the
code block. Use C-c
’ again to exit. If you need to evaluate it use
C-c C-c
.
Using the header argument :exports none
the next code chunk is not
included in the exported file (LaTeX or HTML) but is included in the
tangled file (R
code). This option is useful to add configuration
code that you don’t want to show in the book.
Use :tangle no
if you need to exclude a code chunk from the tangled
file.
Use C-c C-l
or [[]]
to insert a link or a reference: Section
sec:sectionA.
Figure fig:dummyGraphic is exported to a PDF file using the header arguments
:results output graphics
. The results header argument writes the graphics output to the file specified in the =:file= header argument. You need this specification when usinglattice
andggplot2
graphics.- =:exports both=. Both the code and results are included in the LaTeX exported file.
xyplot(x ~ y)
The next lines insert the PDF file with includegraphics
inside a
float figure in the LaTeX file. Use #+CAPTION
to define the caption
and #+ATTR_LATEX# to define the includegraphics
arguments.