Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Anything is possible!!</h2> <p>Please see <a href="https://gist.github.com/Thell/5827832#file-exmple-rmd">this gist</a> which does what you describe. Just save and knit it to see it in action... For some reason Rpub didn't want to publish it (unknown error).</p> <p>Testing with converting the knitr generated <code>.html</code> to <code>.pdf</code> via pandoc resulted in working links as well, which is a nice bonus!</p> <p>The workhorse is::</p> <pre><code>```{r setup, echo=FALSE, results='hide'} chunkref &lt;- local({ function(chunklabel) { sprintf('[%s](#%s)', chunklabel, chunklabel ) } }) secref &lt;- local({ function(seclabel) { sprintf('[%s](#%s)', seclabel, seclabel ) } }) pgref &lt;- local({ function(n) sprintf('[Page-%i](#Page-%i)', n, n) }) sec &lt;- local({ function(seclabel) { sprintf('# &lt;a name="%s"/&gt; %s', seclabel, seclabel ) } }) pgcount &lt;- local({ pg &lt;- 0 function(inc=T) { if( inc ) { pg &lt;&lt;- pg + 1 } return( pg ) } }) pganchor &lt;- local({ function(doLabel=T) { if( doLabel) { sprintf('\n-----\nPage-%i\n&lt;a name="Page-%i"/&gt;\n', pgcount(inc=F), pgcount() ) } else { sprintf('\n&lt;a name="Page-%i"/&gt;\n', pgcount() ) } } }) knit_hooks$set( anchor = function(before, options, envir) { if ( before ) { sprintf('&lt;a name="%s"/&gt;\n', options$label ) } }) knit_hooks$set( echo.label = function(before, options, envir) { if ( before ) { sprintf('&gt; %s', options$label ) } }) knit_hooks$set( pgbreak = function(before, options, envir) { if ( !before ) { pganchor(); } }) ```` </code></pre> <p>Which allows for multiple types of references to be created...</p> <pre><code>Inline: `r sec("Introduction")` then `r secref("Introduction")` </code></pre> <p>Or</p> <p>As chunk options:</p> <pre><code>```{r car-summary, echo=T, warning=FALSE, anchor=T, pgbreak=T, echo.label=F}` </code></pre> <p>then</p> <pre><code>`r chunkref("car-summary")` </code></pre> <p>Even 'top of page' links and 'bottom of page' markers and labels...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload